xi / xspf2m3u

simple XSPF to M3U conversion
3 stars 1 forks source link

"extended m3u" support #1

Open sosie-js opened 1 year ago

sosie-js commented 1 year ago

Hello the output is just the list of the files, it is in fact not in the m3u format which is more complicated

With a xspf like:

<?xml version="1.0" encoding="UTF-8"?>
<playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1">
    <title>Playlist</title>
    <trackList>
        <track>
            <location>https://www.youmaker.com/v/2GJoyNg88o76</location>
            <title>China Light Parade in Strasbourg during the 2022 Christmas Market</title>
            <creator>sos-productions.com</creator>
            <info>http://media.sos-productions.com/20221210-parade-of-the-light-of-china-strasbourg/</info>
            <image>https://i0.wp.com/media.sos-productions.com/wp-content/uploads/2022/10/SoS-20221102-Poster-parade-Stras_A3-V5_en-scaled.jpg</image>
            <duration>686000</duration>
            <extension application="http://www.videolan.org/vlc/playlist/0">
                <vlc:id>0</vlc:id>
            </extension>
        </track>
    </trackList>
    <extension application="http://www.videolan.org/vlc/playlist/0">
        <vlc:item tid="0"/>
    </extension>
</playlist>

after setting /usr/bin/python3 in to of the xspf2m3u.py to avoid confusion with python2.x,

it should return instead of simply https://www.youmaker.com/v/2GJoyNg88o76 this:

#EXTM3U
#EXTINF:686,China Light Parade in Strasbourg during the 2022 Christmas Market,logo=https://i0.wp.com/media.sos-productions.com/wp-content/uploads/2022/10/SoS-20221102-Poster-parade-Stras_A3-V5_en-scaled.jpg
https://www.youmaker.com/v/2GJoyNg88o76
xi commented 1 year ago

As far as I understand, what you want is "extended m3u" (see https://en.wikipedia.org/wiki/M3u#Extended_M3U). I would be open to accepting a pull request for that as extended m3u is backwards compatible, as long as the required complexity is manageable.

sosie-js commented 1 year ago

Thanks for this answer and proposal Xi. In fact I was based on the kodi m3u output or vlc output which are, i ignored, then Extended m3u as you mentioned. I moreover want to have the logo facility I found only in the xspf format with vlc, that is why I wondered if m3u did not includes it finding a converter xspsf to m3u. I fall on your converter from the kodi forum. I have seen also that recently the format m3u8 has been added but it is for the next kodi release, I do not manage to make the difference between m3u extended and m3u8 now...except unicode support.

When I look at the rfc, EXT INF should normally provide the duration in seconds so I fixed it. I append the logo after to point the image.

sosie-js commented 1 year ago

Have a look to https://github.com/xi/xspf2m3u/pull/2

sosie-js commented 1 year ago

Bunny is back https://github.com/xi/xspf2m3u/pull/3