Solved Play Audio CD
#1
I have been desperately trying and searching with no luck to try and figure out how to play an Audio CD. I have been using the Player.Open method, and I have been successful in playing a DVD, and both audio and video files on my computer. However, it seems that there is either a bug or some crazy trick you have to use to get an Audio CD to play.

For DVDs, I have been successful when using the following:

{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"dvd:\/\/1"}}}

when I have "file" set to dvd:// it recognizes it as video. If I try to set that to cd or cdda, it does not recognize the media type. Also, as an aside, absolutely nowhere in the documentation have I been able to find "file" as a valid argument for the item object. Where does that come from?

For media files, I have been successful with the following:

{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"file:\/\/C:\/Code Repositories\/video.mp4"}}}

Surely there must be a way to play an Audio CD....Surely XBMC hasn't made that big of an oversight....I hope....
Reply
#2
cdda://<track>
Reply
#3
I appreciate the help. How would that be formatted overall? Something like this?

{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"cdda:\/\/1"}}}
Reply
#4
yup. just pass cdda://1 as the file.

you can do a getdirectory of cdda:// to get a listing of tracks.
Reply
#5
Thanks again. But I'm still having trouble. I am passing this literally:

{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"cdda://1"}}}

This is the response I get:

{"jsonrpc":"2.0","method":"Playlist.OnClear","params":{"data":{"playlistid":0},"sender":"xbmc"}}{"jsonrpc":"2.0","method":"Player.OnStop","params":{"data":{"end":false,"item":{"type":"unknown"}},"sender":"xbmc"}}{"id":789,"jsonrpc":"2.0","result":"OK"}

Nothing is played. Am I missing something else?
Reply
#6
hrm, this should have worked. montellese?
Reply
#7
(2013-09-11, 19:05)chickenwing Wrote: Thanks again. But I'm still having trouble. I am passing this literally:

{"id":789,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"cdda://1"}}}

This is the response I get:

{"jsonrpc":"2.0","method":"Playlist.OnClear","params":{"data":{"playlistid":0},"sender":"xbmc"}}{"jsonrpc":"2.0","method":"Player.OnStop","params":{"data":{"end":false,"item":{"type":"unknown"}},"sender":"xbmc"}}{"id":789,"jsonrpc":"2.0","result":"OK"}

Nothing is played. Am I missing something else?

The first two JSON-RPC blocks you get are notifications and are not really part of the response to your request. You can see that based on the "id" (or that it's missing) in those blocks.
I'm not sure why it doesn't work, I'd have to investigate myself. I'll have to see in which of my moving boxes down in the cellar I put my audio cds ...

Could you enable debug logging, execute your request and post the respective log file here?
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#8
I just gave this a try and the only path that worked was
Code:
cdda://local/01.cdda
and any other number instead of "01" which matched a track on the CD. Those are also the paths returned by a Files.GetDirectory on "cdda://".

I also tried the original request but with the "directory" property instead of the "file" property and using "cdda://" and that one fails in CCDDADirectory::GetDirectory() on
Code:
if (!g_mediaManager.IsDiscInDrive(strPath))
    return false;

EDIT: Good news. The combination of my trying around and cptspiff's idea led me to the right solution:
Code:
{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "directory": "cdda://local/" } }, "id": 1 }
Just "cdda://" didn't work.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#9
Hi Montellese,

Thank you for the very helpful information. This worked for me. As a followup, for an external CD drive - connected via USB, how might I format the command? Would the "local" parameter be replaced with something else? A client of mine is having trouble with Player.Open for CDs in an external player...
Reply
#10
TBH I don't really know how those cdda:// URLs work. I just figured the last one out through trial and error and reading the log files.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#11
Hi,

I have to re-activate this old thread. I'm trying to control Kodi via JSON-RPC. This works mostly very smooth. Now I want to implement support for discs (audio, dvd). After I found this thread I'm able to play an audio CD, but I have no clue how to detect if a CD or DVD is inserted. I don't get any notification via websocket and the Files.GetDirectory, as mentioned in this thread, does not work any more. Here a curl example:

bash:

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 2, "method": "Files.GetDirectory", "params": {"directory": "cdda://local/"}}' http://127.0.0.1:8080/jsonrpc

{"error":{"code":-32602,"message":"Invalid params."},"id":2,"jsonrpc":"2.0"}

However, the command works in general:

bash:

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 2, "method": "Files.GetDirectory", "params": {"directory": "MediathekView"}}' http://127.0.0.1:8080/jsonrpc

{"id":2,"jsonrpc":"2.0","result":{"files":[{"file":"MediathekView/foo/","filetype":"directory","label":"foo","type":"unknown"}, ... ],"limits":{"end":7,"start":0,"total":7}}}

Can anybody help me here? Is there any other way to detect, if a disc is inserted in the drive?

Thanks in advance!
Reply

Logout Mark Read Team Forum Stats Members Help
Play Audio CD0