INTERACT FORUM
More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: Matt on March 18, 2013, 05:35:58 pm
-
18.0.153 makes some new things possible with the command line and web service.
I was looking for a way to make it really easy to get background music playing at home.
This batch file runs the program, stops what's playing, links zones (you need zones named 'Kitchen' and 'Living Room'), sets the volume, then starts Play Doctor playing.
REM --------------------------------
REM JRiver One-Click Play Batch File
REM --------------------------------
REM Make sure MC is running
MC18.exe
REM Stop playback of anything that might be playing
MC18.exe "/MCWS/v1/Playback/Stop?Zone=Kitchen&ZoneType=Name"
MC18.exe "/MCWS/v1/Playback/Stop?Zone=Living Room&ZoneType=Name"
REM Link zones
MC18.exe "/MCWS/v1/Playback/LinkZones?Zone1=Kitchen&ZoneType1=Name&Zone2=Living Room&ZoneType2=Name"
REM Set volume for each zone
MC18.exe "/MCWS/v1/Playback/Volume?Zone=Kitchen&ZoneType=Name&Level=0.65"
MC18.exe "/MCWS/v1/Playback/Volume?Zone=Living Room&ZoneType=Name&Level=0.75"
REM Start Play Doctor playback
MC18.exe "/MCWS/v1/Playback/PlayDoctor?Seed=Easy Listening&Zone=Living Room&ZoneType=Name"
Someday I'd like to get it so my phone could wake up the computer and run the script with a single click. Gizmo already does the wake up part, so this might not be too hard.
-
Matt, do you know whether this functionality will allow me to control MC using iRule on my iPad? I currently have a few commands working using WMC commands with MCE Controller working on the HTPC, but not everything worked at the time I programmed it. However, at that point MC was having some troubles with remote commands, so I'm not sure whether to try again.
-
Hi Matt,
Is it possible to query the play state using calls like this? - ie, stopped, paused, playing? If not, could this be added. I'm looking for a way to do stuff based on the current play state if possible.
Thanks.
-
So it appears the command line processor will look for /MCWS and then issue the command. Nice.
-
Hi Matt,
Is it possible to query the play state using calls like this? - ie, stopped, paused, playing? If not, could this be added. I'm looking for a way to do stuff based on the current play state if possible.
Thanks.
It doesn't return information to the command line.
So to do something like that now, you'll have to use the MCWS directly or COM.
It would be nice if the command line returned the same result you'd get in a browser, but the plumbing is a little complicated.
EDIT: Thinking about this a little more, I wonder if we could just allow any MCWS function to accept a parameter like &OutputToFile=C:\Test.dat. Then, the launcher could append that and read the file after it finished. It could then write the file to the standard output. It would remove the need to tunnel (possibly large) data back through a memory map or other IPC mechanism.
-
So it appears the command line processor will look for /MCWS and then issue the command. Nice.
Exactly.
I'm particularly keen to build functionality into MCWS, so it makes sense to allow the other ways to control the program to tunnel into it.
-
EDIT: Thinking about this a little more, I wonder if we could just allow any MCWS function to accept a parameter like &OutputToFile=C:\Test.dat. Then, the launcher could append that and read the file after it finished. It could then write the file to the standard output. It would remove the need to tunnel (possibly large) data back through a memory map or other IPC mechanism.
That'd work!
-
If the launcher is going to have the ability to read this temp file, just make it an anonymous private file that MC manages and outputs.
I think you are going to eventually need to create cross platform fork, exec, and pipe functions for handling process creation and the STDIO plumbing and errno reporting. It is not very difficult, btw.
-
I think you are going to eventually need to create cross platform fork, exec, and pipe functions for handling process creation and the STDIO plumbing and errno reporting. It is not very difficult, btw.
The launcher isn't actually a command line program. This way, it doesn't show a terminal window when it's run.
But that means it's hard to write the output to the command line.
There's some discussion of this here:
http://stackoverflow.com/questions/54536/win32-gui-app-that-writes-usage-text-to-stdout-when-invoked-as-app-exe-help
Maybe creating an MC18.com file would work. I'm not sure.
-
Oh, I see. I thought it was a command line program, that was configured to not show the command line window (this is possible). So I'm guessing it is just MC (or nearly), stripped down to the bare essentials.
-
I thought it was a command line program, that was configured to not show the command line window (this is possible).
Is that possible from code, in such a way that a black box won't flash at all?
So I'm guessing it is just MC (or nearly), stripped down to the bare essentials.
It's just a tiny stand-alone executable that forwards commands to the right place. It's not really like MC (other than that it's built on the same base classes).
-
Is that possible from code, in such a way that a black box won't flash at all?
Let's see, its been a while...
Use CreateProcess(). In the LPSTARTUPINFO structure, set dwFlags with STARTF_USESHOWWINDOW, and set SW_HIDE in wShowWindow.
Ages ago I had to write some cross-platform (WinNT, *nix) commmand line progs for a client, and created wrapper functions for the *nix/POSIX fork/exec/pipe, etc. system calls. This made the STDIO pretty trivial and much more useful than typical Win32 console apps.
Also see: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/4539b247-9f35-422f-99e0-b4c341c7c004/ (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/4539b247-9f35-422f-99e0-b4c341c7c004/)
-
Let's see, its been a while...
Use CreateProcess(). In the LPSTARTUPINFO structure, set dwFlags with STARTF_USESHOWWINDOW, and set SW_HIDE in wShowWindow.
That only works if we're launching.
But double-clicking an MP3 from Explorer runs the launcher, etc. and in those cases, we can't control the process launch flags.
-
... hence the aforementioned link.
-
... hence the aforementioned link.
I think they're just switching from a console program to a GUI program without really realizing it (wmainCRTStartup entry point).
Maybe if a GUI program is opened from the console there's a way to write to the output, but I don't think so because the console doesn't wait for the process to finish.
-
I have wrote a little utility to launch the playback of a movie in full screen. The usage it's simple:
jremote "mediafile"
or
jremote "playlist"
other options are in the file: jremote.exe.config
In summary the utility perform the following tasks:
1) Check if JRiver MediaServer is running if not start it. 2) Set JRiver Player in full screen. 3) Ask to MediaServer to play the film, also should accepts play lists as file name. 4) For 10 secs. attempt to give the focus to the Player. 5) Stay in idle till some hot keys are pressed then close JRiver MediaServer and exit.
The hot keys are: ALT+F4, CTRL+S, BACK, ESC
I have attached the file (with C# source) in this post.
Also since this feature is missing in JRiver: if is pressed APPS or More/Info on the remote is shown a media info display over the screen. To work it's necessary copy in the same folder of this utility the file "mediainfo.dll" (link: http://mediaarea.net/download/binary/libmediainfo0/0.7.62/MediaInfo_DLL_0.7.62_Windows_i386_WithoutInstaller.7z (http://mediaarea.net/download/binary/libmediainfo0/0.7.62/MediaInfo_DLL_0.7.62_Windows_i386_WithoutInstaller.7z)).
-
Is it possible to start MC and ask him to remove all video of the library (not the music) and import a file mpl, by a command line ?
-
Is it possible to start MC and ask him to remove all video of the library (not the music) and import a file mpl, by a command line ?
http://wiki.jriver.com/index.php/The_Command_Line (http://wiki.jriver.com/index.php/The_Command_Line)
It doesn't look like you can remove items from the library via the command line, but you can import & play files.
-
Thank you, I'll look