Page MenuHomePhabricator

Generic file title generator for Single Image Batch Upload
Open, LowPublic


When uploading files with T138464: glam2commons (previously Single Image Batch Upload): Write and deploy initial and usable version a uniform way of naming files will be used per metadata-mapping. There are some standard operations which have to be performed to create a good title. Therefore it will be useful to have a title generator.
Ideally the title generator has a default order and some default operations, but it is possible to deviate from the default.

The following elements can be used in a file title:

  • File identifier: the identifier the glam uses for this picture/object (this is useful to ensure unique titles)
  • GLAM name: the name from the institution
  • Collection: Sometimes it might be useful to specify in the file title in which collection the file falls. Either the metadata-mapping is for a single collection (then GLAM name could be used and an additional Collection is not needed), it is however also possible that a mapping is made for multiple collections at once.
  • file name/title: These are not always provided, therefore a good default would be to use the title if available and otherwise the file description
  • file descriptions: A file description can be very lengthy, therefore it is a good idea to set a limit on the length of the description. Something to crop descriptions at the last whitespace before X characters would be ideal.

I believe a good order is: title OR description - optionally collection - GLAM - ID . EXTENSION

Also try to test whether the title does not contain forbidden characters.
Allowing to specify the ordering of the title if from a metadata mapping we'd like to use something different from the default would be ideal.

Event Timeline

Basvb created this task.Mar 24 2017, 7:49 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 24 2017, 7:49 PM
djff added a subscriber: djff.Mar 27 2017, 1:38 PM

Hello @Basvb, How do I claim this task?

djff claimed this task.Mar 27 2017, 6:48 PM
Basvb moved this task from Backlog to In Progress on the glam2commons board.Mar 28 2017, 2:19 PM
djff added a subscriber: tom29739.EditedMar 28 2017, 9:57 PM

Hello @Basvb, so I got freed from extra activities and decided to take a closer look at this project. So I have some understanding of the project and have attempted to do the above micro-task (not completely though).
So I used the sample single_image_batch_upload which you provided. So I did install pywikibot and did some minor modifications to the code. Working on this make me come up with some questions which will help me making this task smooth and broaden my understanding of the project.

So I uploaded some images to my own Commons page using the UploadRobot() from pywikibot and modified your NationalArchieve script to create a sample flask app with it. I also created a sample title generator class. (the whole code isn't pretty yet as I am still having some minor worries.

Some worries I am facing

  • I am a little bit confused with the use of ID and file identifier. (the former being used in the main project description).
  • Please I wish to have a guide to selecting GLAMS and how do I determine them as relevant.
  • This is a link to the work I did today ( and I hope to implement upload on one other GLAM by tomorrow to clarify all my doubts.
  • Any other help or comment is highly appreciated.


hello @tom29739 , I want to also look at Wikimedia's OAuth. Will be greatful if I could have some guide on this. Thanks

I know I am a little bit late on this but, I hope to complete my proposal by thursday 30th

Basvb moved this task from In Progress to Review on the glam2commons board.May 8 2017, 9:58 AM