INTERACT FORUM

Please login or register.

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

Author Topic: Zone switching via command line help wanted  (Read 6089 times)

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Zone switching via command line help wanted
« on: November 25, 2011, 09:26:52 pm »

Hi MC gurus,

I am after some help regarding the use of the MCC command line.  I have just spent many hours trying to get the below working with many varied & unpredictable results.

In my setup I have:

1 x HTPC running as the Server and Client (MC17, latest build .38) on Windows 7 Home Professional x64
This PC has a dual head video card of which I am using 1 channel (DVI/HDMI) as a local (living room) zone for Video/Audio playback and the other for a remote room (via HDMI Extenders) Video/Audio playback.
I only want to run MC in Theatre View and also will only want one of these zones active at any one time.

My wish is to be able to capture what is currently playing in the living room zone and then switch it up to the bedroom zone to continue playback all via as fewer remote control button presses as possible.

I have been trying to use the command line \MCC commands in batch files called from remote control commands but as mentioned above have had many unreliable results.

I can already switch monitors using the \MonitorExtend & \MonitorSwitch commands which I have in batch files but all my difficulty seems to lie in switching the audio playback zone to follow the video.

Firstly what I am wondering is, is it possible to achieve what I am trying to do?
& secondly if so, is anyone able to offer some help on how to do it.

Thanks in advance
Brian

Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41953
  • Shoes gone again!
Re: Zone switching via command line help wanted
« Reply #1 on: November 25, 2011, 09:59:11 pm »

You can switch zones with the command line, but not copy the Playing Now list from one zone to another.

You can also link zones, but this is for when you want to play in both zones at once.
Logged
Matt Ashland, JRiver Media Center

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Re: Zone switching via command line help wanted
« Reply #2 on: November 25, 2011, 11:00:16 pm »

Ok Thanks Matt,

Quote
You can switch zones with the command line, but not copy the Playing Now list from one zone to another.
I can live without copying the Playing now between zones for now.  Is this something that may make its way into the feature set?
I see this as useful particularly if watching a movie in the living room and then half way through feel like going to bed and watching the rest there.  You could change zone, which would automatically pause the movie, switch the playback zone and then you could resume playback in the other room.  (not as important if listening to music).  I believe that some other whole house A/V systems have this capability and it would be great to see it in MC.

Can you provide an example of how to switch the zones via command line as anything that I try doesn't seem to work properly.
How do I know what each zones number is as they are only referenced by name/description throughout the program?

Also, what would be the "command line" command & parameters for linking the zones, if I was to try that?

In essence, I want to be able to automate the manual process of navigating through Theatre View menus by having a script that is triggered from a single button on the remote.

Thanks
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Zone switching via command line help wanted
« Reply #3 on: November 25, 2011, 11:10:08 pm »

You can set the current zone with:

  mc17.exe /mcc MCC_SET_ZONE,zone_number

where zone_number is the number of the zone you want.  Zone numbers are indexes based upon the order in Playing Now.

Once the zone is set, playback commands lacking a zone specifier generally go to the current zone.

I don't see a way to link zones via command line or /MCC command.

Be sure to see both:
http://wiki.jriver.com/index.php/Media_Center_Core_Commands#Specifying_Zones
http://wiki.jriver.com/index.php/The_Command_Line
Logged
The opinions I express represent my own folly.

J-a-k-e

  • World Citizen
  • ***
  • Posts: 117
Re: Zone switching via command line help wanted
« Reply #4 on: November 25, 2011, 11:18:18 pm »

This has me intrigued as I myself use a batch script that requires text "1" "2" or "3" input and switches media centre to the selected display and zone, switching audio zones is the easy part.

I'm looking through the mcc commands now and it's possible to export playing now to playlist or copy to memory but this would capture ALL playing now items and not preserve the current playing file position or time. There doesn't seem to be a way to "purge items with a number sequence less than currently playing" or "ignore items that have already been played."

Matt brings up a good point about linked zones, if you link currently playing or paused zone "A" to zone "B" zone A's currently playing is created and mirrored in zone "B" if you play pause and unlink. Unfortunately there's no command line option for automating the linking of zones only a command to display a zone link notification.
Logged

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Re: Zone switching via command line help wanted
« Reply #5 on: November 26, 2011, 01:13:41 am »

Any chance you could post the batch script you are using. I don't understand the use of the "string" parameters
For me the easy part is switching the displays and I am stuck on the audio part.  My 2 audio zones are the HDMI audio of the TV's themselves.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Zone switching via command line help wanted
« Reply #6 on: November 26, 2011, 01:24:14 am »

Can you explain more what is unclear. Which commands specifically?  I'll update the wiki to be more helpful in the future.
Logged
The opinions I express represent my own folly.

