dangodai / soundcloud-m3u

A command line tool to generate .m3u playlists pointing to Soundcloud streams
GNU General Public License v3.0
17 stars 1 forks source link

Bandcamp url duplicates `https` #4

Open ercdude opened 5 years ago

ercdude commented 5 years ago

Hello dude.

First of all, thanks for this, it works like a glove for me :D But I had to make some hand-work to be perfect.

Running this:

/soundcloud-m3u -u http://thewrongobject.bandcamp.com/album/as-real-as-thinking

it generates urls like this:

https:https://t4.bcbits.com/stream/bdfac73863adc8499aa982284cf17009/mp3-128/3080095850?p=0&ts=1569496761&t=53fc6f0023d687e3dfc941da3d5ecef50bba6923&token=1569496761_eb3244d5d392693a71313d70e6c7e5a6ef8b2240

I couldn't have the opportunity to check what's wrong yet, sorry :( but I think you should know. Removing the extras https it works just fine:

# remove extras https from .m3u
mpv as-real-as-thinking-by-machine-mass-trio.m3u
ercdude commented 5 years ago

Just took a quick look into the code and removing the "https:" + from line 121 works just fine, but I don't know the impact on the other links

    for i, _ := range streams {
        //convert duration to int
        duration, err := strconv.ParseFloat(durations[i][1], 64)
        if err != nil {
            duration = 0
        }

//      stream := "https:" + streams[i][1]
                stream := streams[i][1]

        track := Track{Title: titles[i][1], Stream: stream, Duration: int(duration)}
        tracks = append(tracks, track)
    }