Created
September 30, 2017 16:24
-
-
Save nitej/b56ee898174025e53c4d44a199613dd2 to your computer and use it in GitHub Desktop.
rmPhotosSaveFav.py
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
import photos | |
albums = photos.get_albums() | |
favs = photos.get_favorites_album() | |
albums.append(favs) | |
all_assets = photos.get_assets() | |
all_videos = photos.get_assets(media_type='video') | |
all_assets += all_videos | |
print "all photos " + str(len(all_assets)) | |
for album in albums: | |
album_assets = album.assets | |
for obj in xrange(len(all_assets)-1,-1,-1): | |
if not all_assets[obj].can_delete: | |
del all_assets[obj] | |
elif all_assets[obj] in album_assets: | |
del all_assets[obj] | |
print album.title, | |
print " removed ", | |
print len(all_assets) | |
photos.batch_delete(all_assets) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment