jenkins-bot has submitted this change and it was merged.
Change subject: [flickrripper] Fallback to photo_id for filename when no title is set ......................................................................
[flickrripper] Fallback to photo_id for filename when no title is set
Otherwise filename is invalid (leading space) and also duplicate. Tested on Commons, all is well.
Change-Id: I5cc2d9fce0a7768527b6e14b88880e3c7630be8a --- M flickrripper.py 1 file changed, 3 insertions(+), 4 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/flickrripper.py b/flickrripper.py index 24d676e..5e7297c 100644 --- a/flickrripper.py +++ b/flickrripper.py @@ -140,7 +140,7 @@
return rawDescription.decode('utf-8')
-def getFilename(photoInfo=None, site=None, project=u'Flickr'): +def getFilename(photoInfo=None, site=None, project=u'Flickr', photoId=None): """ Build a good filename for the upload based on the username and the title. Prevents naming collisions.
@@ -166,8 +166,7 @@ description = description[:items] title = cleanUpTitle(description) else: - title = u'' - # Should probably have the id of the photo as last resort. + title = photoId
if pywikibot.Page(site, u'File:%s - %s - %s.jpg' % (title, project, username)).exists(): @@ -256,7 +255,7 @@ if duplicates: pywikibot.output(u'Found duplicate image at %s' % duplicates.pop()) else: - filename = getFilename(photoInfo) + filename = getFilename(photoInfo, photoId=photo_id) flinfoDescription = getFlinfoDescription(photo_id) photoDescription = buildDescription(flinfoDescription, flickrreview, reviewer,
pywikibot-commits@lists.wikimedia.org