changeset 8:d29a31694736

Improve README introduction and add --all option.
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 14 Jun 2019 21:45:52 +0200
parents 4ac3fcff5a81
children 9ca4d7618b89
files README.md photosync.py
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Fri Jun 14 21:37:40 2019 +0200
+++ b/README.md	Fri Jun 14 21:45:52 2019 +0200
@@ -1,20 +1,25 @@
 # photosync
 
-Now that Google deprecates the Photos<-\>Drive synchronization, I need another way to back up my photos locally. This
+Now that Google deprecated the Photos<-\>Drive synchronization, I need another way to back up my photos locally. This
 program downloads all photos from your Google Photos account and organizes them locally. It is not very user friendly
 yet, but definitely usable.
 
+photosync only ever downloads photos, i.e. the synchronization works from Google Photos as Source of Truth to your local
+storage. Don't worry about deleting photos locally; although you have to use the slow `--resync` option (note: not yet
+implemented :) to re-download them.
+
 **Pull requests are welcome!**
 
 ## Behavior
 
 By default, photosync will ask for OAuth2 authorization on the console, and then immediately start downloading metadata
-from Google Photos. Once no more new photos are fetched and all metadata is stored in `photosync.db`, photosync will
-look for photos that are not yet marked as downloaded in the database and fetch the actual image files. By default, it
-will organize photos in directories like `year/month/day/` (numerically, 0-padded), but you can write your own method of
-mapping photos to directories.
+from Google Photos. Once no more new photos are fetched and all metadata is stored in `sync.db`, photosync will look for
+photos that are not yet marked as downloaded in the database and fetch the actual image files. By default, it will
+organize photos in directories like `year/month/day/` (numerically, 0-padded), but you can write your own method of
+mapping photos to directories and override it by setting the `path_mapper` argument in the `Driver` constructor called
+from `Main.main()`.
 
-Albums are currently ignored.
+Albums are currently ignored. Videos are supposed to work, but I haven't yet seen the API return them :(
 
 ## Install & Use
 
--- a/photosync.py	Fri Jun 14 21:37:40 2019 +0200
+++ b/photosync.py	Fri Jun 14 21:45:52 2019 +0200
@@ -293,16 +293,20 @@
         Options:
             -h --help       Show this screen
             -d --dir=<dir>  Root directory; where to download photos and store the database.
+            --all           Synchronize *all* photos instead of just before the oldest/after the newest photo. Needed if you have uploaded photos somewhere in the middle.
         '''
         super(arguments.BaseArguments, self).__init__(doc=doc)
         self.dir = self.dir if self.dir else '.'
 
     def main(self):
-        print(self.dir)
+        # TODO: --resync, to inspect the local filesystem for vanished files.
         db = DB(os.path.join(self.dir, 'sync.db'))
         s = PhotosService(tokens=TokenSource(db=db))
         d = Driver(db, s, root=self.dir)
-        d.drive(date_range=(datetime.datetime.fromtimestamp(0), datetime.datetime.now()))
+        if self.all:
+            d.drive(window_heuristic=False)
+        else:
+            d.drive(window_heuristic=True)
 
 
 def main():