FCR001 / cantata

Automatically exported from code.google.com/p/cantata
GNU General Public License v3.0
0 stars 0 forks source link

[Enhancement] File input plugin support for MPD 0.19 #574

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be very helpful to add a local file in play-queue for MPD 0.19 e.g. 
mpc add file:///...

http://www.musicpd.org/doc/user/input_plugins.html#idp54084992

Original issue reported on code.google.com by parkm...@gmail.com on 30 Oct 2014 at 7:49

GoogleCodeExporter commented 9 years ago
The change is easy enough to make - and indeed I was just making the changes. 
However, the issue is how to detect that MPD is on the local host? file:// will 
*only* work if you are on the same machine as MPD. Its OK for MPC to use, as 
the user explicitly ads file:// For Cantata, I would need to detect if MPD was 
on the localhost, and use file://, if MPD is not on the localhost then it need 
to use its internal HTTP server.

Also, for media files (e.g.mounted USB sticks) MPD would not be able to access 
the file.

Original comment by craig.p....@gmail.com on 30 Oct 2014 at 8:29

GoogleCodeExporter commented 9 years ago
Thanks for your kind explanation and and now I know.

Original comment by parkm...@gmail.com on 30 Oct 2014 at 8:33

GoogleCodeExporter commented 9 years ago
Actually, can you update trunk? I've now inplemented this if MPD>=0.19, MPD 
supports 'file' URL handler (you can see this in the Server information 
dialog), and you are connected using address 127.0.0.1

Original comment by craig.p....@gmail.com on 30 Oct 2014 at 8:40

GoogleCodeExporter commented 9 years ago
I am using MPD 0.19.1 and cannot see the file URL handler yet in 5611

Original comment by parkm...@gmail.com on 30 Oct 2014 at 8:59

GoogleCodeExporter commented 9 years ago
Hmm... Try editing mpd/mpdconnection.cpp and change from about line 309 from:

-----------------8<-----------------
bool MPDConnection::localFilePlaybackSupported() const
{
    return details.isLocal() ||
           (ver>=CANTATA_MAKE_VERSION(0, 19, 0) && handlers.contains(QLatin1String("file")) &&
           details.hostname==QLatin1String("127.0.0.1"));
}
-----------------8<-----------------

to:

-----------------8<-----------------
bool MPDConnection::localFilePlaybackSupported() const
{
    return details.isLocal() ||
           (ver>=CANTATA_MAKE_VERSION(0, 19, 0) && details.hostname==QLatin1String("127.0.0.1"));
}
-----------------8<-----------------

Original comment by craig.p....@gmail.com on 30 Oct 2014 at 9:24

GoogleCodeExporter commented 9 years ago
Actually, just update trunk - I have committed the change above.

Original comment by craig.p....@gmail.com on 30 Oct 2014 at 3:09

GoogleCodeExporter commented 9 years ago
Still no file URL handler and what to check?

Original comment by parkm...@gmail.com on 31 Oct 2014 at 12:17

GoogleCodeExporter commented 9 years ago
$ mpd -V
Music Player Daemon 0.19.1

Copyright (C) 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright (C) 2008-2014 Max Kellermann <max@duempel.org>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy

Storage plugins:
 local

Decoders plugins:
 [mpg123] mp3
 [oggflac] ogg oga
 [flac] flac
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [dsdiff] dff
 [dsf] dsf
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve
 [pcm]

Output plugins:
 null alsa

Input plugins:
 file alsa curl ffmpeg

Playlist plugins:
 extm3u m3u pls cue embcue

Protocols:
 http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// alsa://

Original comment by parkm...@gmail.com on 31 Oct 2014 at 12:53

GoogleCodeExporter commented 9 years ago
Umm.. as I said, it no longer checks for 'file://' protocol. Did you actually 
try the updated code?

Original comment by craig.p....@gmail.com on 31 Oct 2014 at 8:44

GoogleCodeExporter commented 9 years ago
Yes, I tried but 'invalid protocol error' with 127.0.0.1 host

Original comment by parkm...@gmail.com on 31 Oct 2014 at 10:14

GoogleCodeExporter commented 9 years ago
Hmmm... please run Cantata from the commandline as follows:

CANTATA_DEBUG=513 cantata

This will log MPD communications, and stream fetching (the only place I can see 
'Invalid protocol' in the code) to  ~/.cache/cantata/cantata.log

Recreate the issue, and place a link to this log file here.

Original comment by craig.p....@gmail.com on 1 Nov 2014 at 2:58

