http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9776
Revision: 9776 Author: multichill Date: 2011-11-23 18:11:00 +0000 (Wed, 23 Nov 2011) Log Message: ----------- Add fallback to description if title is missing.
Modified Paths: -------------- trunk/pywikipedia/flickrripper.py
Modified: trunk/pywikipedia/flickrripper.py =================================================================== --- trunk/pywikipedia/flickrripper.py 2011-11-22 22:30:23 UTC (rev 9775) +++ trunk/pywikipedia/flickrripper.py 2011-11-23 18:11:00 UTC (rev 9776) @@ -152,6 +152,19 @@ else: title = u''
+ if title == u'': + description = photoInfo.find('photo').find('description').text + if description: + description = cleanUpTitle(description) + if len(description)>120: + title = description[0 : 120] + else: + title = description + else: + title = u' + # Should probably have the id of the photo as last resort. + + if pywikibot.Page(site, u'File:%s - %s - %s.jpg' % (title, project, username) ).exists(): i = 1
pywikipedia-svn@lists.wikimedia.org