Hi all,
Many thanks to eve - the following MCWS command to retrieve info about current track being played is exactly what I need.
http://localhost:52199/MCWS/v1/Files/Current?I have managed to make quite a bit of progress with my project - but now looking for further help.
I have tried C++. See below, could 'send' commands to control media server but could not find a way to 'read' information from it.
Swapped to Python and had more success. I have used the pymcws module written by Keno Maerz which does a great job of interfacing the MCWS commands to a Python script.
Here is my working Python script:
# first load up the relevant modules #
import pymcws as mcws
import json
#connect to JRiver Media Center#
office = mcws.get_media_server_light("stHpKr", "readonly", "supersecretpassword")
#send one of the MCWS commands - in this case it gets info on the currently playing track#
Myfile=mcws.playback.info(office)
#this line converts the retrieved info into a string format that can be printed#
y=json.loads(json.dumps(Myfile))
# print currently playing track:
print("Now playing ...")
print("Artist: " + y["Artist"])
print("Name: " + y["Name"])
print("Album: " + y["Album"])
Running this gives the following successful output
Now playing ...
Artist: Town Called Malice
Name: The Jam
Album: Our Generation
The question I have is how would I bring back a field not in the 'playback.info' list?
For example – ‘Volume Level (R128)’?
Turning to my issue with C++ coding, here is the relevant extract:
This MCWS command sent via a web browser gives lots more info about current track being played, including ‘Volume Level (R128)’ (The response is in a .mpl file).
http://localhost:52199/MCWS/v1/Files/Current?//make a string variable to hold the URL to send//
string Myurl = "explorer
http://localhost:52199/MCWS/v1/Files/Current?";
//send the command to Media Center and capture response in a suitable variable Myxml//
auto Myxml = std::system(Myurl.data());
//try and print the response//
std::cout << "Myxml = ";
std::cout << Myxml;
Running this gives the following output:
Myxml = 1
This is not what I require. I would like to receive the whole response so I can extract the data from ‘Volume Level (R128)’.
Any help would be really great.
Chris