CDrummond / cantata

Qt5 Graphical MPD Client
GNU General Public License v3.0
1.04k stars 184 forks source link

CUE files: tracks can't be added to playlists #902

Closed pagiraud closed 7 years ago

pagiraud commented 7 years ago

Playing a little with the cue file I created for my previous report, I noticed tracks from cue files can't be added to playlists (not the current playlist, but saved ones). I don't think this is due to a limitation of cue files, since you can add tracks from cue files the exact same way as other tracks in current playlist. But, if it is technically not doable (or if you don't want to add this possibility for now), maybe a short message to inform the user would be good.

Detailed current behaviour :

CDrummond commented 7 years ago

If you load the CUE tracks onto the playqueue, can you then save that as a playlist? If so, what is the contents? (i.e. the contents of the file saved by MPD - not displayed in Cantata)

pagiraud commented 7 years ago

I loaded the CUE tracks I attached in another issue onto the playqueue, then saved it as a playlist using Ctrl+s. Here is the content of the m3u file it produced (located in ~/.local/share/cantata/mpd/playlists) : _Spatter/The Spatter - 1 - River bridge.mp3 _Spatter/The Spatter - 1 - River bridge.mp3 _Spatter/The Spatter - 1 - River bridge.mp3 _Spatter/The Spatter - 1 - River bridge.mp3

So, as you can see every track becomes the whole file. I manually modified the file so that it looks like : cue:///_Spatter/The Spatter - 1 - River bridge.cue?pos=0 cue:///_Spatter/The Spatter - 1 - River bridge.cue?pos=1 cue:///_Spatter/The Spatter - 1 - River bridge.cue?pos=2 cue:///_Spatter/The Spatter - 1 - River bridge.cue?pos=3

Playlist loads and can be played this way. These are simply the file names you can see in the library view when hovering over a CUE track. Doing so, in the Playlist view, there is neither album, artist nor duration information, but when the playlist is loaded in playqueue everything appears (see screenshot). screenshot_20161027_160959

I tried to circumvent this by adding #EXTM3U at the beginning of the file and some #EXTINF before each track but it doesn't change anything. So I was wondering, can Cantata use MPD extm3u? And if not, should I open a new bug?

CDrummond commented 7 years ago

Cantata does not read MPDs playlists. Whilst it could for local MPD connections (as it does for CUE files), this would not work for remote MPDs. I have no intention of implementing a playlist parser - just not worth the hassle.

Cantata gets its playlist listings from MPD - by asking it to list the playlist. MPD responds with a list of songs. (e.g. Cantata says "give me list of all playlists", then for each it asks "give me track listing for playlist X")

The cue://?pos= URL is Cantata specific, and it is used so that when you add a separated CUE track to MPD it knows to tell MPD that it is from A CUE and which track of the CUE to add. When MPD adds it to the playqueue, the position part then seems to be missing in its response. MPD itself will not understand these URLs - and Cantata parses them before sending to MPD - therefore, they cannot be used in m3u files.

Saving the playqueue to a playlist is all performed by MPD - Cantata simply asks MPD to save the playqueue as a certain name. You cansee from your listing of this playlist above, that it only contains the source files. This would appear to be a bug in MPD. As in, if you then add this playlist to the playqueue - the whole CUE file is added for each 'track' (e.g. CUE file has 5 tracks, you save this as a plylist. Clear play queue. Add playlist to playqueue - now the source file (x.flac, x.mp3) is added 5 times)

So, seeing as MPD appears to not save the cue track position in the playlists, it would be logical to assume that you cannot save splitted CUE tracks to a playlist. Therefore, the only real thing I can do is add an error message to inform the user of this.

pagiraud commented 7 years ago

Thank you very much for this technical insight. It's sometimes quite hard to know what depends on the client and what depends on the MPD server! I totally agree with your conclusion.