We would like to have the feature of file captions, part of StructuredDataOnCommons, implemented in Pywikibot in order to use Pywikibot for mass uploads.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[FEAT] Minimal working example for Structured data on Commons | pywikibot/core | master | +144 -24 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Declined | Keegan | T180139 [Story] Support community/volunteer tools around Structured Commons | |||
Declined | Keegan | T180197 [Epic] Support needed changes to volunteer tools for Wikimedia Commons and Wikidata that will benefit from operating with structured data on Commons | |||
Open | Feature | None | T223820 Properly implement structured data access on Commons in Pywikibot | ||
Resolved | matej_suchanek | T213904 Implement file captions in Pywikibot | |||
Resolved | matej_suchanek | T233406 Refactor Wikibase entities | |||
Resolved | matej_suchanek | T245809 Make Wikibase entities load and initialize lazily | |||
Open | None | T247238 Move wikibase stuff to a separate file/module |
Event Timeline
Currently we can retrieve caption entries only but not write it. I think this doesn't help for T203010 currently. Seems we have to wait for further api implementations.
Correct me if I’m wrong, but I believe that you can already write captions using wbsetlabel − although, as I understand it, would be an additional API call using the media ID (which is derived from the page_id, which I presume also needs to be retrieved post-upload via an API call).
(Poking @Addshore to correct me if I’m wrong above.)
(In case this can be useful for inspiration: the implementation in UploadWizard was tracked in T188502 and the bulk of it done in feee3d4f819d.)
Change 627243 had a related patch set uploaded (by Matěj Suchánek; owner: Matěj Suchánek):
[pywikibot/core@master] [FEAT] Minimal working example for Structured data on Commons
Change 627243 merged by jenkins-bot:
[pywikibot/core@master] [FEAT] Minimal working example for Structured data on Commons
import pywikibot file_repo = pywikibot.Site('commons', 'commons') file_page = pywikibot.FilePage(file_repo, 'Würfelzucker_--_2018_--_3564.jpg') file_item = file_page.data_item() caption = file_item.labels['en'] # 'Sugar cubes (2018)'