You are here: Home » Topic » FireSpiff – Export XML playlist (XSPF)

FireSpiff – Export XML playlist (XSPF)

This topic contains 15 replies, has 5 voices, and was last updated by  blamm 7 years, 10 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #2014

    blamm
    Participant

    Hi

    Have started playing with XSL to see if I can transform the XML output from RSP to XSPF. Using [url]server:port/rsp/db/[/url] and having some success but the call appears to be getting stuck on comments fields that are too long. Can I restrict the RCP call so that it doesn’t look at comments?

    Ta

    #15060

    sonichouse
    Participant

    The wiki details how to restrict fields returned.

    http://wiki.mt-daapd.org/wiki/XML_Client_API

    Best of luck

    #15061

    blamm
    Participant

    @sonichouse wrote:

    The wiki details how to restrict fields returned.

    http://wiki.mt-daapd.org/wiki/XML_Client_API

    Best of luck

    Thanks. I’m actually looking for RSP stuff. The Wiki only seems to cover DAAP which is much slower.

    #15062

    rpedde
    Participant

    @blamm wrote:

    @sonichouse wrote:

    The wiki details how to restrict fields returned.

    http://wiki.mt-daapd.org/wiki/XML_Client_API

    Best of luck

    Thanks. I’m actually looking for RSP stuff. The Wiki only seems to cover DAAP which is much slower.

    Okay, I’ve just fixed up the wiki so people can log in with their forum username/password. Hopefully that will stop the spammers.

    And I’ve sent you the rsp docs via the email address you registered with. If that’s not the right one, mail me at [email protected].

    — Ron

    #15063

    blamm
    Participant

    Hi.

    I have managed to get this working with a bit of XSL and PHP on my local WAMP server to transform the results of an RSP query on playlist 1. I know very little about coding so this is a real lashup (which you can probably tell from my code) so feel free to try and ask questions however I may not be able to provide much support. In fact any suggestions or improvements would be very welcome.

    The XSPF works in both VLC and Foobar2000 (with the foo_xspf component). Unfortunately Foo doesnt seem to like playing streamed wavs from Firefly which is a bit of a limitation for those of use who stuff that Firefly has to transcode. VLC works fine but has limited navigation.

    Put the following in an file called “rsp2xspf.xsl”. You will need to replace the Firefly server address and port.









    http://192.168.2.10:3689/rsp/stream/









    Put this in a file called “playlist.php”. You will need to change the port.

    <?php
    header('Content-type: application/xspf+xml');
    header('Content-Disposition: attachment; filename="playlist.xspf"');
    $dom = new domDocument();
    $dom->load("rsp2xspf.xsl");
    $proc = new xsltprocessor;
    $xsl = $proc->importStylesheet($dom);

    $document = new DomDocument();
    $document->load("http://localhost:3689/rsp/db/1?type=browse");
    print $proc->transformToXml($document);
    ?>

    Put both files in a folder on your web server.

    Run the php file from your browser. It should churn for a few mins then ask you to download an XSPF. Open the XSPF in VLC or Foobar2000 and play away.

    Its not fast but seems to work.

    #15064

    EVILRipper
    Participant

    Just an idea..

    You could use my DaapPlaylistGenerator which can generate a XSPF playlist too, but runs client-side. It requests all songs in DAAP (xdmap-tagged) format, which is more efficient than XSPF/RSP. Especially with lots of songs this makes a big difference in download size.
    Of course, this “download size” only matters when attempting to run remote. Local shouldn’t really matter.

    Next to that, I really encourage you to further experiment with this, to possibly create a better product. Also, you will learn alot from it. πŸ™‚

    [edit]
    Errr.. I read on the XSPF site there coulnd’t be any spaces in it. It should display %20 instead of a space. This really screws up in VLC Media Player. I will remove this soon, as the playlist seems valid with spaces.
    [/edit]

    #15065

    blamm
    Participant

    Thanks. I just tried it and it crashes.

    The MS error report signature says

    AppName: daapplaylistgenerator.exe AppVer: 1.0.0.1 ModName: msvcr80.dll
    ModVer: 8.0.50727.762 Offset: 00008a8c

    I can send you more if you want it.

    #15066

    EVILRipper
    Participant

    @blamm wrote:

    Thanks. I just tried it and it crashes.

    I can send you more if you want it.

    Problem with this program is, is that the crash details have no use at all. I can not trace anywhere in the application where it happened, or what caused it, from the details windows gives you.

    Maybe I could add some background debugging output to at least have any idea what’s going on. Possibly this will be available in a new version; Will let you know!

    #15067

    blamm
    Participant

    @evilripper wrote:

    It requests all songs in DAAP (xdmap-tagged) format,

    How would I do that?

    #15068

    EVILRipper
    Participant

    @blamm wrote:

    How would I do that?

    Quite simple.
    You have seen this link: http://wiki.mt-daapd.org/wiki/XML_Client_API
    Well, all those URL’s have a “?output=XML” at the end.
    Take it off. πŸ™‚ You will get some unreadable bunch of data.

    The unofficial documentation I found: http://www.tapjam.net/daap/
    This explains how it works.

    Explained in short:
    The whole output is in tags.
    The first 4 bytes defines what it is going to send.
    Example: msrv; This is the response to server-info
    The next 4 bytes is the size of the content of msrv.
    Next, is the content of the server-info, in x bytes, determined by the second 4 bytes.

    This is by far the most efficient way firefly supports to send data, because all tags are a max of 8 bytes (4 for identifier, 4 for size).

    This was the method used to receive info before firefly was developed, when it was still mt-daapd.
    (Please correct me if I’m wrong)

    Decoding this xdmap-tagged data is quite a challenge, but if you write some effective functions, it’s a piece of cake.

    If you want to see it for yourself, try running the following url, and downloading the whole page into a file. Next open it with any Hex Editor. (I use Notepad++) It should contain the data format I just explained. All the other tags can be referred to from the unofficial documentation.

    http://:3689/server-info

    Happy coding. πŸ™‚

    #15069

    rpedde
    Participant

    @evilripper wrote:

    This is by far the most efficient way firefly supports to send data, because all tags are a max of 8 bytes (4 for identifier, 4 for size).

    Actually, I think rsp is both faster and smaller than raw daap. Faster because it doesn’t have to know the size of the external container atom before it starts streaming it, so it only has to make one pass through the db, and smaller because it’s a non-persistent connection and can do gzip encoding.

    I’m thinking of redoing all the daap stuff to use memory mapped files, and that might make it possible to speed the daap up quite a bit, though.

    Just a thought…

    — Ron

    #15070

    blamm
    Participant

    OK.

    Here is a better version. It lists your playlists and allows you to choose the one to download as XSPF. Unzip the attached into your webserver root and open “index.php” from your browser. It assumes Firefly uses port 3689, if it does not you can edit the PHP files (should be pretty obvious where). For a more Firefly look copy the firefly css to the same folder.

    Once again I make no apologies for my coding skills. It has been cobbled together from examples on the web.

    http://myweb.tiscali.co.uk/toaster/FireSpiff.zip

    I will have a go at EXTM3U if anyone is interested.

    Test away!

    #15071

    blamm
    Participant

    Ron.

    Any chance you can change the header of this topic to “FireSpiff – Export XML playlist (XSPF)” please?

    Thanks

    #15072

    sonichouse
    Participant

    @blamm wrote:

    Any chance you can change the header of this topic to “FireSpiff – Export XML playlist (XSPF)” please?

    You can do this by editing the title in your first post of this topic.

    /Steve

    #15073

    Anonymous

    Hi,
    I used your code to have an automatically generated playlist in my www root. Like this one can point from another streaming client (VLC for example) to this URL.
    I modified the firefly startup script, that it generates a new playlist (XSPF) every time firefly starts. For sure this can be much more fine tuned, but it works…

    Thank you for the script & xsl
    kind regards
    meikel

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.