Skip to content

Instantly share code, notes, and snippets.

@deeuu
Last active March 9, 2019 17:42
Show Gist options
  • Select an option

  • Save deeuu/740cab4ac24fc3431d35c8d66c182f0d to your computer and use it in GitHub Desktop.

Select an option

Save deeuu/740cab4ac24fc3431d35c8d66c182f0d to your computer and use it in GitHub Desktop.
Xonsh script wrapper around upload-gphotos to upload all personal image/video folders to google-photo albums
import os
fname, folder, email, pwd = $ARGS
ftypes = ['jpg', 'png', 'mov']
ftypes = tuple([_.upper() for _ in ftypes] + ftypes)
for dirpath, dirs, files in os.walk(os.path.abspath(folder)):
album_name = os.path.basename(dirpath)
if album_name.startswith('.'):
continue
files = [os.path.join(dirpath, f) for f in files if f.endswith(ftypes)]
if len(files):
print('Processing ', dirpath)
upload-gphotos @(files) @(['--username', email, '--password', pwd, '--album', album_name])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment