INTERACT FORUM

Please login or register.

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

Author Topic: Use MC as external player for 3rd party apps - MCPlayClose V0.14  (Read 50104 times)

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525

Latest Version: https://drive.google.com/drive/folders/0B8STIzDFNsyoTjU3UUNkZWlwYlk?resourcekey=0-yQ6xEYttVgAHuEyqEr-OOg

Ver .14 (9-29-15)

Ver .13 (9-19-2014)
Permanent fix for MC not closing.
Now works with Authentication in media network
All previous user reported issues should be resolved.

Ver .12 (9-18-2014)
Temp workaround for MC not closing on playback stop

Ver .11
Fix path handling for MyMovies

Ver .10
Added ability to pass a path to a DVD or Blu-ray for example, "c:\movies\matrix" it will look for either the video_ts.ifo or index.bdmv files and send those to Media Center.

ver .9
Fixed sometime MC wouldn't have focus after startup

ver .8
Works around a problem with the command "MC17.exe /close" (used to close MC after playback is stopped) closing the MC server if it is selected to run at startup in the MC options.
ver .7
Only change is to make work with Media Center 17. Will default to MC17. You must change "mcVersion" in the file "MCPlayCloseConfig.txt" to 16 for if you are still using MediaCenter 16.

ver .6
Fix standby, shutdown, hibernate options not working.
Added optional argument WMC to force Windows Media Center to the foreground after playback stop

ver.5
Fix possible problem entering fullscreen

ver .4
If mcplayclose was called a second time before it had closed it would crash. Now mcplayclose can be run anytime and if another instance is running it will be closed and playback of the new file will take over.
Fixed sometimes playing now wasn't being replaced with new file. Now playing now is cleared and playback starts of new file.

ver .3
mcplayclose window will now be hidden

ver .2
This version no longer uses the vbs script file. I have completely rewritten it in VB.NET. Use MCPlayClose.exe from now on.
User configurable settings are in the file MCPlayCloseConfig.txt. If you don't have or delete this file the program will automatically recreate it with the default values that should work for most people. See the bottom of this file for these values.
It will now create a MCPlayCloseDebug.txt file.

USAGE:
First argument is required and must be the file path of what you want to play. File path must also be in quotes. All other arguments are optional and do not use quotes.
    example: mcplayclose.exe "c:\test.avi"
You can pass a zone number you want to play in. Zone 1 is 1, zone 2 is 2.
    example: mcplayclose.exe "c:\test.avi" 1    (Plays in zone 1)
You can pass a view you want to play in: standard, minime, fullscreen or theater
    example: mcplayclose.exe "c:\test.avi" fullscreen
You can pass an option to shutdown, standby or hibernate after playback stops and MC closes.
    example: mcplayclose.exe "c:\test.avi" 1 fullscreen standby
You can also pass it a playlist that is in MC.
    example: mcplayclose.exe "TREEPATH=Playlists\myplaylist" 1 fullscreen standby


User configurable variables within mcplaycloseconfig.txt.  Edit with notepad:
mcIP = 127.0.0.1      Set to your MC library server IP address. 127.0.0.1 for most people as this will be run on the local computer.
mcPort = 52199        Set to your MC library server port number. Tools > Options > Media Network > Advanced > TCP Port:
mcUserName =          Set to your MC library server username. Tools > Options > Media Network > Authentication
mcPassword =          Set to your MC library server password. Tools > Options > Media Network > Authentication
mcAccessKey =        Not currently used, value has no affect
mcloadDelay = 2000      Delay between time MC loads and playback starts. Delay values are in milliseconds. 1000 is 1 second.
                                I use this because I have my soundcard switch modes when MC is opened and I have to delay the start of playback
                                till the soundcard switches.

serverDelay, stateDelay and shutdownDelay are no longer used.
   

Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: Use MC as external player for 3rd party apps - script
« Reply #1 on: August 20, 2011, 05:57:17 pm »

Nice one.  Thank you.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #2 on: August 20, 2011, 06:56:47 pm »

Thanks Jim, didn't realize I posted this in the wrong place.
Logged

steelman1991

  • World Citizen
  • ***
  • Posts: 126
Re: Use MC as external player for 3rd party apps - script
« Reply #3 on: August 21, 2011, 03:32:16 am »

justsomeguy - looks mighty interesting, but for someone with little computer knowledge, though happy to learn, could you perhaps hand hold on this one.

I have downloaded and extracted the relevant files to, I hope the correct location - in my case

c:\Program Files\J River\Media Center 16

I then set up MB as per your screenshot with the relevant parameters as well. However I get no handover from MB to J River when attempting playback.

Any assistance you can give?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: Use MC as external player for 3rd party apps - script
« Reply #4 on: August 21, 2011, 07:11:31 am »

Try running Media Server on Windows Startup.  It's a small footprint version of MC.  Tools/Options/Startup.  Last option on the page.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #5 on: August 21, 2011, 03:02:24 pm »

Definitely try what Jim suggested.

Also, if you setup MB exactly like the picture that might be a problem. I have, "{0}" 1 fullscreen , the 1 means it's going to play in zone 2 and if this is a new install of MC or you have never setup additional zones then MC only has one zone and that would be 0. So maybe try "{0}" 0 fullscreen and see if that helps. I know the zone numbering might be a little confusing, I might change that so that 1 means 1 and 2 means 2.

Check your mcPort number, mcUsername and mcPassword in the vbs file match what's in MC.

It doesn't matter where you put the files as long as they are both in the same folder.

Oh and I just uploaded a new one. There are no code changes. The MCPlayClose.vbs had some unix formatting in it and didn't display nicely in notepad.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Use MC as external player for 3rd party apps - script
« Reply #6 on: August 21, 2011, 04:22:29 pm »

Suggestions, if you don't mind:

1) Make the zone index 1 based. Let your program do the math, instead of having to explain it and have the users do the math.

2) Provide switch option names followed by parameters so that a) they are self documenting in use, and b) can be entered in any order on the command line.

3) Always place filenames at the end of the command line.  This convention is so that more than one filename can be specified on the command line without affecting other parameters.

Examples:

  mcplayclose.vbs /zone 1 /screenmode fullscreen /stopaction standby "c:\test.avi"
 
  mcplayclose.vbs /stopaction hibernate /screenmode minime /zone 3  "c:\test.avi" "c:\test2.avi" "c:\test3.avi"
Logged
The opinions I express represent my own folly.

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #7 on: August 23, 2011, 09:16:18 pm »

Download link in the first post has been updated.

Only change is that zone numbers logically match how the zones are displayed in MC. So now 1 means zone 1 and 2 is zone 2 instead of before where 0 was zone 1 and 1 was zone 2.

Suggestions, if you don't mind:

1) Make the zone index 1 based. Let your program do the math, instead of having to explain it and have the users do the math.

2) Provide switch option names followed by parameters so that a) they are self documenting in use, and b) can be entered in any order on the command line.

3) Always place filenames at the end of the command line.  This convention is so that more than one filename can be specified on the command line without affecting other parameters.

I don't mind suggestions at all. I'm not a "programmer" so there is probably a lot of things I do that isn't "proper".

1) I did make the zone numbering change which I knew I should have done to begin with but for some reason didn't. It was a very simple change.

2) I had thought about using switch names but at the time didn't see an easy way of parsing them in the code if there was a space between the switch and the argument. After thinking about it, I'm thinking maybe reading all arguments into an array then cycle through that array looking for a specific switch then using the next value in the array as the actual argument. Does that sound like the proper way of handling this? Right now other than the filename, all the other switches should be able to be used in any order.

3) I hadn't thought of passing multiple file names through the command line. I was thinking you'd just pass a playlist if there were multiple files to play. Can't really think of any situation that this would be used to pass multiple files but there may be. However your point makes since and does seem like the better way of doing it.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Use MC as external player for 3rd party apps - script
« Reply #8 on: August 23, 2011, 09:26:54 pm »

Sounds good.

It is reasonable to assume whitespace after the switch, so you can assume the thing that follows should be the argument.  Nice thing about this is it allows you to do some sanity checks on arguments, should you desire to (eg. a zone should always be an integer 1 to n, etc.)

Although you may never use more than one filename, now you have the option and your code won't change much (at least the argument processing portion).

Again, nice work.
Cheers.
Logged
The opinions I express represent my own folly.

SkyBox

  • Recent member
  • *
  • Posts: 16
Re: Use MC as external player for 3rd party apps - script
« Reply #9 on: September 06, 2011, 05:36:06 pm »

USAGE:
First argument is required and must be the file path of what you want to play. All other arguments are optional.
    example: mcplayclose.vbs "c:\test.avi"
Have a question regarding the first required argument.  Should this be included in the parameter?  I cannot find a place to include it in the vb script.

Should the parameter look like this: mcplayclose.vbs "c:\test.avi" fullscreen
                                                  or: "{0}" fullscreen

I have only been able to get the script to open MC.
Many thanks!
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #10 on: September 06, 2011, 10:27:41 pm »

Hi Skybox,

Both examples you gave should work depending on the situation they are used in. If you are using mediabrowser like the image in my example, mcplayclose.exe should be in the "external player location" and "{0}" fullscreen should be in the optional parameters. If you are using Mediabrowser the "{0}" basically tells mediabrowser to pass the path to the file that is to be played. In that case you do not supply "c:\test.avi"

When using Mediabrowser you must use mcplayclose.exe and not mcplayclose.vbs. The EXE depends on the vbs so both files must be kept. Both files must be in the same folder to work.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #11 on: September 06, 2011, 10:36:37 pm »

Also what are your computer specs?
Have you modified anything with the script itself?
If you have gotten MC to load with the script but not play, it could be a timing issue. There are several things that need to be given time in MC to load before the script can successfully get the file to actually play. If MC is loading but not paying try increasing "mcloadDelay = 2000" to "mcloadDelay = 3000" near the top of the script, or even try 4000. This gives MC time to fully load before the script tries to tell MC to start playing.
Logged

SkyBox

  • Recent member
  • *
  • Posts: 16
Re: Use MC as external player for 3rd party apps - script
« Reply #12 on: September 07, 2011, 11:54:55 am »

Also what are your computer specs?
Have you modified anything with the script itself?
If you have gotten MC to load with the script but not play, it could be a timing issue. There are several things that need to be given time in MC to load before the script can successfully get the file to actually play. If MC is loading but not paying try increasing "mcloadDelay = 2000" to "mcloadDelay = 3000" near the top of the script, or even try 4000. This gives MC time to fully load before the script tries to tell MC to start playing.

I have been setting the external player to the executable and not the .vb script.  Also, have not modified the script - even re-downloaded yesterday to be sure.  Being that I can get MB to open MC, the ip and port setting should be good right?  I haven't customized any of this in MC.

I will play with the timing/delay - let me know if you think of anything else obvious.  Thanks!

Specs:
Media Center: 16.0.164.0
Media Browser: 2.3.2.0
Win7 32-bit (fresh install and FAST)
Memory: 3.5gb
Processor: Dual Core Athlon 4200 (2.2ghz)
Graphics: ATI Radeon HD 5670 Graphics

Logged

SkyBox

  • Recent member
  • *
  • Posts: 16
Re: Use MC as external player for 3rd party apps - script
« Reply #13 on: September 11, 2011, 10:16:42 am »

Now I am getting a Windows script host error "Cannot connect to MC".   Running your files from my desktop (permissions?) seem to be working no matter what the time delay is.  I can get MC to open in theater view (Fullscreen), but then errors out.

I will start looking at the IP and port settings.  Also have the MC media server running.

Any other ideas?
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #14 on: September 11, 2011, 04:26:33 pm »

Definitely check your port setting for the server in MC. I believe it is set to 52199 by default unless changed. This is the value the script is set to as well. If your port is different, change mcPort in the script. You will see the "Cannot connect to MC" message if this is not set right.

The mcIP setting in the script should work the way it is set: 127.0.0.1

If the above doesn't work, try this:
Try increasing the serverDelay in the script to 20000. By default it is set to 15000. The script waits this time before it starts polling MC for it's play status. If MC server hasn't fully loaded within this time you will see the "Cannot connect to MC" message.

You said MC server is already running in the background, if so then serverDelay setting shouldn't be the problem though.


I may change how this portion of the script works to make it more tolerant to this error and more flexible for different computers varying MC load times.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #15 on: September 12, 2011, 03:25:28 am »

Just updated the link to the script in the first post to be more tolerant to different MC load times. May help with anyone getting "Can't Connect to MC" errors.
serverDelay is no longer a required setting in the script and has been removed.

SkyBox, if you are still having issues, try this new version.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #16 on: September 12, 2011, 04:09:32 am »

Quote
from Jasonpctech
No dice, Changing the path broke the script and it would not come up in MyMovies external player settings. This one below is seemingly perfect but it won't work.
Here is what I have:
---------------------------------------------------------------
<ExternalPlayer Name="Media Center 16" DisplayName="JRiver Media Center 16">
      <DVDFileStructure>True</DVDFileStructure>
      <BluRayFileStructure>True</BluRayFileStructure>
      <HDDVDFileStructure>True</HDDVDFileStructure>
      <RecordedTV>False</RecordedTV>
      <Files>True</Files>

      <ProcessName>MC16.exe</ProcessName>

      <Parameters>"[PATH]" --fullscreen</Parameters>

      <Location StartupDelay="1">
            <Path>C:\Windows\System32\MC16.exe</Path>
      
      </Location>
      </ExternalPlayer>
-----------------------------------------------------------------

"MC16.exe" isn't the process that runs when MC is playing back content. It should be "Media Center 16.exe". MC16.exe from my understanding, is just used to issue commands to MC after it is already running.

The -- you have before fullscreen won't work. The script doesn't expect to see that.

Try this below. Main difference from what I sent first time is that for the <Path> I used MCPlayClose.exe instead of MCPlayClose.vbs. MyMovies may do the same thing as mediabrowser and not recognize .vbs. In the download in the first post there is an exe and vbs file. Save them both somewhere and change the <Path> to point to the MCPlayClose.exe file.

Do you know what MyMovies uses <ProcessName> for? Does it monitor that process during playback?

Code: [Select]
<ExternalPlayer Name="Media Center 16" DisplayName="JRiver Media Center 16">
      <DVDFileStructure>True</DVDFileStructure>
      <BluRayFileStructure>True</BluRayFileStructure>
      <HDDVDFileStructure>True</HDDVDFileStructure>
      <RecordedTV>False</RecordedTV>
      <Files>True</Files>

      <ProcessName>Media Center 16.exe</ProcessName>

      <Parameters>"[PATH]" fullscreen</Parameters>

      <Location StartupDelay="1">
            <Path>C:\YOUR PATH HERE\MCPlayClose.exe</Path>
      
      </Location>
      </ExternalPlayer>
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #18 on: September 19, 2011, 02:03:32 am »

Posted a new version in the first post.

Completely rewrote the exe file. Previously it was actually just a self extracting vbs script. It would show up as wscript.exe as the process name in task manager. This may cause problems with some software launching it as an external player. It is now a true exe file written in .NET.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #19 on: September 19, 2011, 02:09:12 am »

ok getting closer but the vbs breaks at line 42.

That error and the line it is at means the script didn't receive any arguments from the program that started it, in you case MyMovies.

I uploaded a new version in the first post. Give that one a try. I rewrote the exe portion and that might help out. The XML will change slightly though. Try the code below with the new version in my first post. The new version will also create a text file called MCPlayCloseDebug.txt that will log what parameters it was passed.

Code: [Select]
<ExternalPlayer Name="Media Center 16" DisplayName="JRiver Media Center 16">
      <DVDFileStructure>True</DVDFileStructure>
      <BluRayFileStructure>True</BluRayFileStructure>
      <HDDVDFileStructure>True</HDDVDFileStructure>
      <RecordedTV>False</RecordedTV>
      <Files>True</Files>

      <ProcessName>MCPlayClose.exe</ProcessName>

      <Parameters>"[PATH]" fullscreen</Parameters>

      <Location StartupDelay="1">
            <Path>C:\YOUR PATH HERE\MCPlayClose.exe</Path>
      
      </Location>
      </ExternalPlayer>
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - script
« Reply #20 on: September 20, 2011, 12:57:54 pm »

Clever, now I can check a debug log.
I have verified JRiver web control and playback works and entered the proper details to the vbs.
It looks like I just am not getting to the mcplayclose.EXE or .VBS at all seeing I get no logs as of yet.
this is what I have so far.

Have edited, BOTH .XML files each time

Tried, [PROGRAMFILES] & C:\Program Files (x86)\MCPlayClose

Put, MCPlayClose folder in both Programfiles and C:\Program Files (x86)

----------------------------------

<ExternalPlayer Name="Media Center 16" DisplayName="JRiver Media Center 16">
      <DVDFileStructure>True</DVDFileStructure>
      <BluRayFileStructure>True</BluRayFileStructure>
      <HDDVDFileStructure>True</HDDVDFileStructure>
      <RecordedTV>False</RecordedTV>
      <Files>True</Files>

      <ProcessName>Media Center 16.exe</ProcessName>
      
      <Parameters>"[PATH]" fullscreen</Parameters>

      <Location StartupDelay="1">
            <Path>[PROGRAMFILES]\MCPlayClose\MCPlayClose.exe</Path>
      </Location>
   </ExternalPlayer>
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #21 on: September 20, 2011, 02:44:46 pm »

Try putting this in a .bat file, run the .bat, and see if you can get it to work outside of MyMovies. It should also create the MCPlayCloseDebug file in the same folder as MCPlayClose.exe and should show SOMEFILE.avi and fullscreen as the arguments passed to it.

Code: [Select]
"C:\YOUR PATH\MCPlayClose.exe" SOMEFILE.avi fullscreen

Also in your XML I believe <ProcessName>Media Center 16.exe</ProcessName> should be <ProcessName>MCPlayClose.exe</ProcessName>. Have you tried that with this new version? MCPlayClose.exe will stay open as long as your media is playing back. When playback stops MCPlayClose.exe will close. I'm assuming MyMovies monitors this process to see when it closes and when it should take back control.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - script
« Reply #22 on: September 20, 2011, 02:56:58 pm »

It looks like I just am not getting to the mcplayclose.EXE or .VBS at all seeing I get no logs as of yet.

If it's not generating the log at all then MyMovies isn't trying to launch MCPlayClose.exe at all. If you simply double click on MCPlayClose.exe, it will create the MCPlayCloseDebug file. In the file it will just say there were no arguments passed and nothing else will happen.
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - script
« Reply #23 on: September 21, 2011, 01:53:58 am »

OK, the .BAT file is working, so that proves your code is running on my machine. "Hence your awesome" didn't really doubt that.
Yes I have tried MCPlayclose.EXE & .VBS instead of Media Center 16.EXE

So, your making good points but looks like MyMovies problem now.
The funny thing is KMPlayer works just fine and (XML wise) looks pretty much the same without using your script KMPlayer runs perfect.
GAAAAA!
Also made request at MyMovies for help, we may get lucky.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps
« Reply #24 on: September 21, 2011, 06:11:28 am »

New version in the first post.

Completely rewritten. No longer in VB script. Just a MCPlayClose.exe and a MCPlayCloseConfig.txt file now.
Removed several timing issues that eliminated the need for certain user set variables.
Should be a little faster in launching and closing MC.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps
« Reply #25 on: September 21, 2011, 06:16:29 am »

Thanks for the kind words Jasonpctech. I'm far from awesome at this programming stuff though. I'm using this as a learning experience and just picking up new things as I go. Don't usually have a lot of time for it though.

Give the new version I posted a try. Not sure it will help the problem with MyMovies but I changed a fair amount. So worth a shot.
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - no longer a script
« Reply #26 on: September 21, 2011, 10:00:32 pm »

WORKING!
Using MCplayclose ver2
I am using Win7 x64 I put the JRiver and MCplayclose folders both in the Program files x86 and Program files folders just in case.

FULLSCREEN was not needed, Note nesting of beginning and end this may have been the issue to begin with I had one misaligned. XML rules are important.

This is the XML:

   <ExternalPlayer Name="MCPlayClose" DisplayName="JRiver Media Center 16">
         <DVDFileStructure>True</DVDFileStructure>
         <BluRayFileStructure>True</BluRayFileStructure>
         <HDDVDFileStructure>True</HDDVDFileStructure>
         <RecordedTV>False</RecordedTV>
         <Files>True</Files>

         <ProcessName>Media Center 16.exe</ProcessName>
      
         <Parameters>"[PATH]"</Parameters>

         <Location StartupDelay="1">
                  <Path>[PROGRAMFILES]\MCPlayClose\MCPlayClose.exe</Path>
            
         </Location>
    </ExternalPlayer>


ISSUES:
I do however see a window for MCplayclose.exe that persists, would be nice if it minimised.

Also "Media Center 16.exe" stays running in processes for some reason even though it appears closed. This may effect the next use in unexpected ways...
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - no longer a script
« Reply #27 on: September 22, 2011, 02:20:12 am »

Quote
FULLSCREEN was not needed
So is MC playing back in fullscreen even though you left that out? Or dod you not want it in fullscreen? Not sure how MyMovies could put MC into fullscreen on its own.

Quote
I do however see a window for MCplayclose.exe that persists, would be nice if it minimised.

New version in the first post will now completely hide the window from view.

Quote
Also "Media Center 16.exe" stays running in processes for some reason even though it appears closed. This may effect the next use in unexpected ways...

In Media Center in the options under Startup/Windows Startup, do you have "Run on Windows startup" set to Media Server? If so this keeps Media Center 16.exe loaded even after you close MC.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: Use MC as external player for 3rd party apps - no longer a script
« Reply #28 on: September 22, 2011, 07:15:44 am »

Also "Media Center 16.exe" stays running in processes for some reason even though it appears closed.
That may be Media Server.  More in the article on Servers in our wiki.
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.4
« Reply #29 on: September 24, 2011, 04:35:15 am »

Yes in use the Mcplayclose window appears for a moment just before JRiver then self terminates quietly later as expected. good.

The "Media Player 16.exe" process still remains running after closing.
 Dunno if that's a issue.

MC opens to display mode on my system would be better as fullscreen. Oddly omitting Fullscreen after "[PATH]" in XML seems to fix that.

Closing MC is 2 steps STOP & then CLOSE program but still won't re-open WMC window after. Annoying but but not major.


For those of you new to this and watching there is a order of doing things to make this work.

For editing I suggest http://notepad-plus-plus.org/

Note: "Program Files (x86)" is used in 64 bit windows I put the McPlayclose folder in both that and "Program Files" folders.

1. Find and edit C:\Program Files (x86)\Binnerup Consult\My Movies for Windows Media Center\externalplayers.xml


This is my example:

</ExternalPlayer>
      <ExternalPlayer Name="MCPlayClose" DisplayName="JRiver Media Center 16">
      <DVDFileStructure>True</DVDFileStructure>
      <BluRayFileStructure>True</BluRayFileStructure>
      <HDDVDFileStructure>True</HDDVDFileStructure>
      <RecordedTV>False</RecordedTV>
      <Files>True</Files>

      <ProcessName>Media Center 16.exe</ProcessName>
      
      <Parameters>"[PATH]"</Parameters>

      <Location StartupDelay="1">
            <Path>[PROGRAMFILES]\MCPlayClose\MCPlayClose.exe</Path>
      </Location>
</ExternalPlayer>

2. Now download MCplayclose ver4 and extract it into a self titled folder where ever you prefer or use path above.

3. Lastly Run the MyMovies tray application that should be active assuming you have already installed MyMovies. Proceed to "TOOLS" "OPTIONS" then "EXTERNAL PLAYERS" change any available associations to "JRiver Media Center 16" and also add "Specific file types (Advanced)" for each .ISO, .MKV, .AVI, .MV4 as "JRiver Media Center 16" save, and this should all work now.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.4
« Reply #30 on: September 24, 2011, 03:03:54 pm »

Quote
Closing MC is 2 steps STOP & then CLOSE program but still won't re-open WMC window after. Annoying but but not major.

MCplayclose should be closing MC on its own without any interaction from you. When playback of the current file stops MCplayclose sends a close command to MC then MCplayclose exits and MC should exit as well.

You mentioned "Media Center 16.exe" stays running for you even after you have closed it. This line in your XML, <ProcessName>Media Center 16.exe</ProcessName>, is probably why WMC won't re-open on it's own. MyMovies thinks MC is still running because it's monitoring that process name, that never closes for you. However "MCplayclose.exe" should be exiting even if "Media Center 16.exe" isn't. You can verify that MCplayclose is exiting by looking in task manager. So <ProcessName>MCPlayClose.exe</ProcessName> really should work better since it should always close when playback stops even if MC doesn't, which should then tell MyMovies to return control to WMC.
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.4
« Reply #31 on: September 26, 2011, 04:27:47 am »

Made that change on the XML above as suggested. It now closes Media Player 16.exe process but WMC7 still won't maximize. I have to click WMC7 in tray to get back.

Also, any idea on how to make MC just close at stop rather than change to standard mode requiring 2 clicks to close.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.5
« Reply #32 on: September 26, 2011, 07:43:32 pm »

Made that change on the XML above as suggested. It now closes Media Player 16.exe process but WMC7 still won't maximize. I have to click WMC7 in tray to get back.

Also, any idea on how to make MC just close at stop rather than change to standard mode requiring 2 clicks to close.

That's what this is suppose to actually do. When I watch a movie it plays through and when it gets to the end MC playback stops and then mcplayclose tells MC to close then WMC comes back. This all happens automatically. You shouldn't need to to press stop or close MC yourself at all.

Is there an option in MyMovies that tells it to minimize WMC and if so can it be turned off so WMC is left maximized? Then MC should just open over top of WMC and when MC closes WMC should still be there.
Logged

Jasonpctech

  • Recent member
  • *
  • Posts: 15
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.5
« Reply #33 on: October 07, 2011, 12:37:26 am »

Sorry to leave you hanging, I tried version 5 didn't seem to pop WMC back up but that's fine it's close enuf now thanks to you. Good job! JSG

The only thing that would make my happier is if MyMovies made a actual JRiver Plug-in. I think that would be worth pursuing and I have written Brian Binnerup on the subject.
Guess we'll see.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.6
« Reply #34 on: October 07, 2011, 04:11:47 am »

New version to fix standby, hibernate, shutdown options not working.


Sorry to leave you hanging, I tried version 5 didn't seem to pop WMC back up but that's fine it's close enuf now thanks to you. Good job! JSG

I have been sitting on the new version I just posted for a week. Seen your post and it reminded me I hadn't uploaded it yet. I added the option to add WMC to the command line arguments. This should hopefully force WMC back open.

So if you change this line to:
<Parameters>"[PATH]" WMC</Parameters>
it may work.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.7
« Reply #35 on: October 26, 2011, 07:14:08 pm »

Changed to work with the new Media Center 17.

If you use this version with MC16 you must change "mcVersion" to 17 in the "MCPlayCloseConfig.txt" file.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.8
« Reply #36 on: November 05, 2011, 08:50:38 pm »

I'm continuing to make minor changes to this for my own purpose. There hasn't been much feedback but a lot of thread views so for now I'll keep posting any changes.

New version .8
Works around a problem with the command "MC17.exe /close" (used to close MC after playback is stopped) closing the MC server if it is selected to run at startup in the MC options.
Logged

bobrap

  • Recent member
  • *
  • Posts: 32
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.8
« Reply #37 on: November 10, 2011, 12:22:46 pm »

Any experience using this with MC17 as an external player in XBMC?  I guess my parameters are set incorrectly.  I can get it to play, but, not close MC.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #38 on: November 10, 2011, 07:47:30 pm »

I don't use XBMC but had it installed still from a while back when I was deciding on what software to use on my htpc. I tried it was able to get it to play and close properly on my system.

Here's the playercorefactory.xml settings I used.

<playercorefactory>
 <players>
   <player name="MediaCenter17" type="ExternalPlayer" audio="false" video="true">
     <filename>C:\Users\Matt\Desktop\MC\MCPlayClose\MCPlayClose.exe</filename>
     <args>"{1}" fullscreen</args>
     <hidexbmc>false</hidexbmc>
     <hideconsole>false</hideconsole>
     <warpcursor>none</warpcursor>
   </player>
 </players>
<rules action="prepend">
 <rule video="true" player="MediaCenter17">
 </rule>
</rules>
</playercorefactory>

Also did you change any settings in the MCPlayCloseConfig.txt file? If so what are they?
Make sure in Media Center in the options under Media Network, that "Use Media Network to share the library and enable DLNA" is checked. The other important setting is the TCP Port setting under Advanced, by default it is set to 52199. This must match what mcIP is set to in the MCPlayCloseConfig.txt file.

I found a problem with Media Center 17 not getting focus when launched from XBMC so the ver .9 I just posted fixes that. Hope it works for you.
Logged

bobrap

  • Recent member
  • *
  • Posts: 32
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #39 on: November 10, 2011, 08:33:05 pm »

No joy for me.  All the settings are as you suggested.  I still can't get it to close MC and switch back to XBMC.  One the main things that keeps me from using MC exclusively for video playback. ?
Logged

NickF

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 860
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #40 on: December 13, 2011, 01:17:21 pm »

I'm afraid I have failed to make this work.  I am using MyMovies from within Windows Media Center but I have also tried from a command line.  I am running MC17.

I have done all of the configuration proposed.  When I execute mcplayclose from a command line, MC opens but does not play the video file.  After about a second, MC closes.  This is what it says in the debug file:

Arguments:
VTS_01_1.VOB
fullscreen

13/12/2011 19:14:47 : Waiting for MC to open
13/12/2011 19:14:47 : MC opened
13/12/2011 19:14:48 : Playback - PLAYING
13/12/2011 19:14:48 : Turned repeat off
13/12/2011 19:14:48 : Waiting for MC server to load
13/12/2011 19:14:48 : Connected to MC server
13/12/2011 19:14:49 : Playback - STOPPED
13/12/2011 19:14:49 : MC closed

Something is causing playback to stop and close MC.

I am desperate to make this work.  Can anyone help?

Update:

I have now tried this on a second PC with exactly the same result.

Further update:

I tried with MC16.  In this case, the video loads and starts to play but is minimised to the display window (bottom left corner of the MC window).  Esc would normally cause this to happen.  Edit - I discovered a setting which caused this.  Now it works in MC16 but not in MC17.


Nick.  
Logged
HTPC - Intel i5-760 CPU, Windows 7 64 bit, NVIDIA GTS450 Silent, RME 9632 with A04, BlackGold BGT3600; Video Processor - Lumagen Radiance XD Processor; Projector - ProjectionDesign Action Model 3 1080; Denon AVC-A1HD; 4 x Tannoy Berkley and Velodyne DD-10

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #41 on: December 14, 2011, 01:13:46 am »

I just tried playing a vob in v17 and it played, stopped then closed MC as it should.

In the debug file under arguments, was there no path in front of the VTS_01_1.VOB? Like c:\MyVOB\VTS_01_1.VOB. There should be more there than just the file name.

Also in the config txt file make sure mcVersion = 17. If you use v16 then it should be 16.
Logged

NickF

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 860
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #42 on: December 14, 2011, 03:00:48 am »

In the debug file under arguments, was there no path in front of the VTS_01_1.VOB? Like c:\MyVOB\VTS_01_1.VOB. There should be more there than just the file name.
In order to make things simple running this from command line, I placed the .vob file in the same folder as MCPlayclose.exe, hence no path.

Quote
Also in the config txt file make sure mcVersion = 17. If you use v16 then it should be 16.
Yes, I have this set correctly.  I have used both.

When using this from MyMovies with MC16, I have a Blu-Ray ripped to .mkv and this plays OK.  My ripped DVDs won't play.  I am fairly sure that the settings in MyMovies externalplayers are OK.

Any suggestions appreciated.

Nick.
Logged
HTPC - Intel i5-760 CPU, Windows 7 64 bit, NVIDIA GTS450 Silent, RME 9632 with A04, BlackGold BGT3600; Video Processor - Lumagen Radiance XD Processor; Projector - ProjectionDesign Action Model 3 1080; Denon AVC-A1HD; 4 x Tannoy Berkley and Velodyne DD-10

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #43 on: December 14, 2011, 03:56:05 am »

Quote
In order to make things simple running this from command line, I placed the .vob file in the same folder as MCPlayclose.exe, hence no path.
Ok that makes sense. I thought that debug was from using MyMovies, I missed the command line part in your first post..

Quote
I tried with MC16.  In this case, the video loads and starts to play but is minimised to the display window (bottom left corner of the MC window).  Esc would normally cause this to happen.  Edit - I discovered a setting which caused this.  Now it works in MC16 but not in MC17.
So it works with MC16 from command line with vob's but not from MyMovies?
With mkv's from command line and from MyMovies with MC16 it works as well?
Neither mkv or vob work with MC17 from command line or MyMovies but MC17 launches and then then closes? Are you able to see in MC Playing Now list, the file to play before it closes? If you leave off the fullscreen argument you may have enough time to see if the file is there to play or not.

It almost sounds like a config problem in MC17. There's no reason it would pass the file to MC16 and not 17. I'm assuming you've loaded your ripped dvd directly into MC and it plays fine?
Logged

