Revision: 7170 Author: alexsh Date: 2009-08-24 17:04:31 +0000 (Mon, 24 Aug 2009)
Log Message: ----------- typo
Modified Paths: -------------- trunk/pywikipedia/flickrripper.py
Modified: trunk/pywikipedia/flickrripper.py =================================================================== --- trunk/pywikipedia/flickrripper.py 2009-08-23 16:13:23 UTC (rev 7169) +++ trunk/pywikipedia/flickrripper.py 2009-08-24 17:04:31 UTC (rev 7170) @@ -55,11 +55,11 @@ ''' license = photoInfo.find('photo').attrib['license'] if (license=='4' or license=='5'): - #Is cc-by or cc-by-sa - return True + #Is cc-by or cc-by-sa + return True else: - #We don't accept other licenses - return False + #We don't accept other licenses + return False
def getTags(photoInfo=None): ''' @@ -67,7 +67,7 @@ ''' result = [] for tag in photoInfo.find('photo').find('tags').findall('tag'): - result.append(tag.text.lower()) + result.append(tag.text.lower()) return result
def getFlinfoDescription(photo_id=0): @@ -88,9 +88,9 @@ username = photoInfo.find('photo').find('owner').attrib['username'] title = photoInfo.find('photo').find('title').text if title: - title = cleanUpTitle(title) + title = cleanUpTitle(title) else: - title = u'' + title = u''
return u'Flickr - %s - %s.jpg' % (username, title)
@@ -123,7 +123,7 @@ url = '' # The assumption is that the largest image is last for size in photoSizes.find('sizes').findall('size'): - url = size.attrib['source'] + url = size.attrib['source'] return url
def buildDescription(flinfoDescription=u'', flickrreview=False, reviewer=u'', override=u''): @@ -180,28 +180,28 @@ if(photo_id): print photo_id (photoInfo, photoSizes) = getPhoto(flickr=flickr, photo_id=photo_id) - if (isAllowedLicense(photoInfo=photoInfo) or override): + if (isAllowedLicense(photoInfo=photoInfo) or override): # Tags not needed atm - #tags=getTags(photoInfo=photoInfo) + #tags=getTags(photoInfo=photoInfo)
- flinfoDescription = getFlinfoDescription(photo_id=photo_id) + flinfoDescription = getFlinfoDescription(photo_id=photo_id)
- filename = getFilename(photoInfo=photoInfo) - #print filename - photoUrl = getPhotoUrl(photoSizes=photoSizes) - #print photoUrl + filename = getFilename(photoInfo=photoInfo) + #print filename + photoUrl = getPhotoUrl(photoSizes=photoSizes) + #print photoUrl photoDescription = buildDescription(flinfoDescription=flinfoDescription, flickrreview=flickrreview, reviewer=reviewer, override=override) #wikipedia.output(photoDescription) (newPhotoDescription, newFilename, skip)=Tkdialog(photoDescription, photoUrl, filename).run() #wikipedia.output(newPhotoDescription) - #if (wikipedia.Page(title=u'File:'+ filename, site=wikipedia.getSite()).exists()): - # I should probably check if the hash is the same and if not upload it under a different name - #wikipedia.output(u'File:' + filename + u' already exists!') - #else: - #Do the actual upload - #Would be nice to check before I upload if the file is already at Commons - #Not that important for this program, but maybe for derived programs - if not skip: + #if (wikipedia.Page(title=u'File:'+ filename, site=wikipedia.getSite()).exists()): + # I should probably check if the hash is the same and if not upload it under a different name + #wikipedia.output(u'File:' + filename + u' already exists!') + #else: + #Do the actual upload + #Would be nice to check before I upload if the file is already at Commons + #Not that important for this program, but maybe for derived programs + if not skip: bot = upload.UploadRobot(url=photoUrl, description=newPhotoDescription, useFilename=newFilename, keepFilename=True, verifyDescription=False) bot.upload_image(debug=False) return 0 @@ -326,12 +326,12 @@ flickrreview = False
# Set the Flickr reviewer - if(config.flickr['reviewer']): + if config.flickr['reviewer']: reviewer = config.flickr['reviewer'] - elif(config.sysopnames['commons']['commons']): + elif config.sysopnames['commons']['commons']: reviewer = config.sysopnames['commons']['commons'] - elif(config.usernames['Commons']['Commons']): - reviewer = config.usernames['Commons']['Commons'] + elif config.usernames['commons']['commons']: + reviewer = config.usernames['commons']['commons'] else: reviewer = u''
pywikipedia-svn@lists.wikimedia.org