From 3e9453df11f069ce905f3279728e1a800648d815 Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sat, 31 Jul 2010 10:17:02 -0500 Subject: [PATCH] Get photo date-taken and use in filename, so filenames sort chronologically --- flickrtouchr.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/flickrtouchr.py b/flickrtouchr.py index fc8c3e0..4638f8e 100755 --- a/flickrtouchr.py +++ b/flickrtouchr.py @@ -244,6 +244,7 @@ if __name__ == '__main__': # Build the list of photos url = "http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos" url += "&photoset_id=" + pid + url += "&extras=date_taken" # Append to our list of urls urls.append( (url , dir) ) @@ -253,10 +254,12 @@ if __name__ == '__main__': # Add the photos which are not in any set url = "http://api.flickr.com/services/rest/?method=flickr.photos.getNotInSet" + url += "&extras=date_taken" urls.append( (url, "No Set") ) # Add the user's Favourites url = "http://api.flickr.com/services/rest/?method=flickr.favorites.getList" + url += "&extras=date_taken" urls.append( (url, "Favourites") ) # Time to get the photos @@ -295,8 +298,12 @@ if __name__ == '__main__': # Grab the id photoid = photo.getAttribute("id") - # The target - target = dir + "/" + photoid + ".jpg" + # Grab the taken date + taken = photo.getAttribute("datetaken") + taken = taken.replace(":","").replace("-","").replace(" ","") + + # Build the target filename + target = dir + "/" + taken + "-" + photoid + ".jpg" # Skip files that exist if os.access(target, os.R_OK): -- 2.43.0