Unconventional and overkilled use of Wikidata: get a machine-readable list of Touhou games that maps release numbers to titles, for canonicalizing album metadata fields. In hindsight, my script was bloated and unnecessary. The whole thing could just be a simple SPARQL query.

Here it is. A refactored and proper #SPARQL query to #Wikidata for getting a machine-readable list of Touhou games that maps release numbers to titles, without the bloated and inefficient Python code in the last post. Runs in milliseconds instead of half a minute. Interactive query at https://query-main.wikidata.org

SELECT ?game ?thRelease ?titleJa ?titleEn ?titleZh ?titleZhHans WHERE { wd:Q907907 p:P527 [ ps:P527 ?game ; pq:P1545 ?thReleaseValue ] . BIND(CONCAT("TH", ?thReleaseValue) as ?thRelease) OPTIONAL { ?game rdfs:label ?titleJa FILTER(LANG(?titleJa) = "ja") } OPTIONAL { ?game rdfs:label ?titleEn FILTER(LANG(?titleEn) = "en") } OPTIONAL { ?game rdfs:label ?titleZh FILTER(LANG(?titleZh) = "zh") } OPTIONAL { ?game rdfs:label ?titleZhHans FILTER(LANG(?titleZhHans) = "zh-hans") } } ORDER BY xsd:float(?thReleaseValue)

Still working on my machine-readable #Touhou soundtrack database, so I can connect it to my music player in the future to remember soundtracks names that I still can't remember after listening for 10 years... #2hu
An obscure feature of #MediaWiki: common operations have public APIs callable by everyone without an account. For example,expandtemplates evaluates arbitrary wikitext. If the data you're looking for is already inside a template, it means it's a free machine-readable API. Example: Query the Japanese and English titles of the second soundtrack in #Touhou 6 Stage 5.
MediaWiki expandtemplates is super effective, over a thousand #Touhou soundtrack names queried in seconds without any special features on the wiki.
One more step closer to a working #Touhou soundtrack finder in the browser.
My #Touhou soundtrack finder Userscript is working now! ​​ After listening to these soundtracks for 10+ years, I'm finally able to tell the games, characters and locations associated with them (still need to tune the release priority, newer soundtrack versions are currently overrepresented).
Still working on this #Touhou soundtrack attribution Userscript. Now the search starts from the earliest release instead of the random hash table order. It's no longer attributing everything to Touhou 15.5. ​
I finally understand why I keep getting mysterious undefined variable errors in my Userscript - the top-level Userscript and the injected in-page monkey-patch script run in different environments. The correct solution is to pass messages from the page to the top-level Userscript. I now have a fully-functional and super-overkilled #Userscript powered by OOP, npm, and webpack. ​
#Touhou Attribution #Userscript update: (1) Album soundtrack data is preloaded and cached, it's no longer calling one API per track. (2) Switched from Notification() to GreaseMonkey's GM.notification(), so I don't have to approve Notification on a million Bandcamp subdomains. The funny monkey icon is also a plus during development. ​
Here's my latest cursed invention: extract data from #MediaWiki as JSON by constructing it manually using string manipulations and loop functions in Wiki markups, effectively a array.map(lambda var: do_something(var)). Finally one can evaluate the markup input via expandtemplates. It looks like the dirtiest hack, but it allows extremely efficient data query using a single API call, speeding up the query by a factor of 10-100 (this custom Table Mapping extension's API has no support of batching). MediaWiki markup as a general-purpose data query language.
Just enhanced my Wikitext to JSON template, now it queries all mapping tables in all three available languages, it even tries escaping the strings before manually constructing a JSON string. #MediaWiki templates as a general-purpose query language.
The theory of operation of my cursed "Force a #Touhou wiki to dump all soundtrack tables and format them as a JSON string dynamically using a #MediaWiki Wikitext template" code is now public. https://github.com/TouhouOML/TouhouOML/blob/main/docs/thbwiki.md
@niconiconi we have graphql at home
@niconiconi Oh ones on bandcamp I'm not aware of, do you have a list somewhere? IIRC I looked at the touhou tag few times but only found ones I already knew.
@[email protected] Use this 3rd-party bandcamp search engine (source on GitHub), tag "touhou" and "chiptune". Works much better than the official search. https://campexplorer.io/
Camp Explorer

@niconiconi > remember soundtracks names that I still can't remember after listening for 10 years

This kind of thing is why I want to download the lyrics of all the songs I have, that way I can grep to find one I remember it's lyrics, and of course in romaji for languages like japanese.
@[email protected] The OST has no lyrics, I know the rhymes without the slightest clue about the associated game, character, or title... The involvement of multiple languages only confused the matter further. Hopefully the plugin will solve all my problems after its completion.
@niconiconi Yeah, OST doesn't and I guess can't grep sheet music (would be very useful though), but the world of touhou doujin music tends to have lyrics.
@[email protected] @niconiconi you could do some search thing, where you put the intervals between notes of the lead melody as a vector (say like 10 elements long) and do a k-nearest neighbors search on that, should be reasonably ok even from recovered notes from humming or similar

does require extracting the lead melodies tho