Skip to content

Commit

Permalink
Dart version!
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastGimbus committed Dec 15, 2022
1 parent 534c03f commit 6d9bdfb
Show file tree
Hide file tree
Showing 26 changed files with 745 additions and 1,002 deletions.
1 change: 1 addition & 0 deletions .fvm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flutter_sdk
4 changes: 4 additions & 0 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.3.9",
"flavors": {}
}
32 changes: 0 additions & 32 deletions .github/workflows/main-test.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/windoza-exe.yml

This file was deleted.

16 changes: 9 additions & 7 deletions .gitignore
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 3.0.0

- Dart!
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![PyPI](https://img.shields.io/pypi/v/google-photos-takeout-helper)](https://pypi.org/project/google-photos-takeout-helper/)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg?logo=paypal)](https://www.paypal.me/TheLastGimbus)

# TODO: Update this
# Google Photos Takeout Helper
## What is this for?
If you ever want to move from Google Photos to other platform/solution, your fastest choice to export all photos is [Google Takeout](https://takeout.google.com/)
Expand Down
30 changes: 30 additions & 0 deletions analysis_options.yaml
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
86 changes: 86 additions & 0 deletions bin/gpth.dart
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.
Loading

0 comments on commit 6d9bdfb

Please sign in to comment.