forked from TheLastGimbus/GooglePhotosTakeoutHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
534c03f
commit 6d9bdfb
Showing
26 changed files
with
745 additions
and
1,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flutter_sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"flutterSdkVersion": "3.3.9", | ||
"flavors": {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
.idea/ | ||
.vscode/ | ||
poetry.lock | ||
pyproject.toml | ||
venv/ | ||
__pycache__/ | ||
|
||
# Files and directories created by pub. | ||
.dart_tool/ | ||
.packages | ||
|
||
# Conventional directory for build output. | ||
build/ | ||
dist/ | ||
*.egg-info | ||
.eggs/ | ||
|
||
photos/ | ||
|
||
ALL_PHOTOS/ | ||
output/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 3.0.0 | ||
|
||
- Dart! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file configures the static analysis results for your project (errors, | ||
# warnings, and lints). | ||
# | ||
# This enables the 'recommended' set of lints from `package:lints`. | ||
# This set helps identify many issues that may lead to problems when running | ||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic | ||
# style and format. | ||
# | ||
# If you want a smaller set of lints you can change this to specify | ||
# 'package:lints/core.yaml'. These are just the most critical lints | ||
# (the recommended set includes the core lints). | ||
# The core lints are also what is used by pub.dev for scoring packages. | ||
|
||
include: package:lints/recommended.yaml | ||
|
||
# Uncomment the following section to specify additional rules. | ||
|
||
# linter: | ||
# rules: | ||
# - camel_case_types | ||
|
||
# analyzer: | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
|
||
# For more information about the core and recommended set of lints, see | ||
# https://dart.dev/go/core-lints | ||
|
||
# For additional information about configuring this file, see | ||
# https://dart.dev/guides/language/analysis-options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:args/args.dart'; | ||
import 'package:gpth/album.dart'; | ||
import 'package:gpth/datetime_extractors.dart'; | ||
import 'package:gpth/duplicate.dart'; | ||
import 'package:gpth/media.dart'; | ||
import 'package:gpth/utils.dart'; | ||
import 'package:path/path.dart'; | ||
|
||
// elastic list of extractors - can add/remove more in future | ||
// for example, with cli flags | ||
// those are in order of reliability | ||
// if one fails, only then later ones will be used | ||
final List<DateTimeExtractor> dateExtractors = [ | ||
jsonExtractor, | ||
]; | ||
|
||
void main(List<String> arguments) async { | ||
final parser = ArgParser() | ||
..addOption('input', abbr: 'i', help: 'Input folder', mandatory: true) | ||
..addOption('output', abbr: 'o', help: 'Output folder'); | ||
final res = parser.parse(arguments); | ||
|
||
final cliInput = res['input'] as String; | ||
|
||
final input = Directory(cliInput); | ||
|
||
final media = <Media>[]; | ||
|
||
final yearFolders = <Directory>[]; | ||
final albumFolders = <Directory>[]; | ||
|
||
/// ##### Find all photos/videos and add to list ##### | ||
for (final f in input.listSync().whereType<Directory>()) { | ||
if (basename(f.path).startsWith('Photos from ')) { | ||
yearFolders.add(f); | ||
} else { | ||
albumFolders.add(f); | ||
} | ||
} | ||
for (final f in yearFolders) { | ||
for (final file in f.listSync().wherePhotoVideo()) { | ||
media.add(Media(file)); | ||
} | ||
} | ||
|
||
/// ################################################## | ||
/// ##### Extracting/predicting dates using given extractors ##### | ||
var q = 0; | ||
for (final extractor in dateExtractors) { | ||
for (var i = 0; i < media.length; i++) { | ||
// if already has date then skip | ||
if (media[i].dateTaken == null) { | ||
final date = extractor(media[i].file); | ||
if (date != null) { | ||
media[i].dateTaken = date; | ||
media[i].dateTakenAccuracy = q; | ||
} | ||
} | ||
} | ||
// increase this every time - indicate the extraction gets more shitty | ||
q++; | ||
} | ||
|
||
/// ############################################################## | ||
/// ##### Find duplicates ##### | ||
removeDuplicates(media); | ||
|
||
/// ########################### | ||
/// ##### Find albums ##### | ||
// Now, this is akward... | ||
// we can find albums without a problem, but we have no idea what | ||
// to do about it 🤷 | ||
// so just print it now (flex) | ||
print(findAlbums(albumFolders, media)); | ||
|
||
/// ####################### | ||
print(media); | ||
} |
Empty file.
Oops, something went wrong.