-
Hi, I'm trying go write a script that exports all shared albums to import osxphotos
import os
photosdb = osxphotos.PhotosDB()
albums = photosdb.albums_shared
basedir = '~/Local/backups/shared_albums'
for a in albums:
edir = os.path.join(basedir,a)
for p in photosdb.photos(albums=[a]):
p.export(edir) (the code assumes the folders already exist) Now, my problem is that with shared albums, many files are not downloaded, so I need to pass the TypeError: export() got an unexpected keyword argument 'download_missing' and indeed help(p.export()) doesn't list "download_missing". What am I... missing? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Yeah, the export() interface exposed by PhotoInfo is pretty limited and meant for quick export but lacks a lot of options like download_missing. You could use "use_photos_export=True" and that will tell export to always use the interface to Photos to export the file (and download it if necessary). Perhaps I should add "download_missing" but there's a more robust PhotoExporter interface that exposes a lot more capability. try this (I added a few lines so I could actually run the code to test): import osxphotos
import os
from osxphotos.photoexporter import ExportOptions, PhotoExporter
photosdb = osxphotos.PhotosDB()
albums = photosdb.albums_shared
basedir = '~/Local/backups/shared_albums'
for a in albums:
edir = os.path.expanduser(os.path.join(basedir,a))
os.makedirs(edir,exist_ok=True)
for p in photosdb.photos(albums=[a]):
PhotoExporter(p).export(edir, options=ExportOptions(download_missing=True)) |
Beta Was this translation helpful? Give feedback.
-
Ugh. The Terminal is supposed to request the authorization (that's what happens on Catalina and Big Sur). I won't be able to fix this until I get access to a machine with Monterey (and even then, it might be impossible to fix).
When I get a chance I'll try to add some more instrumentation in so you can collect debugging info. Not really sure what the issue is. |
Beta Was this translation helpful? Give feedback.
Yeah, the export() interface exposed by PhotoInfo is pretty limited and meant for quick export but lacks a lot of options like download_missing. You could use "use_photos_export=True" and that will tell export to always use the interface to Photos to export the file (and download it if necessary). Perhaps I should add "download_missing" but there's a more robust PhotoExporter interface that exposes a lot more capability.
try this (I added a few lines so I could actually run the code to test):