NickF

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 860
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #44 on: December 14, 2011, 05:19:20 am »

I have done some more testing and it now seems that I have the same problem with both MC16 and 17.  From MyMovies, I can play .mkv in both but I can't play ripped DVDs in Video_TS folders.  There is no media showing in Playing Now for DVDs so it seems that the media file is not getting passed to MC.

Yes, I have loaded the ripped DVD into the MC17 library and it plays fine from inside MC.

From command line, I can play .vob in MC16 but not in MC17.  I can play .mkv in both.

I have now checked the configuration of both MC16 and 17 and they are the same.  Of course, it may be that some setting is causing this behaviour but I don't know which it might be!

Update:
I have discovered that, when using MyMovies, if the movie record in the MyMovies database is set up to point to a Folder, whether the main movie title folder or the Video_TS folder, MCplayclose.exe does not pass the movie file to MC.  If MyMovies is set up to point to a video file, e.g. a .ifo or .vob, then the video file is passed to MC and it works.

In general, MyMovies defaults to pointing to folders.  I would be interested to know how yours is set up.  If yours is using files and not folders, that would explain why your setup works and mine doesn't.  I would prefer not to have to change all the records in my database!

Nick.
Logged
HTPC - Intel i5-760 CPU, Windows 7 64 bit, NVIDIA GTS450 Silent, RME 9632 with A04, BlackGold BGT3600; Video Processor - Lumagen Radiance XD Processor; Projector - ProjectionDesign Action Model 3 1080; Denon AVC-A1HD; 4 x Tannoy Berkley and Velodyne DD-10

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #45 on: December 14, 2011, 06:17:05 pm »

Quote
Update:
I have discovered that, when using MyMovies, if the movie record in the MyMovies database is set up to point to a Folder, whether the main movie title folder or the Video_TS folder, MCplayclose.exe does not pass the movie file to MC.  If MyMovies is set up to point to a video file, e.g. a .ifo or .vob, then the video file is passed to MC and it works.

Ya that would explain why it doesn't work. Unfortunately the way I pass the file to MC is using MC's own command line and MC's command line doesn't seem to accept just a path with no filename. I tried getting it to work with just a path but it was a no go for me either. So unless someone else knows how to get MC to take a path with no name from the command line I'm at a loss on this one as it would be a limitation with MC itself.

I don't use MyMovies myself. I wasn't aware of how MyMovies refers to movie locations. I know people have gotten it to work with it though. Either they changed to point to the ifo or they weren't using ripped dvd's I guess.

I wish I could be more help.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #46 on: December 14, 2011, 09:17:58 pm »

I haven't re-read this thread, but if I understand the problem correctly, you're trying to launch a movie by passing a DVD or Blu-ray path?  If so, I posted a script that solves the problem.  If you can't find it, I'll dig it up and post it here - that is, if it is relevant to the discussion at hand.  Otherwise, sorry for butting into your conversation.
Logged
The opinions I express represent my own folly.

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.9
« Reply #47 on: December 14, 2011, 10:44:47 pm »

You're not butting in. You must mean this thread.. http://yabb.jriver.com/interact/index.php?topic=65743.0
Thanks MrC.

@NickF, if you give me sometime I'll see if I can use the logic behind MrC's script and come up with a solution integrated into my program that should fix your problem.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.10
« Reply #48 on: December 14, 2011, 11:54:34 pm »

Ok this was actually fairly straight forward to change.

NickF, try this new version with MyMovies. Assuming the path MyMovies is sending is something like "c:\movies\matrix" then it should work. I tested it from the command line sending a path and MC received the ifo and played. If MyMovies sends something like "c:\movies\matrix\video-ts" then I'll need to change my path in the code, just let me know.

Thanks for pointing me in the right direction MrC.
Logged

NickF

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 860
Re: Use MC as external player for 3rd party apps - MCPlayClose V0.10
« Reply #49 on: December 15, 2011, 04:16:42 am »

Thanks for the help kere.

I have tried the new version and it works from command line but not from MyMovies.  Could there be something about the syntax of the path provided by MyMovies which is incompatible with the extension which you are adding?  From command line, if I add a backslash to the end of the path, MC opens then, after about a second, closes again.  This is what is happening with MyMovies.  Is it possible that the path presented by MyMovies has that backslash so the additional path data and filename which you are adding has an invalid syntax?  If you removed the backslash in front of your "VIDEO_TS", it might work.  Just clutching at straws here!

Nick.
Logged
HTPC - Intel i5-760 CPU, Windows 7 64 bit, NVIDIA GTS450 Silent, RME 9632 with A04, BlackGold BGT3600; Video Processor - Lumagen Radiance XD Processor; Projector - ProjectionDesign Action Model 3 1080; Denon AVC-A1HD; 4 x Tannoy Berkley and Velodyne DD-10
Pages: [1] 2   Go Up