Page MenuHomePhabricator

Step 6: Review file naming convention / pass username to upload2commons
Closed, ResolvedPublic

Description

Important: upload_batches/helpers/upload2commons.py currently doesn't seems to have access to the recordist name (the username of the wikimedian using LL) . The current code wrongly use the locutor everywhere (the person who speak). This file itself gets its data via from upload_batches.models import Recording, but also some other data via get_commons_session_and_csrf_token or get_oauth_login_token. (visualising the data returned there would be a good idea !)

The key challenge is to find a way to get the wikimedian users's name or userId or centralids.CentralAuth, either as a Django/API/db approach to also pass down the recordist name, or maybe via Wikimedia Commons API call (example - API ).

I also encourage to discuss with Pushkar the best approach to fix that.

Current

LL-Q150-Yug-Orange.wav
LL-{qid}-{locutor}-{item}.wav

Note, in upload_batches/helpers/upload2commons.py, the following is incorrect :

# recordlist                                                                             # <------ should be `recordist`
claims.append(
    {
        "mainsnak": {
            "snaktype": "somevalue",
            "property": "P10893",
        },  # performer                                                               # <------- no. Replace by `wikimedian username`
        "type": "statement",
        "rank": "normal",
        "qualifiers": {
            "P4174": [snak_string("P4174", recording.batch.locutor.name)]                      # <------- no. Replace by the recordist name
        },
    }
)

Wanted

Review file naming convention, restore :

  • LL-Q150 (fra)-Fabricio Cardenas (Culex)-ablueront.wav
  • LL-{qid} ({iso639_3})-{locutor.name} ({username})-{item}.{ext} (with two conditionals, see below)

In ReviewStep.js :

js
import { languagesByQids } from '../data/languages-by-qids'
// ...
    const contributedBy = store.selectedLocutorId === locutors[0].name ? store.selectedLocutorId: ` ${store.selectedLocutorId} (${locutors[0].name})`;
    const iso639_3 = languagesByQids[store.selectedLanguageId].iso639_3 || 'mis';
    const filename = `LL-${store.selectedLanguageId} (${iso639_3}) ${contributedBy}-${wordItem.displayAs}.${isVideoRecording ? 'webm' : 'wav'}`

In batch data/model, please add the recordist (wikimedia username) :

js
My upload batch #38

{
  "id": 38,
  "recordings_count": 1,
  "status": {
    "uploaded": 1
  },
  "language_qid": "Q150",
  "created_time": "2025-07-17T11:09:01.221121Z",
  "started_time": null,
  "finished_time": null,
  "recording_type": "Q108167708",
  "locutor": 4,  // <--- this would be my grand ma, she doesn't have a wikimedia account
  "recordist_name": "Yug"   // <--- ADD THIS : this is the wikimedian username
}

And then in upload2commons.py we can have:

FILE_NAME = (
    "LL-"
    + recording.batch.language_qid
    + "_("+iso639_3 + ")"
    + recording.batch.locutor.name if recording.batch.locutor.name == recording.batch.recordist_name else recording.batch.locutor.name +" ("+recording.batch.recordist_name+")"
    + "-"+ recording.transcription
    + (".wav" if recording.batch.recording_type == "Q108167708" else ".webm")
)

Files

Need to pass both 1. locutor and 2. uploader's wikimedia username (aka recordist) (locutors[0].name) to batch (ask Yug) then to FILE_NAME.

  • src/views/ReviewStep.vue : L319, L393
  • upload_batches/helpers/upload2commons.py
    • from upload_batches.models import Recording
    • FILENAME
  • batches data (example for yug : #38) doesn't have the wikimedian's username (aka recordist) !
    • /upload_batches/migrations/0001_initial.py
    • /upload_batches/models.py

Note

Please update UML files:

  • /doc/diagrams/db_full.plantuml
  • /doc/openapi.yaml

Event Timeline

Yug updated the task description. (Show Details)
Yug updated the task description. (Show Details)
Yug updated the task description. (Show Details)
Yug renamed this task from Step 6: Review file naming convention to Step 6: Review file naming convention / pass username to batch.Oct 8 2025, 7:42 PM
Yug renamed this task from Step 6: Review file naming convention / pass username to batch to Step 6: Review file naming convention / pass username to upload2commons.
Yug claimed this task.

Screenshot from 2025-10-09 12-43-58.png (230×1 px, 178 KB)

✅ Done, works. See MR#*7 🎉