J-a-k-e

  • World Citizen
  • ***
  • Posts: 117
Re: Zone switching via command line help wanted
« Reply #7 on: November 26, 2011, 03:09:22 am »

Bear with me... The script is a little messy and complicated in itself as I've designed it so that it will jump to the correct label section if it is run linked as a shortcut or from command line with the parameter following such as "jriver.bat e" for example. Otherwise if the script is run as is the string will request user input. I will post the uncommented version below this post. Feel free to ask questions

For a brief explanation "P" being the "pc" runs my 20" monitor (display 0) and headphones. zone 1. zone 2 and display 0 are linked to the t (tv) and e (extended) Full screen has been set to jump to the TV display when it is enabled. Current.bat is a file that use to keep track of the "current" string value as string values don't exist outside the .bat command instance. Also where string variables are surrounded with quotes "" this stops the bat file from ending in an error if that variable hasn't been defined

@echo off
if exist current.bat call current.bat      *// This bat file sets the the last run status for the string "current" (see bottom of File)
if not "%1"=="" goto %1      *// if %1 is not blank ie the file was run as jriver.bat p for example this will check and jump to that label
set mode=:eof     *// sets string "mode" to ":eof" this is an inbuilt end of file label
set /p mode="Set display mode - "P" for pc "T" for TV or "E" for pc extended followed by the enter key or press enter to end:" *// /p on the set command requests user input
goto %mode%      *//jumps to the label point that the user has entered, if the user 'just' presses enter this will of course jump to :eof as above
:e     *// extended display section
if "%current%"=="p"  mc17.exe /command stop     *// if last run status for string 'current' was p this executes a stop command for my headphone zone
if not "%current%"=="e" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60     *//if last run status was "e" this line doesn't execute otherwise enables both displays
mc17.exe /mode theater     *//sets jriver to theater mode and start if not already running
mc17.exe /mcc 10011, 1      *//sets zone to 1
echo set current=e>current.bat    *//writes current.bat as "set current=e"
goto :eof     *//jumps to end
:p     *//pc display section
if not "%current%"=="p"  mc17.exe /command stop     *//if last run not set to p executes stop command for stereo system zone
if not "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60     *//for some reason I've found I need to enable both displays first if switching
if not "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:disable
mc17 /mode standard     *//sets standard view which is what I use when I'm at the pc most of the time
mc17 /mcc 10011, 0     * //set zone to 0 headphones
echo set current=p>current.bat     *//writes current.bat as "set current=p"
goto :eof
:t
if "%current%"=="p"  mc17.exe /command stop     *//if current zone is 0 headphones executes stop
if "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60     *// if last run "current" was p enabled both displays first
if not "%current%"=="t" mc17.exe /monitorSwitch 0:disable 1:1920x1080x32x60     *//if current mode is not t (tv) disables display 0
mc17 /mode theater      *//sets mode to theater
mc17 /mcc 10011, 1     *sets zone to 1 stereo
echo set current=t>current.bat      *//writes current.bat as "set current=e"
Logged

J-a-k-e

  • World Citizen
  • ***
  • Posts: 117
Re: Zone switching via command line help wanted
« Reply #8 on: November 26, 2011, 03:11:16 am »

@echo off
if exist current.bat call current.bat
if not "%1"=="" goto %1
set mode=:eof
set /p mode="Set display mode - "P" for pc "T" for TV or "E" for pc extended followed by the enter key or press enter to end:"
goto %mode%
:e
if "%current%"=="p"  mc17.exe /command stop
if not "%current%"=="e" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60
mc17.exe /mode theater
mc17.exe /mcc 10011, 1
echo set current=e>current.bat
goto :eof
:p
if not "%current%"=="p"  mc17.exe /command stop
if not "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60
if not "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:disable
mc17 /mode standard
mc17 /mcc 10011, 0
echo set current=p>current.bat
goto :eof
:t
if "%current%"=="p"  mc17.exe /command stop
if "%current%"=="p" mc17.exe /monitorSwitch 0:1680x1050x32x60xprimary 1:1920x1080x32x60
if not "%current%"=="t" mc17.exe /monitorSwitch 0:disable 1:1920x1080x32x60
mc17 /mode theater
mc17 /mcc 10011, 1
echo set current=t>current.bat
Logged

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Re: Zone switching via command line help wanted
« Reply #9 on: November 26, 2011, 04:43:54 am »

Thanks heaps for this,

I was using the basic /MonitorSwitch commands and also the  "mc17 /mcc 10011" for setting the zone but didn't know what zone number to use.
I was also getting very mixed (not consistently repeatable) results with what I was trying.
By your code it looks like the zone numbering is 0 based. i.e. first zone to appear in theatre view is zone 0

I also have not written too many batch files so this will be a good program to base mine on.

Thanks very much