GoogleCodeExporter commented 9 years ago
parkmino@ubuntu:~$ cat ~/.cache/cantata/cantata.log
------------START------------
2014-11-02 18:46:05 - MPDConnection 2890865472 setDetails "127.0.0.1" 6600 
false 
2014-11-02 18:46:05 - MPDConnection 2890865472 disconnectFromMPD 
2014-11-02 18:46:05 - MPDConnection 2890865472 call connectToMPD 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Connecting (std) 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 established 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "OK MPD 0.19.0
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Received 
identification string 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Connecting (idle) 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 established 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Read: "OK MPD 0.19.0
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Received 
identification string 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Read: "OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 remote dynamic is not supported 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054d8 Enabling idle 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: "status" 
true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "volume: -1
repeat: 0
random: 0
single: 0
consume: 0
playlist: 2
playlistlength: 0
mixrampdb: 0.000000
state: stop
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: "stats" 
true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "uptime: 1055
playtime: 0
artists: 106
albums: 87
songs: 268
db_playtime: 84886
db_update: 1414733772
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"urlhandlers" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "handler: http://
handler: https://
handler: gopher://
handler: rtp://
handler: rtsp://
handler: rtmp://
handler: rtmpt://
handler: rtmps://
handler: alsa://
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 QSet("https", "rtmp", "http", 
"rtp", "rtmps", "rtmpt", "alsa", "gopher", "rtsp") 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"tagtypes" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "tagtype: Artist
tagtype: ArtistSort
tagtype: Album
tagtype: AlbumSort
tagtype: AlbumArtist
tagty... ...: MUSICBRAINZ_ALBUMARTISTID
tagtype: MUSICBRAINZ_TRACKID
tagtype: MUSICBRAINZ_RELEASETRACKID
OK
 (402 bytes)" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"currentsong" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"listplaylists" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "playlist: 
[Radio Streams]
Last-Modified: 2014-10-20T01:43:24Z
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"playlistinfo" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: "status" 
true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "volume: -1
repeat: 0
random: 0
single: 0
consume: 0
playlist: 2
playlistlength: 0
mixrampdb: 0.000000
state: stop
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: "outputs" 
true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "outputid: 0
outputname: My ALSA Device
outputenabled: 1
OK
" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand: 
"listplaylistinfo "[Radio Streams]"" true true 
2014-11-02 18:46:05 - MPDConnection 2890865472 Timeout (ms): 2000 
2014-11-02 18:46:05 - MPDConnection 2890865472 Socket state after write: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Waiting for read data, 
attempt 0 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 Read: "file: 
http://50.7.173.162:8010/#Audiophile Baroque
file: http://50.7.173.162:8012/#Audiophile Cl... .../37.130.228.60:8090/#Naim 
Radio
file: 
http://radio.podbbang.com/kukmintv.mp3#국민라ë�
�””오
OK
 (349 bytes)" , socket state: 3 
2014-11-02 18:46:05 - MPDConnection 2890865472 0xa2054c8 sendCommand - sent 

Original comment by parkm...@gmail.com on 2 Nov 2014 at 9:47

GoogleCodeExporter commented 9 years ago
Did you set CANTATA_DEBUG to 513? Did you attempt to add a non-MPD file? As I 
see no add command above.

Does "mpc add file:///...." work for you?

Original comment by craig.p....@gmail.com on 2 Nov 2014 at 12:17

GoogleCodeExporter commented 9 years ago
I followed your instruction and Cantata shows "ERROR : Invalid Protocol" when 
entering file://.
mpc works fine.

Original comment by parkm...@gmail.com on 2 Nov 2014 at 12:25

GoogleCodeExporter commented 9 years ago
You are using the arr URL dialog? If so, this is intended to add streams - not 
files. For files, just drag them onto the playqueue...

Original comment by craig.p....@gmail.com on 2 Nov 2014 at 12:38

GoogleCodeExporter commented 9 years ago
Oops "arr dialog" was meant to be "Add Stream URL" dialog

Original comment by craig.p....@gmail.com on 2 Nov 2014 at 12:40

GoogleCodeExporter commented 9 years ago
Sorry for my bad and it works flawlessly.
It is a wonderful feature and happily close this issue!

Original comment by parkm...@gmail.com on 2 Nov 2014 at 12:42

GoogleCodeExporter commented 9 years ago
OK, no probs.

Original comment by craig.p....@gmail.com on 2 Nov 2014 at 12:47