-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design APIs #4
Comments
Currently
Preferably they should be orthogonal. |
Just to clarify, current output is XHTML and lyrics.wikia.com uses XML? Would explain why am getting the middle finger from a plugin that used lyrics.wikia.com when trying to make it work with lyrics-api
I guess if I wanted to use it in the current state with XHTML only I'd have to somehow clean up the HTML crust to just have the XML file? Looks like I should be using something like Tidy before processing it on the HTML. So yeah, I practically answered my own questions as I wrote this comment, but if I got something wrong, please do correct me. EDIT: Looks like Tidy is used to clean up non-compliant XHTML, which this project hopefully isn't, but I still can't figure out how to feed XHTML to the parser >.> |
To be precise, Can you please experiment with the used reader (by editing the document and trying to parse it), maybe get more error information out of it? |
It seems to work if I plop it into a file.xml and load the file instead of the URL with an identical file. Think I should be using DomParser instead of TextReader somehow but I either suck at googling this or the info is sparse. |
If an XML reader retrieves the file on its own, maybe it expects the |
I tried the headers hack but that wasn't it. I'll keep trying for a bit but I guess in the end I'll just wait till there's XML support in lyrics-api |
I nailed it down to HTTP vs HTTPS. Works:
Doesn't:
I'll discuss this on xmlpp mailing list I guess. |
I just pushed a commit adding |
Since FTS was replaced with exact matching on preprocessed text (and likely aliases in the future), we won't need the first group of parameters (controlling how to match, since it's more straightforward now). As for the third group, the output can mostly depend on query results (a listing when there are multiple matches, "no results" when there's none, showing lyrics when there's one), but probably we'll still need a parameter to request returning 404 if nothing is found, as described in #5. Maybe it should also limit query results to a single one, or return an error if there are multiple ones. Not sure yet. I'm going to check how other lyrics search APIs work, maybe that'd give a clearer idea: some common parameters can be identified and then reused to mimic those APIs, as well as to use for regular queries. |
Some websites/APIs return 404, some serve regular documents with "not found" messages in place of lyrics or elsewhere. So, to match their output, we'll need 2 parameters: a stylesheet/template to use, and whether to return 404 if nothing is found. While input can be handled with nginx (for instance) rewrites, content types can also be adjusted there when needed. Then we could both mimic other services, and tweak the parameters to alter the regular API behaviour. With tweakable XSLTs it won't be necessary to introduce a parameter governing whether to list matches or to show lyrics. Update: Actually we already have the |
Added the As for output, there are templates to design/write/adjust, including ones for mimicking other services' APIs. |
The |
Regarding RDF embedding: we're focusing on lyrics (and there's mo:Lyrics), and have at least song title, album name, and artist name. Lyrics can be associated with a mo:MusicalWork, a subclass of frbr:Work. Seems to be distinct from mo:Track, which is used by both MO's XSPF RDFizer and xiph's/XSPF's XSPF.xsl, which encode similar data, except for lyrics. They also employ FOAF, which has some generic properties and can indeed easily be attached/used, though they use strings (names) in place of foaf:Agent. It doesn't seem right, even though gets used that way from time to time. By the way, MO examples use MusicBrainz to link the artists, but MusicBrainz only embeds some metadata in I think we'll need to properly attach artist/album/song names to lyrics, possibly in different ways (using different ontologies/relations, that is), and perhaps will have to introduce separate artist and album IRIs that would be consistent across lyrics pages/search results (so, not just Perhaps better to focus on other interfaces for now, since it's tricky and not immediately useful. |
Managed to mimic lyrics.wikia.com for Clementine with it, it's pretty easy. Maybe will prepare such XSLTs for a few more websites, and push them along with nginx configs, but mimicking other services' interfaces can be counted as ready. Going to add a textual interface next, and then we could bikeshed XML and XHTML structures, add some light styling to the web interface, etc. |
|
Basic search is implemented now, but we need stable and specified APIs (DB schema, HTTP requests + {XML/XHTML, RDF, text} ones).
This issue continues Lyrics/lyrics.github.io#15.
The text was updated successfully, but these errors were encountered: