Kodi Community Forum
Another External Player Code, but Very Simple to Setup - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Windows (https://forum.kodi.tv/forumdisplay.php?fid=59)
+---- Thread: Another External Player Code, but Very Simple to Setup (/showthread.php?tid=116724)



RE: Another External Player Code, but Very Simple to Setup - jacky - 2013-01-14

Hello everybody,

i have an problem with TMT5 and/or PDVD12....

If i use TMT5 it starts but first the windows has not the focus. So my harmony and my keyboard doesn't work until i use a mouse and click somewhere ( i hope you understand sorry for poor english .... )
Next problem with TMT5 is when i play an dvd iso i have massive tearing .... don't know why... changed the "auto change refreshrate" but this don't make any difference ....

So i tried PowerDVD12. But there i have the problem that it doesn't play any index.bdmv, mkv files....
ISOs and BluRay discs works ....
So my favorite is PowerDVD12 but it must play index.bdmv files, too....

Here is my playercorefactory.xml:

Code:
<<playercorefactory>
    <players>
        <player name="ISO_Player" type="ExternalPlayer" audio="false" video="true">
            <filename>C:\Users\HTPC\AppData\Roaming\XBMC\userdata\PlayISO.bat</filename>
            <args>"{1}"</args>
            <hidexbmc>false</hidexbmc>
        </player>
                <player name="BDMV_Player" type="ExternalPlayer" audio="false" video="true">
            <filename>C:\Users\HTPC\AppData\Roaming\XBMC\userdata\PlayBDMV.bat</filename>
            <args>"{1}"</args>
            <hidexbmc>false</hidexbmc>
        </player>
        <player name="Disc_Player" type="ExternalPlayer" audio="false" video="true">
            <filename>C:\Users\HTPC\AppData\Roaming\XBMC\userdata\PlayDisc.bat</filename>
            <args>"{1}"</args>
            <hidexbmc>false</hidexbmc>
        </player>
        <player name="Universal_Player" type="ExternalPlayer" audio="false" video="true">
            <filename>C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe</filename>
            <args>"{1}"</args>
            <hidexbmc>false</hidexbmc>
           </player>
    </players>
    <rules action="prepend">
        <!-- Bluray ISO -->
        <rule filenames="iso" filetypes="iso" player="ISO_Player"/>
        <!-- Bluray BDMV -->
        <rule filenames="bdmv" filetypes="bdmv" player="BDMV_Player"/>
        <!-- Bluray M2TS -->
        <rule filenames="m2ts" filetypes="m2ts" player="Universal_Player"/>
        <!-- Bluray MKV -->
        <rule filenames="mkv" filetypes="mkv" player="Universal_Player"/>
        <!-- Bluray AVI -->
        <rule filenames="avi" filetypes="avi" player="Universal_Player"/>
        <!-- Bluray TS -->
        <rule filenames="ts" filetypes="ts" player="Universal_Player"/>
        <!-- Bluray Disc -->
        <rule filenames="BD" name="D:\\.*" filetypes="bdmv" player="Disc_Player"/>
    </rules>
</playercorefactory>

PlayBDMV.bat

Code:
@echo off
set pth=%1
set pth=%pth:BDMV\index.bdmv=%
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" %pth% exit

I hope you can help ....
Thanks very much in advance !


RE: Another External Player Code, but Very Simple to Setup - Nivus420 - 2013-01-14

Hello,

I found in a another forum the same problem and a answer for the problem without back answer. But I dont understand the answer what exactly to do. Its in last page.

http://forum.xbmc.org/showthread.php?tid=105494&page=14




RE: Another External Player Code, but Very Simple to Setup - canachi - 2013-01-14

(2013-01-14, 18:49)acejh1987 Wrote: You could add a ping delay before MPC-HC launch, or you can try this bat file, it should wait until the ISO is mounted before launching MPC-HC.
Let me know if it works, I'm assuming your Virtual Drive is D:

Code:
Set file=%1
Set dummy=%file:iso=%
IF NOT %dummy% == %file% (GOTO playiso) ELSE (goto next)

:playiso
"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\VCDMount.exe" /d=0 %1

:unmounted
IF EXIST D:\BDMV\\. GOTO mounted
GOTO unmounted

:mounted

"C:\Program Files (x86)\MPC-HC\mpc-hc.exe" "D:\BDMV\index.bdmv"
"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\VCDMount.exe" /d=0 /u
GOTO end

:next

"C:\Program Files (x86)\MPC-HC\mpc-hc.exe" %1 exit
GOTO end

:end
exit

Thank you, this new batch file works great.

The only detail left is that when I close MPC-HC, you can see on XBMC a black rectangle in the middle of the screen (for a couple of seconds). So you loose the seamless integration that we got with external players in Eden. Any suggestions?




RE: Another External Player Code, but Very Simple to Setup - acejh1987 - 2013-01-14

(2013-01-14, 21:48)canachi Wrote: Thank you, this new batch file works great.

The only detail left is that when I close MPC-HC, you can see on XBMC a black rectangle in the middle of the screen (for a couple of seconds). So you loose the seamless integration that we got with external players in Eden. Any suggestions?

Has this just started happening with the new batch file or did this show with the other batch files too?
What does the black rectangle look like? Is it a command prompt box?
When I exit MPC, XBMC shows straight away just like with Eden.




RE: Another External Player Code, but Very Simple to Setup - acejh1987 - 2013-01-14

(2013-01-14, 21:32)Nivus420 Wrote: Hello,

I found in a another forum the same problem and a answer for the problem without back answer. But I dont understand the answer what exactly to do. Its in last page.

http://forum.xbmc.org/showthread.php?tid=105494&page=14

The answer in that thread doesn't work for me either.




RE: Another External Player Code, but Very Simple to Setup - Nivus420 - 2013-01-14

I will go back to PDVD10.




RE: Another External Player Code, but Very Simple to Setup - canachi - 2013-01-15

(2013-01-14, 22:09)acejh1987 Wrote: Has this just started happening with the new batch file or did this show with the other batch files too?
What does the black rectangle look like? Is it a command prompt box?
When I exit MPC, XBMC shows straight away just like with Eden.

The box shows with any batch file, the rectangle is from XBMC, suposedly to show the movie playing?



RE: Another External Player Code, but Very Simple to Setup - acejh1987 - 2013-01-15

(2013-01-15, 00:06)canachi Wrote: The box shows with any batch file, the rectangle is from XBMC, suposedly to show the movie playing?

I don't seem to see anything like this, does it have any text inside the box or is it just black?
Would it be possible to get a picture / screenshot of it?

In your playercorefactory.xml do you have hideconsole set to true?


RE: Another External Player Code, but Very Simple to Setup - mrh335 - 2013-01-15

(2013-01-14, 20:01)acejh1987 Wrote:
(2013-01-14, 19:38)mrh335 Wrote: "C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" AUTOPLAY E:

I'm just been playing with the trial, using AUTOPLAY from the Cyberlink sticky thread.

PDVDLaunchPolicy.exe is what I think will be causing these problems, what happens is the batch file will wait until PDVDLaunchPolicy.exe is ended before moving to the next line (unmounting or closing).

The problem is PDVDLaunchPolicy.exe will end once PowerDVD is launched (PowerDVD12.exe is then used instead) so the batch file will assume to move to the next line thinking that PowerDVD has finished, hence why the ISO is unmounted, or it will reach the end of the batch file then XBMC will think the external player has finished (That's why XBMC comes back up)

Not sure how this can be fixed since this is just how PowerDVD 12 works, it uses PDVDLaunchPolicy.exe to open the other exe files (PowerDVD12.exe etc) once PDVDLaunchPolicy.exe has opened the required exe's it then terminates, this fools the batch file into thinking it can move on to the next line.

If you change PDVDLaunchPolicy.exe to PowerDVD12.exe in the bat file does this fix the unmounting and focus issues?

Does the AUTOPLAY argument work with "PowerDVD12.exe" instead of "PDVDLaunchPolicy.exe"?

Hope you understand what I mean about PDVDLaunchPolicy.exe, it hard to explain Blush

Edit - Has anyone else got PowerDVD 12 working correctly for BD ISO and Folders?

I completely understand what you are saying. I have tried many different solutions, but the issue remains that the PlayISO.bat file completes its execution and when that happens XBMC comes back to the foreground.

If I add a simple PAUSE to the PlayISO.bat file, then everything works fine except for the fact the Pause needs to be cleared to return to XBMC.

I tried to watch the powerdvd12.exe process which launches so that the PlayISO.bat file only continues execution once that program clears from Task Manager, but cannot figure out how to do this.

I have tried START /Wait powerdvd12.exe.

I have also started by unmounting all discs, then launching PowerDVD, keeping its internal setting to autoplay when disc inserted, and everything starts to play in the foreground as long as a timeout or pause is present.

Anyone have a way to watch the processes and only continue the PlayISO.bat file once Powerdvd12.exe has closed? I have seen some references to Tasklist to find the task and PID, but not sure how to watch it and wait.

IF I run this command from a regular windows command line, it launches PowerDVD12, but does not complete the command until PowerDVD12.exe is closed. This would work perfectly as it would pause or suspend the PlayISO.bat file while PowerDVD12.exe was playing a movie and when the movie was completed and PowerDVD closed, it would finish executing the PlayISO.bat file and could even unmounts items and return to XBMC.

start /wait "title" "C:\Program Files (x86)\CyberLink\PowerDVD12\PowerDVD12.exe"

The problem is this command line will not run the same way as described when in a .bat file. In the PlayISO.bat file, it displays the line, but does not wait or launch powerdvd12.exe. From a regular dos prompt it works, from a batch file it does not. Any ideas on how to get this to work via a batch file?


RE: Another External Player Code, but Very Simple to Setup - acejh1987 - 2013-01-15

@ mrh335

You can try something like this after this line
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" AUTOPLAY E:

Code:
:open

tasklist /fi "imagename eq powerdvd12.exe" | find /i "powerdvd12.exe"> NUL
if /i %errorlevel% EQU 0 goto open

This will check if PowerDVD12.exe is running, it will keep checking until it is closed and then continue with the unmounting.

In my testing this is still hit and miss, as PowerDVD12.exe can sometimes take quite a few seconds to actually terminate (even when it looks closed) this causes XBMC to still think external player is active for a few seconds.

To be honest I don't think PowerDVD 12 is really ever going to work perfectly as an external player for BD ISO/ folders, to me it seems very bulky and slow compared to TMT5, even as a standalone player without XBMC, I'm using the trial and not impressed with it at all.


RE: Another External Player Code, but Very Simple to Setup - steelman1991 - 2013-01-15

(2013-01-15, 13:07)acejh1987 Wrote: @ mrh335

You can try something like this after this line
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" AUTOPLAY E:

Code:
:open

tasklist /fi "imagename eq powerdvd12.exe" | find /i "powerdvd12.exe"> NUL
if /i %errorlevel% EQU 0 goto open

This will check if PowerDVD12.exe is running, it will keep checking until it is closed and then continue with the unmounting.

In my testing this is still hit and miss, as PowerDVD12.exe can sometimes take quite a few seconds to actually terminate (even when it looks closed) this causes XBMC to still think external player is active for a few seconds.

To be honest I don't think PowerDVD 12 is really ever going to work perfectly as an external player for BD ISO/ folders, to me it seems very bulky and slow compared to TMT5, even as a standalone player without XBMC, I'm using the trial and not impressed with it at all.

acejh - should your opening line read tasklist/if .................... and not tasklist/fi?



RE: Another External Player Code, but Very Simple to Setup - acejh1987 - 2013-01-15

(2013-01-15, 14:53)steelman1991 Wrote: acejh - should your opening line read tasklist/if .................... and not tasklist/fi?

With the tasklist command /fi is used to filter the process name, in this case powerdvd12.exe




RE: Another External Player Code, but Very Simple to Setup - steelman1991 - 2013-01-15

(2013-01-15, 15:26)acejh1987 Wrote:
(2013-01-15, 14:53)steelman1991 Wrote: acejh - should your opening line read tasklist/if .................... and not tasklist/fi?

With the tasklist command /fi is used to filter the process name, in this case powerdvd12.exe

Knew I should have kept quiet lol sorry. Blush


RE: Another External Player Code, but Very Simple to Setup - voyagerxp - 2013-01-15

Hey i'm new that this and need a bit of help if anyone can offer it. All i want to do is get my htpc to play blu-ray discs from the blu-ray drive in xbmc via play disc on xbmc menu using power dvd 12. Now i've edited a playercorefactory file to work with a playdisc.bat and now when i press play disc power dvd starts up. But how do i get back to xbmc?, after i've pressed stop on power dvd i have to press the x in the corner of power dvd to exit and after that my xbmc stays minimized. Can i get around this?

<playercorefactory>
<players>
<player name="Disc_Player" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Users\steven\AppData\Roaming\XBMC\userdata\PlayDisc.bat</filename>
<args>"{1}"</args>
<hidexbmc>true</hidexbmc>
<hideconsole>true</hideconsole>
<warpcursor>none</warpcursor>
</player>
</players>
<rules action="prepend">
<!-- Bluray Disc -->
<rule player="Disc_Player"/>
</rules>
</playercorefactory>



@echo off
set pth=%1
set pth=%pth:BDMV\index.bdmv=%
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" %pth% exit


RE: Another External Player Code, but Very Simple to Setup - mrh335 - 2013-01-16

(2013-01-15, 13:07)acejh1987 Wrote: @ mrh335

You can try something like this after this line
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" AUTOPLAY E:

Code:
:open

tasklist /fi "imagename eq powerdvd12.exe" | find /i "powerdvd12.exe"> NUL
if /i %errorlevel% EQU 0 goto open

This will check if PowerDVD12.exe is running, it will keep checking until it is closed and then continue with the unmounting.

In my testing this is still hit and miss, as PowerDVD12.exe can sometimes take quite a few seconds to actually terminate (even when it looks closed) this causes XBMC to still think external player is active for a few seconds.

To be honest I don't think PowerDVD 12 is really ever going to work perfectly as an external player for BD ISO/ folders, to me it seems very bulky and slow compared to TMT5, even as a standalone player without XBMC, I'm using the trial and not impressed with it at all.

Thank you for the help on this. I tried tasklist last night unsuccessfully, but tonight with your code, everything works perfectly.

I don't see the lag or issues with PDVD12 on my computer. It is quite powerful and loads things quickly as it has an I7-2600K with 16 GB of ram. Using tasklist to watch active processes is able to keep the PlayISO.bat file open and continually pinging the process list looking for PowerDVD12.exe. As long as that is active, then the batch files stays open. To return to XBMC, a ctrl+X from the keyboard commands closes PDVD12 and returns automatic to XBMC. The continualy polling in the background consumes some cycles, but nothing that seemed to cause any issues. I found the smoothness and fact that PDVD12 just does what it is supposed to to be as fast as TMT5 without the horrible stutter and lack of refresh rate adjustment seen in TMT5.

Another line of code which could be added to the batch file would be the TIMEOUT command if someone had a machine which didn't get PowerDVD12.exe loaded fast enough for the polling to start. In my testing tonight, I didn't need that.

The one thing I would like to try and address is a way to only have Bluray ISO files play via PDVD12 and DVD ISO files to play using the internal player. You provided some insight to that in an earlier post, but I didn't fully understand how to implement.

Below is my working code. I have hideconsole set to false and echo off just so I can see what is going on.

PlayISO.bat:
REM @echo off


"C:\Program Files (x86)\DAEMON Tools Lite\DTLite.exe" -mount dt, 0, %1
"C:\Program Files (x86)\CyberLink\PowerDVD12\PDVDLaunchPolicy.exe" AUTOPLAY E:
rem TIMEOUT /T 10 /NOBREAK

:open

tasklist /fi "imagename eq powerdvd12.exe" | find /i "powerdvd12.exe"> NUL
if /i %errorlevel% EQU 0 goto open

"C:\Program Files (x86)\DAEMON Tools Lite\DTLite.exe" -unmount dt, 0

Playercorefactory.xml
<playercorefactory>
<players>
<player name="ISO_Player" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Users\markr_000\AppData\Roaming\XBMC\userdata\PlayISO.bat</filename>
<args>"{1}" /fullscreen</args>
<hidexbmc>true</hidexbmc>
<hideconsole>false</hideconsole>

</player>
<player name="BDMV_Player" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Users\markr_000\AppData\Roaming\XBMC\userdata\PlayBDMV.bat</filename>
<args>"{1}"</args>
<hidexbmc>false</hidexbmc>

</player>
<player name="Disc_Player" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Users\markr_000\AppData\Roaming\XBMC\userdata\PlayDisc.bat</filename>
<args>"{1}"</args>
<hidexbmc>false</hidexbmc>

</player>
<player name="Universal_Player" type="ExternalPlayer" audio="false" video="true">
<filename>C:\Program Files (x86)\ArcSoft\TotalMedia Theatre 5\uTotalMediaTheatre5.exe</filename>
<args>"{1}"</args>
<hidexbmc>false</hidexbmc>

</player>
</players>
<rules action="prepend">

<rule filetypes="BD|IFO|iso|bdmv|mpls" player="ISO_Player"/>

</rules>
</playercorefactory>