INTERACT FORUM

Please login or register.

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

Author Topic: Map a key to MCC command for MC18 running elsewhere on LAN  (Read 16346 times)

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Map a key to MCC command for MC18 running elsewhere on LAN
« on: January 17, 2013, 08:10:49 pm »

My Home Theater PC is hooked up to my HD TV.  When viewing video, one is using that HD TV, and so any input devices (keyboards, mice, etc) are controlling that Home Theater PC and thus MC18.

However, when listening to music, the HD TV may be off entirely, or it may be showing satellite TV (thus not using MC18).

If I use an MCE remote, it is likely on the couch across the room when I want to pause audio (to answer phone, doorbell, etc).

So, what I want to do is to map an unused key on other laptops in the LAN to send the command:

MC18.exe /MCC 10000, 0

("pause")

to the \\MEDIA-PC in the LAN.

One suggestion was to use psexec.exe, but it turns out that it requires too much changes in the setup to allow access.

I thought of using WebGizmo, which has pause, but evidently WebGizmo does not have any of its own Global shortcut keys for functions.  So, I have to first bring up WebGizmo, and then press pause on it.

So, I am hoping for some other suggestion...

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #1 on: January 17, 2013, 09:56:13 pm »

You can access all of the same commands as Gizmo/WebGizmo/JRemote via the MCWS (Web Service) interface.  For example, if you enter this URL in your web browser:

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/PlayPause?Zone=-1&ZoneType=ID

It will send a Play/Pause command to the copy of MC on that machine (if the Media Network server is enabled and the Firewall, if any, lets the traffic through).  This will work from any computer or device that has a web browser and can "reach" the system at the specified address and port.

You can also do an explicit Pause command (as opposed to the Play/Pause toggle) with this URL:

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/Pause?State=-1&Zone=-1&ZoneType=ID

The documentation for the Web Service can be found here:

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/

So, you'd just need to either write a script that can send a web URL command, and then bind the script to a hotkey in Windows with an automation/hotkey tool like AutoHotKey or Girder.  Girder can even send the web command directly (without writing the script).  I don't know for sure if AutoHotKey can do this cleanly or easily, but it looks like it should be able to handle it with a little work (you might need help from an AutoHotKey wizard though).

You could certainly do it if you install the Windows version of cURL, and then call that from AutoHotKey with an appropriate command line.  There might be a better/easier way built-in though.
Logged
"Some cultures are defined by their relationship to cheese."

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

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #2 on: January 17, 2013, 09:58:28 pm »

How does one handle the account authorization?
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #3 on: January 17, 2013, 10:03:56 pm »

How does one handle the account authorization?

Good point.

It is in the documentation, but you can use the Authentication command first.

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Authenticate

This responds with a token that you add to any subsequent MCWS calls like this:

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/PlayPause?Zone=-1&ZoneType=ID&Token=<TOKEN>

But you'd have to write something to parse the XML response from the Authenticate command for this.  You might be able to include the U/P in the individual URLs instead (which would be "insecure" but would probably serve his needs fine), but I'm not sure how...
Logged
"Some cultures are defined by their relationship to cheese."

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

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #4 on: January 17, 2013, 10:09:07 pm »

Yeah, wait...

cURL handles User/Pass authentication fine, so you could just handle it through the cURL command line in your BAT file.  Since you're only sending the one command, you don't need to worry about parsing the token or any of that.

curl --user name:password http://www.example.com

Even if you wanted to use multiple commands, in a row, you'd just have to use the --user option for cURL on each of them.
Logged
"Some cultures are defined by their relationship to cheese."

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

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #6 on: January 17, 2013, 10:10:44 pm »

Logged
"Some cultures are defined by their relationship to cheese."

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

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #7 on: January 17, 2013, 10:17:27 pm »

Yep.  Just tested it.  This works fine:

c:\bin>curl --user user:pass "http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/Pause?State=-1&Zone=-1&ZoneType=ID"

So, just get cURL, extract it and put it some folder in your System Path, and then make a BAT file that contains that command (customized for your system, of course).  Then, call that BAT file from your hotkey.

That's a simple way to do it.  Though, like I said, there is probably something better built into AutoHotKey, if you know it.

PS.  If you do it this way, and you don't like seeing the black cmd.exe window, you can put the command in a vbs or wsh script instead of a bat file, and then set the script to run hidden or minimized.  I've explained how to do this before and posted example scripts.  It is simple.
Logged
"Some cultures are defined by their relationship to cheese."

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

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #8 on: January 17, 2013, 10:34:33 pm »

