INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Is it possible to launch a video from command line  (Read 5621 times)

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Is it possible to launch a video from command line
« on: February 02, 2016, 02:28:20 pm »

I would like to know if its possible to launch a video from file through JRiver commands.  For example lets say I want to launch a video that was stored here, C:/vide/movie.mp4.  Can you launch that directly from the command line?
Logged

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Is it possible to launch a video from command line
« Reply #1 on: February 02, 2016, 04:19:57 pm »

From command line -

mc21 /20000 C:\vide\movie.mp4

which is MCC_OPEN_FILE

should work.

A list of MCC_CORE_COMMANDS can be found in the wiki

http://wiki.jriver.com/index.php/Media_Center_Core_Commands

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #2 on: February 02, 2016, 07:41:03 pm »

That will only open to the MC folder, cant launch a file doing that
Logged

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251
Re: Is it possible to launch a video from command line
« Reply #3 on: February 02, 2016, 09:00:53 pm »

If the file extension is associated with MC, I would have thought that it should be pretty straight forward.

At work, so I can't check this out for you.

My comment above is based on experience of placing a shortcut on the desktop that points to a vid file. Initiating the shortcut launches MC and the file then plays. If I was at home, I'd copy the shortcut's command detail to a command line and test it.

Regardless, hopefully you get the idea. See if that works.
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #4 on: February 02, 2016, 09:13:17 pm »

so this is what I'm really trying to do,
http://192.168.1.83:52199/MCWS/v1/Control/MCC?Command=20000 H:\AllMedia\TV Shows\Angel\Season 1\Angel S1E1.mp4

all that happen is MC opens the MC folder
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Is it possible to launch a video from command line
« Reply #5 on: February 02, 2016, 11:19:54 pm »

all that happen is MC opens the MC folder

That is because MCC 20000 doesn't do what you're trying to do. Sorry, you got some bad advice above.

But first, relating to this:
so this is what I'm really trying to do,
http://192.168.1.83:52199/MCWS/v1/Control/MCC?Command=20000 H:\AllMedia\TV Shows\Angel\Season 1\Angel S1E1.mp4

Just to check, are you trying to open a file from the command line on the same computer that is going to actually play it? Or a different one across the network? You're probably just a bit confused, but... Assuming you're being normal and trying to use MC on the computer that you have in front of you, and not some other computer on the network somewhere, this is super simple.

Media Center's Command Line Options are documented here:
http://wiki.jriver.com/index.php/The_Command_Line

The Command Line interface has a bunch of stuff it can do on its own. But, it also gives you access to all of the MC Core Commands (which are more "automation" commands). The Core Commands (MCCs) are documented here:
http://wiki.jriver.com/index.php/Media_Center_Core_Commands

But, you don't need any core commands to play a file. There is a /play command part of the regular command line UI, which takes a <playitem> parameter that can be any file on disk (or Playlist in MC, or a bunch of other types of things).

The core commands aren't for stuff like that. They are for automation ("emulating" things you could do in MC yourself with a keyboard shortcut or by clicking on things). The 20000 MCC you found does the exact same thing as going to File > Open Media File: it shows you the file browse dialog. Your extra parameter it doesn't understand is ignored. The MCC commands never take strings and complex arguments. They always take only integers, like this:
mc21.exe /mcc /MCC 23020,1

That one runs the same thing as Tools > Import > Run Auto Import Now, but does so silently (that's the ,1 after the 23020 command). They're like "secret toggles" you can command to "automate" what you would normally do in MC yourself with a mouse or keyboard.

So, you don't want that. You want the Play command.  To do what you want in MC from the command line, using MC21, and assuming you're not trying to do it across the network on some other computer or anything crazy, you'd enter
mc21.exe /play "C:\path\to\file.flac"
or for a video:
mc21.exe /play "C:\path\to\file.mkv"

Which is directly from the documentation page in the Wiki (except I fixed it to be for mc21.exe).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #6 on: February 02, 2016, 11:45:47 pm »

Thanks for your help.  I am doing it from another device that is on the same network.  I am doing this from iRule which is a remote set up on an ipad.  I am able to control MC21 already via IP command, just trying to do some thing specific.  
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Is it possible to launch a video from command line
« Reply #7 on: February 03, 2016, 12:13:52 am »

No problem.

For that you need the Media Center Web Services interface (MCWS). The introduction is here:
http://wiki.jriver.com/index.php/Web_Service_Interface

But the service is actually self documenting. On the machine running MC, you can go to this link to view the documentation:
http://localhost:52199/MCWS/v1/doc (where 52199 is the port that Library Server is running on)

The command you need is:
PlayByFilename: Play a set of files by filename.

Unfortunately, the documentation doesn't mention the Location value you can use to play something immediately (Matt or someone, you should fix that), but using -1 works to do a "Play Now" on it.

Here's an example:
http://localhost:52199/MCWS/v1/Playback/PlayByFilename?Filenames=M:\\Recordings\\MadamSecretary-S02E13-InvasiveSpecies-29823235-0.ts&Location=-1&Zone=-1&ZoneType=ID

You have to escape the slashes and URL-encode spaces, I think, unless there's some way with quoting I didn't figure out.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Is it possible to launch a video from command line
« Reply #8 on: February 03, 2016, 12:22:04 am »

The 20000 MCC you found does the exact same thing as going to File > Open Media File: it shows you the file browse dialog. Your extra parameter it doesn't understand is ignored. The MCC commands never take strings and complex arguments. They always take only integers, like this:
mc21.exe /mcc /MCC 23020,1

Glynor,

Why is it that I can run the command I gave above and have it open MC and play the file I gave it? Not questioning you, actually asking why? :-)

Is it that it's ignoring the /20000 parameter and just playing the file (as if Play were the default action when a file parameter is given)?

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Is it possible to launch a video from command line
« Reply #9 on: February 03, 2016, 12:42:42 am »

Is it that it's ignoring the /20000 parameter and just playing the file (as if Play were the default action when a file parameter is given)?

Yes. You answered your own question.  From The Command Line article's description of the /Play command:
Quote
Note: The option /Play may be omitted, in which case, take care to use double quotes as necessary when issuing commands in the Windows command shell.

You don't use the MCCs by doing /20000 like that. It is ignoring that part, which it doesn't understand, and playing the file (which it does and then /Play is assumed).

To do a MCC command at the command line, you do:
mc21.exe /MCC 10000,0

There is no /20000.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #10 on: February 03, 2016, 02:06:44 am »

You rock man, got it working, thanks
Logged

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Is it possible to launch a video from command line
« Reply #11 on: February 03, 2016, 03:50:14 am »

Yes. You answered your own question.  From The Command Line article's description of the /Play command:
You don't use the MCCs by doing /20000 like that. It is ignoring that part, which it doesn't understand, and playing the file (which it does and then /Play is assumed).

To do a MCC command at the command line, you do:
mc21.exe /MCC 10000,0

There is no /20000.

Great, thanks :-)

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #12 on: February 03, 2016, 03:26:30 pm »

I know this is a long shot but going to ask,  So this command works fine if I put into Chrome address bar,

http://192.168.1.83:52199/MCWS/v1/Playback/PlayByFilename?Filenames=H:\\AllMedia\\TV_Show\\Angel\\Season_1\\Angel_S1E1.mp4&Location=-1&Zone=-1&ZoneType=ID

When I enter it into iRule it does not,

MCWS/v1/Playback/PlayByFilename?Filenames=H:\\AllMedia\\TV_Show\\Angel\\Season_1\\Angel_S1E1.mp4&Location=-1&Zone=-1&ZoneType=ID

Now this command works fine in both,

MCWS/v1/Playback/PlayPause?Zone=-1&ZoneType=ID

I know you don't work for iRule but just wondering if you had any thoughts on why it doesn't work when the other command for play/pause does?  They kinda have the same structure.
Thanks


Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Is it possible to launch a video from command line
« Reply #13 on: February 03, 2016, 05:41:37 pm »

Ooh, no. That's a weird one. That kind of URL string certainly works for me in Firefox (I had to re-test them a bunch to figure out the -1 Location index thing last night).

They probably have some kind of string-parsing bug in their URL processor. It is probably some of the special characters in the filename string, maybe the slashes? I'd report it to them, and give them the specific example just like you did above (explaining that it works in other browsers, and give examples). If they need a MC license, I don't speak for JRiver*, but I'd bet a beer that if the iRule folks need a comp license and they email matt at jriver dot com there would be some kind of action taken (assuming they don't have one already, which they probably do).

That said...

Try URL encoding some of the weird characters, particularly those in the filename string you have there (which wouldn't appear in more vanilla MCWS URL strings). So, maybe:

%5C is the urlencoding for \ (and then you won't need to escape it) so try:
/MCWS/v1/Playback/PlayByFilename?Filenames=H:%5CAllMedia%5CTV_Show%5CAnge%5CSeason_1%5CAngel_S1E1.mp4&Location=-1&Zone=-1&ZoneType=ID

Doing that on my system works just as well in firefox as the one with the real \\s but who knows what iRule (or maybe the iOS framework they're using) is choking on.

If that doesn't work, try attacking the colon, or the period. Things in the filename that aren't part of your other example URL which works... Good luck. If you figure it out, report it back here too if you can for any future lookie-loos.

* Note: I don't work for JRiver. I'm just a particularly helpful/persistent/won't-go-away user here at Interact. They made me an admin on the forum so I can help out with minor admin tasks like banning spammers (but never at random at 3am with a head full of Bulleit bourbon, I swear it, Jim, really). That said, I'm not wrong here.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mpg732

  • Junior Woodchuck
  • **
  • Posts: 96
Re: Is it possible to launch a video from command line
« Reply #14 on: February 03, 2016, 10:36:31 pm »

So if I changed the gateway setting in iRule from "Get" to "Post"  The commands will get MC to respond, however it just seems to restart what ever was playing last.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Is it possible to launch a video from command line
« Reply #15 on: February 05, 2016, 10:30:29 am »

The commands should definitely be sent using a GET command, not POST.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/
Pages: [1]   Go Up