def getDescription(photoInfo=None, panoramioreview=False, reviewer=u'', override=u'', addCategory=u''): ''' Build description for the image. ''' desc = u'' desc = desc + u'{{Information\n' desc = desc + u'|description=%(photo_title)s\n' desc = desc + u'|date=%(upload_date)s (upload date)\n' desc = desc + u'|source=[%(photo_url)s Panoramio]\n' desc = desc + u'|author=[%(owner_url)s?with_photo_id=%(photo_id)s %(owner_name)s] \n' desc = desc + u'|permission=\n' desc = desc + u'|other_versions=\n' desc = desc + u'|other_fields=\n' desc = desc + u'}}\n' if photoInfo.get(u'latitude') and photoInfo.get(u'longitude'): desc = desc + u'{{Location dec|%(latitude)s|%(longitude)s|source:Panoramio}}\n' desc = desc + u'\n' desc = desc + u'=={{int:license-header}}==\n' if override: desc = desc + override else: if photoInfo.get(u'license') == u'by-sa': desc = desc + u'{{Cc-by-sa-3.0}}\n' if panoramioreview: desc = desc + u'{{Panoramioreview|%s|{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n' % ( reviewer, ) else: desc = desc + u'{{Panoramioreview}}\n' desc = desc + u'\n' cats = u'' if addCategory: desc = desc + u'\n[[Category:%s]]\n' % (addCategory, ) cats = True # Get categories based on location if photoInfo.get(u'latitude') and photoInfo.get(u'longitude'): cats = imagerecat.getOpenStreetMapCats(photoInfo.get(u'latitude'), photoInfo.get(u'longitude')) cats = imagerecat.applyAllFilters(cats) for cat in cats: desc = desc + u'[[Category:%s]]\n' % (cat, ) if not cats: desc = desc + u'{{subst:Unc}}\n' return desc % photoInfo
def getDescription(photoInfo=None, panoramioreview=False, reviewer=u'', override=u'', addCategory=u''): ''' Build description for the image. ''' desc = u'' desc = desc + u'{{Information\n' desc = desc + u'|description=%(photo_title)s\n' desc = desc + u'|date=%(upload_date)s (upload date)\n' desc = desc + u'|source=[%(photo_url)s Panoramio]\n' desc = desc + u'|author=[%(owner_url)s?with_photo_id=%(photo_id)s %(owner_name)s] \n' desc = desc + u'|permission=\n' desc = desc + u'|other_versions=\n' desc = desc + u'|other_fields=\n' desc = desc + u'}}\n' if photoInfo.get(u'latitude') and photoInfo.get(u'longitude'): desc = desc + u'{{Location dec|%(latitude)s|%(longitude)s|source:Panoramio}}\n' desc = desc + u'\n' desc = desc + u'=={{int:license-header}}==\n' if override: desc = desc + override else: if photoInfo.get(u'license')==u'by-sa': desc = desc + u'{{Cc-by-sa-3.0}}\n' if panoramioreview: desc = desc + u'{{Panoramioreview|%s|{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY2}}}}\n' % (reviewer,) else: desc = desc + u'{{Panoramioreview}}\n' desc = desc + u'\n' cats = u'' if addCategory: desc = desc + u'\n[[Category:%s]]\n' % (addCategory,) cats = True # Get categories based on location if photoInfo.get(u'latitude') and photoInfo.get(u'longitude'): cats=imagerecat.getOpenStreetMapCats(photoInfo.get(u'latitude'), photoInfo.get(u'longitude')) cats=imagerecat.applyAllFilters(cats) for cat in cats: desc = desc + u'[[Category:%s]]\n' % (cat,) if not cats: desc = desc + u'{{subst:Unc}}\n' return desc % photoInfo