Logged

J-a-k-e

  • World Citizen
  • ***
  • Posts: 117
Re: Zone switching via command line help wanted
« Reply #10 on: November 26, 2011, 05:13:40 am »

I was using the basic /MonitorSwitch commands
/monitorswitch is what I'm using too, it was a bit of a fiddle to get working at first but all seems fine now.

"mc17 /mcc 10011" for setting the zone but didn't know what zone number to use.
By your code it looks like the zone numbering is 0 based. i.e. first zone to appear in theatre view is zone 0

The numbers refer to the order of the zones you have configured ie
"mc17 /mcc 10011, 0" will switch to the first zone in the list under the playing now heading "zone A" for example
"mc17 /mcc 10011, 1" will switch to the second zone "Zone B" for example and so on.

If instead the zone was set to "B" and  you put set the command "mc17 /mcc 10011, -1" this would change to zone "C" (assuming of course that this is the 3rd zone listed under playing now.)
But if instead the zone was set to "B" and you used "mc17 /mcc 10011, -2" this would set the zone to "A"

Logged

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Re: Zone switching via command line help wanted
« Reply #11 on: November 26, 2011, 06:47:02 am »

I now have this working thanks to you guys,
Below is my batch file for switching between 2 TV (Multi-monitor) zones.

REM This script is called from MC Remote commands
REM #1 button on remote calls "TV ZoneSwitching.bat B1" = Activate Bedroom 1 (TV) Playback Zone
REM #2 button on remote calls "TV ZoneSwitching.bat LA" = Activate Living Area (TV) Playback Zone


@echo off
if exist current.bat call current.bat
if not "%1"=="" goto %1
set mode=:eof
set /p mode="Set display mode - "B1" for Bedroom 1 "LA" for Living Area followed by the enter key or press enter to end:"
goto %mode%

:LA
if not "%current%"=="LA" c:\windows\system32\mc17.exe /command stop
if not "%current%"=="LA" c:\windows\system32\mc17.exe /monitorSwitch 0:1360x768x32x60 1:1920x1080x32x25xprimary
if not "%current%"=="LA" c:\windows\system32\mc17.exe /monitorSwitch 0:disable 1:1920x1080x32x25xprimary
c:\windows\system32\mc17.exe /mode theater
c:\windows\system32\mc17.exe /mcc 10011, 0
echo set current=LA>current.bat
goto :eof

:B1
if not "%current%"=="B1" c:\windows\system32\mc17.exe /command stop
if not "%current%"=="B1" c:\windows\system32\mc17.exe /monitorSwitch 0:1360x768x32x60xprimary 1:1920x1080x32x25
if not "%current%"=="B1" c:\windows\system32\mc17.exe /monitorSwitch 0:1360x768x32x60xprimary 1:disable
c:\windows\system32\mc17.exe /mode theater
c:\windows\system32\mc17.exe /mcc 10011, 1
echo set current=B1>current.bat


I have noticed though that with the /mcc commands I needed to use the numbers to get it to work reliably as when I used the Labels i.e. /mcc MCC_SET_ZONE I got unpredictable results.

Matt,
Quote
You can also link zones, but this is for when you want to play in both zones at once.
you mention linking zones,  I am aware that this can be done in standard view but is it possible via command line?
Is this something that will be added to theater view functionality in the future?
 
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Zone switching via command line help wanted
« Reply #12 on: November 26, 2011, 10:16:09 am »


I have noticed though that with the /mcc commands I needed to use the numbers to get it to work reliably as when I used the Labels i.e. /mcc MCC_SET_ZONE I got unpredictable results.

Right.  The mcc command numbers must be used.
Logged
The opinions I express represent my own folly.

BrianD

  • Junior Woodchuck
  • **
  • Posts: 68
Re: Zone switching via command line help wanted
« Reply #13 on: November 26, 2011, 05:24:03 pm »

Quote
Can you explain more what is unclear. Which commands specifically?  I'll update the wiki to be more helpful in the future.

So from my point of view the things that are unclear in the wiki help are:

How to determine the Zone Numbers from the zone names that exist (easy when you know how ;))
The fact that you need to use the command numbers (not the names)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Zone switching via command line help wanted
« Reply #14 on: November 26, 2011, 07:26:32 pm »

So from my point of view the things that are unclear in the wiki help are:

How to determine the Zone Numbers from the zone names that exist (easy when you know how ;))
The fact that you need to use the command numbers (not the names)

Great points, thanks.  Updated with text:

Quote
Note: Command numbers must be used; command names are not used on the command line.

and later...

Quote
...MC zones are integer indexes, from 0 to n, where 0 is the the first zone, 1 is the second zone, and so on.  Zone indexes correspond to the zone order displayed under Playing Now in the Media Center tree.

Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up