wpoa / recitation-bot

MediaWiki bot to upload content to Wikimedia projects and update corresponding citations on Wikipedia.
GNU General Public License v3.0
9 stars 3 forks source link

Fix missing "File:" prefix for uploads to Commons #63

Open Daniel-Mietchen opened 7 years ago

Daniel-Mietchen commented 7 years ago

This causes the files to be treated as pages, which show up above the media files in https://commons.wikimedia.org/wiki/Category:Uploaded_with_reCitation_Bot .

Like the probably related #62, this needs immediate fixing, since such uploads are not acceptable on Commons, which prevents further testing of the bot on Wikisource.

Daniel-Mietchen commented 7 years ago

Digging around a bit in the bot's contributions, it seems that it uploads the file twice, once with prefix and once without, e.g.

The order seems to vary:

difranco commented 7 years ago

Actually, that seems to be from two different runs. The one with the "File:" prefix was uploaded July 2016, the other one just nowish.

On Sat, Feb 18, 2017 at 4:41 PM Daniel Mietchen notifications@github.com wrote:

Digging around a bit, it seems that the bot uploads the file twice, with prefix and without, e.g.

- https://commons.wikimedia.org/wiki/File:A-Cost-Effectiveness-Tool-for-Informing-Policies-on-Zika-Virus-Control-pntd.0004743.g001.jpg

https://commons.wikimedia.org/wiki/A-Cost-Effectiveness-Tool-for-Informing-Policies-on-Zika-Virus-Control-pntd.0004743.g001.jpg

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/wpoa/recitation-bot/issues/63#issuecomment-280886170, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKw7b-4yLYvMKP76ME3tvdpO24cvYukks5rd4-fgaJpZM4MFTa1 .

Daniel-Mietchen commented 7 years ago

That makes sense if one of the DOIs you ran today was a re-run of that July one.

The point is that with "File:" is correct, without is not, and we should only upload the version with the prefix.

difranco commented 7 years ago

I think I know what's going on now. Seems the mwclient API treats the page associated with an image file differently from pywikibot. Previously a page object needed to be created and associated with the file upload. I can move the metadata from there into the file upload itself and stop creating a separate page.

Daniel-Mietchen commented 7 years ago

Blocks #66.

Daniel-Mietchen commented 7 years ago

That commit looks good to me in terms of addressing at least #63 but also likely #62.