You can access all of the same commands as Gizmo/WebGizmo/JRemote via the MCWS (Web Service) interface.  For example, if you enter this URL in your web browser:

http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/PlayPause?Zone=-1&ZoneType=ID

It will send a Play/Pause command to the copy of MC on that machine (if the Media Network server is enabled and the Firewall, if any, lets the traffic through).  This will work from any computer or device that has a web browser and can "reach" the system at the specified address and port.
I started Media Network on the Media PC and then pasted the above line (with the correct address and port) into the RUN box on my laptop and it worked !   (where psexec needed the authorization, Media Network doesn't, probably due to the special port)

So, I am not sure why I need curl ?   I would imagine AutoHotKey mappings does the same thing as RUN ?  (I haven't checked yet)

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #9 on: January 17, 2013, 10:43:05 pm »

Hmmm - it worked the first time, but now doesn't work after that first time... odd.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #10 on: January 17, 2013, 10:50:27 pm »

So, I am not sure why I need curl ?   I would imagine AutoHotKey mappings does the same thing as RUN ?  (I haven't checked yet)

I thought that might show an actual browser.  Plus, using a "browser" like cURL would probably be lower resources, but of course, that wouldn't matter for your purposes.

But I just tested on mine, and it popped open a tab in my browser, so that wouldn't be so good.

You could also probably do it from a vbs script using HttpClient...
Logged
"Some cultures are defined by their relationship to cheese."

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

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #11 on: January 17, 2013, 11:02:42 pm »

AutoHotkey will do the same as Run, in fact they call it.... Run  :o
Quote
Launching a program or document

The Run command is used to launch a program, document, URL, or shortcut. Here are some common examples:

Run Notepad
Run C:\My Documents\Address List.doc
Run C:\My Documents\My Shortcut.lnk
Run www.yahoo.com
Run mailto:someone@somedomain.com

A hotkey can be assigned to any of the above examples by including a hotkey label. In the first example below, the assigned hotkey is Win+N, while in the second it is Control+Alt+C:

#n::Run Notepad
^!c::Run calc.exe

The above examples are known as single-line hotkeys because each consists of only one command. To have more than one command executed by a hotkey, put the first line beneath the hotkey definition and make the last line a return. For example:

#n::
Run http://www.google.com
Run Notepad.exe
return

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #12 on: January 17, 2013, 11:49:52 pm »

This works:

Code: [Select]
<job id="main">
<script language="VBScript">
        Dim oXMLHTTP

        Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")

        oXMLHTTP.open "GET", "http://<SERVER_ADDRESS>:<MC_PORT>/MCWS/v1/Playback/PlayPause?Zone=-1&ZoneType=ID", False, "<USERNAME>", "<PASSWORD>"
        oXMLHTTP.send

        if oXMLHTTP.status = 200 then
            Wscript.Echo "worked"
        else
            wscript.echo "failed"
        end if

</script>
</job>

Obviously, you don't need the Wscript.Echo part if you just want to send it.  I just put that in there for testing.
Logged
"Some cultures are defined by their relationship to cheese."

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

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #13 on: January 18, 2013, 04:45:07 pm »

Does MCWS require UPNP ?

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #14 on: January 18, 2013, 04:58:55 pm »

Does MCWS require UPNP ?

I don't believe so.  These are services provided by the built-in web server in MC to handle HTTP requests.  No UPNP involved.
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #15 on: January 18, 2013, 05:01:03 pm »

Okay, I followed Glynor's instructions for WSF in the linked post, and put the WSF script from this thread into it, and then put mapped the PAUSE/Break key to "Run Pause.wsf" in an AutoHotKey script, and indeed it worked (and I even got a debug popup saying so Smiley and then edited out the debug IF. ).

Thanks to both of you, for your help and I hope that this thread will come up in search in the future for anyone else looking to do this.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #16 on: January 18, 2013, 05:04:48 pm »

The unix like Cygwin for Windows has the "wget" command which will also send an http request...  I never heard of curl before...

I use it to call the MCWS "info" command to get back player status...

My home automation system sometimes wants to send a command to MC to "play" if not playing and ignore the command if already playing.  I've never found a MCC command to do the ignore part.

So I call this batch file from my home automation system.

Quote
wget -q -O - http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1 | grep ">Playing<" 

IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :FAILURE

:SUCCESS
ECHO Status=Playing ... no action taken
goto END

:FAILURE
ECHO MC18.exe /command pause
MC18.exe /command pause

goto :END

:END
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #17 on: January 18, 2013, 05:44:11 pm »

You can do this directly in the shell, since you have cygwin - no need for a .bat file:

c:\cygwin\bin\bash -c "/bin/wget -q -O - http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1 | /bin/grep -q '>Playing<' && mc18.exe /command pause"

This also works in MC via calling an external program (for example, in Theater View).

The utilities curl and wget have both been around for a long time - everyone has their own favorite.
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #18 on: January 18, 2013, 05:46:09 pm »

LOL.... MrC.. that is cool... and of course once I saw it... of course....

I've been using UNIX shell for decades.  Thanks
Logged

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #19 on: January 18, 2013, 06:17:37 pm »

Actually, that doesn't work as I expected it to.

grep should return a 0 return code if it finds '>Playing<' and non-zero if not.

So if '>Playing<' is found, then MC18 would be executed due to the &&

So I tried grep -v which should invert the return code... but it doesn't, not in bash or ksh in cygwin.  The cygwin grep returns 0 with or without the -v option.

I've been retired from my developer job since April... so I no longer have any real unix boxes to test grep with, but I'd swear I've done this in zillions of batch files for decades.

Anyone got access to a real unix box to test grep and grep -v ?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #20 on: January 18, 2013, 06:23:38 pm »

These are from cygwin:

$ echo Yup | grep Nope ; echo $?
1

$ echo Yup | grep Yup ; echo $?
Yup
0

$ echo Yup | grep -v Nope ; echo $?
Yup
0

$ echo Yup | grep -v Yup ; echo $?
1

Are you examining the Windows return status rather than the cygwin status returned by bash in the Cygwin environment.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #21 on: January 18, 2013, 06:28:40 pm »

So if '>Playing<' is found, then MC18 would be executed due to the &&

I was confused about what you wanted - it didn't make sense to me why you wanted to send a Pause if you learned that MC was *not* playing.  I thought you wanted:

  If MC is Playing then Pause

which is:

   grep playing && send pause

When you want the converse, instead of -v, you can use

   grep playing || send start playing
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #22 on: January 18, 2013, 06:58:02 pm »

MrC,

I don't get it... I run this command, and the MC18 command is run every time, no matter if MediaCenter is playing or not.

If I remove the -v, then the MC18 command is conditional (but not what I want)

Quote
#! /bin/ksh

wget -q -O - "http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1" | grep -v ">Playing<" && mc18 /command pause

The goal is for the MC18 /command pause to be run only if MediaCenter is NOT currently playing (either stopped or paused)

So I tried this

Quote
wget -q -O - "http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1" | grep ">Playing<"
echo $?

As expected, if MC is Playing, the return code is 0 and if not playing the return code is 1

But if I add the -v, the return code is 0 whether MC is playing or not.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72402
  • Where did I put my teeth?
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #23 on: January 18, 2013, 07:00:28 pm »

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #24 on: January 18, 2013, 07:12:33 pm »

MrC,

I don't get it... I run this command, and the MC18 command is run every time, no matter if MediaCenter is playing or not.


Remember, -v means the the lines that don't match, not invert the status.  If there are lines returned, then the status must be 0.
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #25 on: January 18, 2013, 07:19:27 pm »

My memory is failing me... I'd swear that I've done this before a zillion times on HP unix boxes and the -v reversed the return code too.

This annoys me, that I don't have an HP or SUN UNIX box to test this with, all I have is Cygwin BASH or KSH.

Thanks, I'll get someone to test it on HP/SUN where I used to work... have I forgotten all since I retired 7 months ago?

And yes... using || works as expected (without the -v).
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #26 on: January 18, 2013, 07:41:12 pm »

I concur - your memory is failing you.  grep -v has already meant Show the non-matched lines, and if lines are found, a 0 is output, otherwise a 1.  Here's from Mac OS X:

$  echo Yup | grep Yup ; echo $?
Yup
0

$  echo Nope | grep Yup ; echo $?  
1

$  echo Nope | grep -v Yup ; echo $?
Nope
0

$  echo Yup | grep -v Yup ; echo $?    
1

$ <<HERE grep -v Yup ; echo $?
> Yup
> Nope
> HERE
Nope
0

-v, --invert-match
         Invert the sense of matching, to select non-matching lines.  (-v is specified by POSIX.)

EXIT STATUS
       Normally, the exit status is 0 if selected lines are found and 1 otherwise.

Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #27 on: January 18, 2013, 07:43:17 pm »

MrC,

I'm sure you are right... my memory is failing me...  and I was the "shell" expert in my last job...  oh well... I do like being retired... !!!!

It's scary though.. I have miles and miles of C++/Java/Shell code on my PC to control my HomeAutomation system...  I fear when it all starts to look greek to me.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #28 on: January 18, 2013, 07:44:29 pm »

MrC,

I'm sure you are right... my memory is failing me...  and I was the "shell" expert in my last job...  oh well... I do like being retired... !!!!

Unix learning - a process until you die.
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #29 on: January 18, 2013, 07:46:02 pm »

Unix learning - a process until you die.

Yes I agree... but I've done this all before... and I forgot...

I still learn more stuff about VI all the time... (I hate windows editors)

When I was working I bought the VI plugin for Eclipse with my own money...
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #30 on: January 18, 2013, 07:49:31 pm »

Good stuff.

I see I still have some of my old Unix Scripting course materials online.  Its been a while.
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #31 on: January 18, 2013, 07:55:58 pm »

Good stuff.

I see I still have some of my old Unix Scripting course materials online.  Its been a while.

Nice !!!

I've always been a document'er...  All of my C++ libraries all have man pages, and my Java libs are done in JavaDocs.  Without my docs, I couldn't use my libs anymore.

Thanks for your help and patience today...  I'm actually upset with myself that I forgot the full meaning of -v.  What else have I forgot?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #32 on: January 18, 2013, 10:37:07 pm »

Unix learning - a process until you die.

+1

I'm surprised you hadn't heard of curl before, but yes, wget is a similar alternative.  The nice thing about UNIX and all (with the modular applications)...  In any case, that's the one I'm familiar with.

It was first released in 1997, so maybe you had already learned wget (1996) by then and didn't ever go looking.  (It is included on most Linux distros, and OSX, I think.)

In any case, I'm curious...

Why do you want to send a Pause command when MC is not currently playing?  What does that accomplish?
Logged
"Some cultures are defined by their relationship to cheese."

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

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #33 on: January 19, 2013, 01:45:08 am »

Hee hee...

In any case, I'm curious...

Why do you want to send a Pause command when MC is not currently playing?  What does that accomplish?

I was confused about what you wanted - it didn't make sense to me why you wanted to send a Pause if you learned that MC was *not* playing.  I thought you wanted:

Two steak minds think alike.
Logged
The opinions I express represent my own folly.

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #34 on: January 19, 2013, 08:43:21 am »

When my home automation system sends the command, my goal is if music is not playing to get it playing, and if playing, do nothing.

If MC is stopped, "pause" does a play and starts playback.
If MC is paused, "pause" unpauses and starts playback.
If MC is already playing do nothing.

So the result of this is that after running this command, music will be playing,
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #35 on: January 19, 2013, 01:19:45 pm »

Thanks for the clarification.  This became clear to me when last night I updated:

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

Quote
/Pause       Toggles between play and pause states. See Note 1.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #36 on: January 19, 2013, 04:53:45 pm »

I thought maybe you could use PlayAdvanced from MCWS, but I just tested it and it doesn't work that way.  It'll play whatever happens to be selected in the UI at the time (even if it is already playing).  Plus, if you play the file that is already playing via this command, MC crashes.  Like the command line version, this command is designed to receive a custom play object via the first parameter.  If you leave it blank, it uses the currently selected file, which is different than just unpausing the existing Playing Now (I imagine your goal).

So, there doesn't seem to be a "regular" discreet Play command in there that I can see, so that method probably works well.

I was just curious.
Logged
"Some cultures are defined by their relationship to cheese."

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

DoubtingThomas

  • Citizen of the Universe
  • *****
  • Posts: 564
Re: Map a key to MCC command for MC18 running elsewhere on LAN
« Reply #37 on: January 19, 2013, 07:44:57 pm »

So, there doesn't seem to be a "regular" discreet Play command in there that I can see, so that method probably works well.

I struggled for years for a way to "know" if MC was playing.   I have an audio sensor on my audio system so my home-automation system knows if there is an audio signal, but of course, silent parts of a track fool it.  So I built in thresholds on time, but of course it was only a good guess if audio was actually playing.

I also tried to use the output file from the WritePlaying plugin.. but again, it was only updated every 5 seconds.

Then a few weeks ago I discovered the MCWS's... and the "info" service which I can call and know if MC is "Playing" in realtime... works great.  When I was working... I would never ever grep for info in XML tags.. but I'm retired now... it works.

The MCWS info call does not return any info about the next track... so the PlayingNow plugin (which I also use) must get that info from someplace else, do you know where?
Logged
Pages: [1]   Go Up