http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9635
Revision: 9635 Author: multichill Date: 2011-10-16 18:21:46 +0000 (Sun, 16 Oct 2011) Log Message: ----------- * Add some fair use templates to the list of skip templates to prevent the bot from uploading photos of (unfree) sculptures * Add {{orphan image}} to the list of garbage templates to remove * Also strip off garbage templates with parameters * If the license is in the permission part of the information template: Remove it, otherwise it will show up twice.
Modified Paths: -------------- trunk/pywikipedia/imagecopy_self.py
Modified: trunk/pywikipedia/imagecopy_self.py =================================================================== --- trunk/pywikipedia/imagecopy_self.py 2011-10-16 12:23:45 UTC (rev 9634) +++ trunk/pywikipedia/imagecopy_self.py 2011-10-16 18:21:46 UTC (rev 9635) @@ -126,6 +126,10 @@ u'Ffd', u'PD-user', # Only the self templates are supported for now. u'Ticket Scan', + u'Non-free 2D art', + u'Non-free 3D art', + u'Non-free architectural work', + u'Non-free fair use in', ], 'lb' : [u'Läschen', ], @@ -169,7 +173,7 @@ 'en': [u'==\s*Description\s*==', u'==\s*Summary\s*==', u'==\s*Licensing:?\s*==', - u'{{(Copy to Wikimedia Commons|Move to Commons|Move to commons|Move to Wikimedia Commons|Copy to commons|Mtc|MtC|MTC|CWC|CtWC|CTWC|Ctwc|Tocommons|Copy to Commons|To Commons|Movetocommons|Move to Wikimedia commons|Move-to-commons|Commons ok|ToCommons|To commons|MoveToCommons|Copy to wikimedia commons|Upload to commons|CopyToCommons|Copytocommons|MITC|MovetoCommons|Do move to Commons)}}' + u'{{(Copy to Wikimedia Commons|Move to Commons|Move to commons|Move to Wikimedia Commons|Copy to commons|Mtc|MtC|MTC|CWC|CtWC|CTWC|Ctwc|Tocommons|Copy to Commons|To Commons|Movetocommons|Move to Wikimedia commons|Move-to-commons|Commons ok|ToCommons|To commons|MoveToCommons|Copy to wikimedia commons|Upload to commons|CopyToCommons|Copytocommons|MITC|MovetoCommons|Do move to Commons|Orphan image)(|[^}]+)?}}' ], 'lb' : [u'==\s*Résumé\s*==', u'==\s*Lizenz:\s*==', @@ -382,6 +386,9 @@ # Permission # Still have to filter out crap like "see below" or "yes" if not contents[u'permission']==u'': + # Strip of the license temlate if it's in the permission section + for (regex, repl) in licenseTemplates[imagepage.site().language()]: + contents[u'permission'] = re.sub(regex, u'', contents[u'permission'], flags=re.IGNORECASE) permission = self.convertLinks(contents[u'permission'], imagepage.site())
# Other_versions
pywikipedia-svn@lists.wikimedia.org