Jamendo API - How to get track by track number?
  • I've been having a look at various pages in the wiki about Jamendo's API and tried various things, but wasn't successful so far. I would like to fetch a certain track by its album id and track number (not track id!). The closest I could get so far is this:


    which gives me the complete list, ordered by track id. But I have no idea how to fetch the sixth song ("oh oh oh") from here now for instance.

    Cheers, T_X
  • Yes, I know, that's why I explicitly asked whether a track could be fetched not only by its track id but also by its track number within an album. :)

    I'm currently experimenting with bittorrent webseeding and http redirections, therefore it would be really handy if I could translate a URL like this:


    with the help of just a regular expression to a matching api call, like this one:


    But I guess that's not easily possible, as the original URL does not contain the track id. It would be great if there were an API call like this:


    As I could easily extract the track_no 6 and the album_id 45252 with a regular expression. However, unfortunately I couldn't find a fitting API call parameter for the track number yet.

    I also tried various work-arounds, like:


    etc., but so far nothing of this worked.

  • Oops, overread that!

    You could do it really ugly like
    curl "http://api.jamendo.com/get2/stream/track/plain?streamencoding=ogg2&album_id=45452" | grep "ogg2/06%20-" :D

    What is your actual goal? Be aware that the streaming files are not the "full quality" files.
  • Thanks, but... no, that still doesn't work for me, unfortunately :(.

    What is your actual goal?

    Okay, I'm currently trying to configure an apache2 server here to serve as a webseed for jamendo torrent files. But as there is this cool API, I thought it shouldn't be necessary to store another copy of all the contents of a torrent file, just to match the directory and file name structure needed by the webseed (getright-style) feature.

    Instead the idea was to make one, single apache2 config that responds to any torrent file's webseed queries with an http redirect 307 to the according api calls. [1].

    The advantage would be that I or anyone else could then just run such an apache2 server - and any of these webseed redirectors won't probably need that much bandwidth as the webseed redirectors do not host any actual content.

    As a first step the jamendo staff would then just only need to add a webseed like "http://webseed.jamendo.com" to every torrent file and DNAME records for webseed.jamendo.com for the volunteering webseed redirectors. Later it would be great if jamendo itself were hosting this webseed redirector, of course. However that shouldn't be a minum hassle for the jamendo staff as no lengthy scripts or extra file copies would be needed this way.

    So far I have two apache2 config files:


    And as you can see with these config files I'd have to create one config file for every album on jamendo and lookup the the according track ids with a script. I wish I could make the ogg-file queries more generic, avoiding the need of scripts. But that's where I'd need to be able to fetch a certain track by its track number instead of its track id.

    That does not quite work, as numalbum=6 will return the track with the 6th lowest track id, which unfortunately is track number 7 instead of 6 as the track ids are not necessarily in the same order as the track numbers.

    Be aware that the streaming files are not the "full quality" files.

    Argh, damn it, you're right... just checked track 6 and they hash of the stream and the torrent's one do not match... that's a show stopper...

    And of course, ideally I'd also need an API call to fetch License.txt and Readme.*.txt of an album (the versions added to the latest torrent version). But well, one step after another, I thought. (You might have noticed in jamendo-redir that I was using a copy on my side at the moment without any API calls)

    [1]: transmission seems to be broken for multi file webseeds at the moment, utorrent works fine with the same torrent file though - https://trac.transmissionbt.com/ticket/4437. And utorrent does not seem to be able to handle http redirects yet (and probably transmission either). But according to the folks on Freenode/#bittorrent, a nice torrent client should follow the http redirects.
  • For me the queries work fine. I tried several albums and the numalbum=X always gave me the correct track.

    And ha, I had a similar idea once! Ran into a roadblock quickly though, cannot really remember much about it.

    "Webseeding" (such a terrible term in my opinion) is a nice thing but I think since Jamendo already deprecated torrents in the first place, they should focus on more pressing issues. The benefit of torrents is minor to a site like this unless done very well and with selected promotional actions. The direct MP3 ZIP downloads are fast and work well. If only Ogg Vorbis was offered like that.

    It is a shame that the community-hosted vorbis server people are so quiet. Originally they had planned to seed all the torrents. And I am still waiting for at least a simple http download option.

  • For me the queries work fine. I tried several albums and the numalbum=X always gave me the correct track.

    Urgh, sry, you're right! It works - awesome!

    The apache2 config file looks like this now:

    <Location /jamendo2>
    RedirectMatch 307 \"/jamendo2/([0-9]*)/.* - OGG Vorbis q[0-9] - .*/([0-9]*) - .*\.ogg$\" http://api.jamendo.com/get2/stream/track/redirect/?album_id=$1\&numalbum=$2\&streamencoding=ogg2

    RedirectMatch 307 \"/jamendo2/([0-9]*)/.* - MP3 VBR [0-9]*k - .*/([0-9]*) - .*\.mp3$\" http://api.jamendo.com/get2/stream/track/redirect/?album_id=$1\&numalbum=$2\&streamencoding=mp31

    RedirectMatch 307 \"/jamendo2/([0-9]*)/.*/\[cover\] .*\.jpg$\" http://api.jamendo.com/get2/image/album/redirect/?id=$1\&imagesize=0

    #RedirectMatch 307 \"/jamendo2/([0-9]*)/.*/License\.txt$\" http://api.jamendo.com/get2/license/album/redirect/?id=$1
    RedirectMatch 307 \"/jamendo2/([0-9]*)/.*/License\.txt$\" /jamendo2/$1/License.txt

    #RedirectMatch 307 \"/jamendo2/([0-9]*)/.*/Readme - www\.jamendo\.com \.txt$\" http://api.jamendo.com/get2/readme/album/redirect/?id=$1
    RedirectMatch 307 \"/jamendo2/([0-9]*)/.*/Readme - www\.jamendo\.com \.txt$\" /jamendo2/$1/Readme%20-%20www.jamendo.com%20.txt

    I'll try to contact the Jamendo staff and ask them whether there could be done something about a Licence and a Readme API call, as well as reintroducing streamencoding=mp32 and streamencoding=ogg3 parameters.


    EDIT: I've opened a ticket on getsatisfaction, feel free to sign it, too :): http://getsatisfaction.com/jamendo/topics/new_api_calls_to_allow_easy_torrent_web_seeding
  • It looks like the ways of downloading albums in Ogg Vorbis format describen in this thread do not work any more. Or am I wrong?