Kodi Community Forum
[PATCH] LaunchPlayer - External Video Player Launcher (to launch third-party players) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: [PATCH] LaunchPlayer - External Video Player Launcher (to launch third-party players) (/showthread.php?tid=40136)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Linux and Mac OS X capability/compatibility? - Gamester17 - 2008-12-27

Have anyone tested this on Linux and Mac OS X yet?
...and how much of an 'hack' is this really now? Huh


- Mshake - 2008-12-27

Ok, sorry if this is posted in the wrong forum,

I posted some SMB issues with the external player patch a while ago in this thread.

My issue with SMB/network shares (i wanted to avoid to map them as I swap drives often, mapped drives work fine)
Eternalplayer patch parse the smb url as "smb://server1/share/test.avi" directly to external players but the url is not understood by these external players as in windows the correct url would be "\\server1\share\test.avi"

My quick and dirty solution is as below, feel free to try, no guarantees though, was hoping devs here could give some pointers. Perhaps I have been going about this totally wrong,etc....

General idea: use a script to 'intercept' the url parsed by xbmc to external player to change / replace "smb:" to nothing and "/" to "\", thus resulting in usable media files by your player

End result: I use a python script with a friend's help. (a little cut and paste plus some documentation reading for a fair bit!) to achieve this. Full script below and some mini instructions.

Media Player tested:
1) Tried Media Player Classic - it works but the focus and /fullscreen option somehow does not work or not working well?
2) Tried mplayer/smplayer_portable - it works but there was an issue with the focussing again and i can't be stuffed trying / audio switcher does not really work
3) Tried KMplayer - it works, no issues with focussing, audio switcher works, lots of tweaking options (this may actually discourage people from using this, my personal opinion) - I went with this in the end

Ok now a little instruction:

1) You will need to download python, i used python26

2) Install KMPlayer (I installed mine to root c:\Kmplayer\*.* as there seem to be an issue with the folder names and spacing if i install the player in the default c:\program files\the kmplayer, unsure why...someone with more experience in kmplayer may be of assistance, I believe it's the freaking playlist feature, i tried to disable adding any files to the playlist but I can't)

3) Copy and paste the following lines to a notepad and rename it kmplayer.py. Note that my KMplayer.exe is located C:\KMPlayer\kmplayer.exe and the resulting script is located at c:\

Code:
import os, sys
t = '"'
file = sys.argv[1].replace('smb://','\\\\')
file = t + file.replace('/','\\') + t
os.execl('C:\KMPlayer\kmplayer.exe','C:\KMPLAYER\kmplayer.exe','/fullscreen','/close',file,)

4) Open up your advancedsettings.xml, mine looks like this. Note that for me, python is installed also in root c:\python26\....

Code:
<advancedsettings>
<video>
  <defaultplayer>dvdplayer</defaultplayer>
</video>
<externalplayer>
  <filename>c:\python26\python.exe</filename>
  <args>c:\kmplayer.py</args>    
  <forceontop>false</forceontop>
  <hideconsole>false</hideconsole>
  <hidecursor>false</hidecursor>
</externalplayer>
</advancedsettings>

5) Try the above and hopefully your files over smb network shares would be able to launch. The python script above can also be converted to an executable for those who would prefer a cleaner advancedsettings.xml or for whatever reasons. And I have tested the script for local files as well. If the files are local or on a mapped drive, i.e. no SMB://....., then it will ignore it and your files will still be able to launch fine.

Regarding the mediaplayer, I only tested the 3 above and KMplayer seems to be able to go fullscreen and close when playback finish without hiccups. My personal priority is to get better RV40 and RV30 support through external players. For all my other needs, the internal dvdplayer is DEFINITELY better.

Again, if konfoo can do a patch for the above for SMB urls to external players, then all would be good, network files and all will play fine. Don't think there's many players out there capable of even understanding those SMB urls as there is no smb client build-in?

Hope this works for someone. XBMC jester-externalplayer plus the above work for me, so I am okay for now.

Apologies for the long post.


- Jester - 2008-12-27

Patch updated to work with latest SVN

Upped XBMCSetup-Rev16734-jester-externalplayer.exe


- WiSo - 2008-12-28

Mshake Wrote:Don't think there's many players out there capable of even understanding those SMB urls as there is no smb client build-in?

The external player is a third party patch we don't support but we respect the need for it and the work konfoo and jester put into it.
The smb:// protocol is XBMC's own internal one which ofc only libs compiled for XBMC do understand. It shouldn't be a problem to replace it by \\ but this is also a hack for a hack Cool


- tvont - 2008-12-28

Hi,

I use jesters new build (...734) but (still) experience focus problems with vlc. VLC starts fine with any option while XBMC is in windowed mode. Using it in fullscreen mode leads into a no-video issue....audio plays well.

Does anyone have a hint on that? I need to use vlc because I want to start a UDP stream simultaneously...and I still would be very very (and even more) happy about an OSX build :-)

Thanks,

TvonT


- superludox - 2008-12-28

Mshake Wrote:Ok, sorry if this is posted in the wrong forum,

I posted some SMB issues with the external player patch a while ago in this thread.

My issue with SMB/network shares (i wanted to avoid to map them as I swap drives often, mapped drives work fine)
Eternalplayer patch parse the smb url as "smb://server1/share/test.avi" directly to external players but the url is not understood by these external players as in windows the correct url would be "\\server1\share\test.avi"

My quick and dirty solution is as below, feel free to try, no guarantees though, was hoping devs here could give some pointers. Perhaps I have been going about this totally wrong,etc....

General idea: use a script to 'intercept' the url parsed by xbmc to external player to change / replace "smb:" to nothing and "/" to "\", thus resulting in usable media files by your player

End result: I use a python script with a friend's help. (a little cut and paste plus some documentation reading for a fair bit!) to achieve this. Full script below and some mini instructions.

Media Player tested:
1) Tried Media Player Classic - it works but the focus and /fullscreen option somehow does not work or not working well?
2) Tried mplayer/smplayer_portable - it works but there was an issue with the focussing again and i can't be stuffed trying / audio switcher does not really work
3) Tried KMplayer - it works, no issues with focussing, audio switcher works, lots of tweaking options (this may actually discourage people from using this, my personal opinion) - I went with this in the end

Ok now a little instruction:

1) You will need to download python, i used python26

2) Install KMPlayer (I installed mine to root c:\Kmplayer\*.* as there seem to be an issue with the folder names and spacing if i install the player in the default c:\program files\the kmplayer, unsure why...someone with more experience in kmplayer may be of assistance, I believe it's the freaking playlist feature, i tried to disable adding any files to the playlist but I can't)

3) Copy and paste the following lines to a notepad and rename it kmplayer.py. Note that my KMplayer.exe is located C:\KMPlayer\kmplayer.exe and the resulting script is located at c:\

Code:
import os, sys
t = '"'
file = sys.argv[1].replace('smb://','\\\\')
file = t + file.replace('/','\\') + t
os.execl('C:\KMPlayer\kmplayer.exe','C:\KMPLAYER\kmplayer.exe','/fullscreen','/close',file,)

4) Open up your advancedsettings.xml, mine looks like this. Note that for me, python is installed also in root c:\python26\....

Code:
<advancedsettings>
<video>
  <defaultplayer>dvdplayer</defaultplayer>
</video>
<externalplayer>
  <filename>c:\python26\python.exe</filename>
  <args>c:\kmplayer.py</args>    
  <forceontop>false</forceontop>
  <hideconsole>false</hideconsole>
  <hidecursor>false</hidecursor>
</externalplayer>
</advancedsettings>

5) Try the above and hopefully your files over smb network shares would be able to launch. The python script above can also be converted to an executable for those who would prefer a cleaner advancedsettings.xml or for whatever reasons. And I have tested the script for local files as well. If the files are local or on a mapped drive, i.e. no SMB://....., then it will ignore it and your files will still be able to launch fine.

Regarding the mediaplayer, I only tested the 3 above and KMplayer seems to be able to go fullscreen and close when playback finish without hiccups. My personal priority is to get better RV40 and RV30 support through external players. For all my other needs, the internal dvdplayer is DEFINITELY better.

Again, if konfoo can do a patch for the above for SMB urls to external players, then all would be good, network files and all will play fine. Don't think there's many players out there capable of even understanding those SMB urls as there is no smb client build-in?

Hope this works for someone. XBMC jester-externalplayer plus the above work for me, so I am okay for now.

Apologies for the long post.

Hi,
thanx for this turnaround. Actually, I got "index error" with the .py script !?

file = sys.argv[1].replace('smb://','\\\\')
IndexError: list index out of range

What's wrong Huh?


- RandomXBMCUser - 2008-12-29

tvont Wrote:Hi,

I use jesters new build (...734) but (still) experience focus problems with vlc. VLC starts fine with any option while XBMC is in windowed mode. Using it in fullscreen mode leads into a no-video issue....audio plays well.

Does anyone have a hint on that? I need to use vlc because I want to start a UDP stream simultaneously...and I still would be very very (and even more) happy about an OSX build :-)

Thanks,

TvonT

Have xbmc launch a batch file, and in the batch file put whatever commandline arguments you want (for fullscreen, etc.) and put a %1 at the end so it can get the directory information from whatever calls the batch file.


- Mshake - 2008-12-29

superludox Wrote:Hi,
thanx for this turnaround. Actually, I got "index error" with the .py script !?

file = sys.argv[1].replace('smb://','\\\\')
IndexError: list index out of range

What's wrong Huh?

hmmm...did you test the script in cmd prompt ? If yes, what is your command to launch to the script?

The way i did it was, I opened a cmd prompt, in python26 directory, ran the command below:

Code:
python.exe c:\kmplayer.py "smb:\\server1\share\test.avi"

The index error i believe is concerning the [x] in the sys.argv[x] line above. Make sure there's nothing between c:\kmplayer.py "pathname", if there is, then the [x] would have change accordingly.

Sorry you had the error, I am trying to help but I am also a noob in python so hopefully I am not confusing you as well.

See how you go, let me know if you solved it or still having that error and I can recheck when I get home.


- tvont - 2008-12-29

Hi,

I also do experience some probs with the script.
here is the output

C:\Program Files\python>python c:\python26\vlc.py "o:\cinema\test.avi"
Traceback (most recent call last):
File "c:\python26\vlc.py", line 5, in <module>
os.execl('c:\VLC\vlc.exe''c:\VLC\vlc.exe','--fullscreen',file,)
File "c:\program files\python\lib\os.py", line 296, in execl
execv(file, args)
OSError: [Errno 22] Invalid argument

the script looks like that:

import os, sys
t = '"'
file = sys.argv[1].replace('smb://','\\\\')
file = t + file.replace('/','\\') + t
os.execl('c:\VLC\vlc.exe''c:\VLC\vlc.exe','--fullscreen',file,)

thanks,

TvonT


- Mshake - 2008-12-29

os.execl('c:\VLC\vlc.exe''c:\VLC\vlc.exe','--fullscreen',file,) -> Yours (TvonT)

Erm, I can only see the " and missing a comma ,

os.exec('c:\VLC\vlc.exe','c:\VLC\vlc.exe','--fullscreen',file,) -> Try this??

Try it and see..Hope it's okay.. As I have said, it's definitely a not so elegant job and I did not try VLC so unsure if this helps you or not, if anyone can share a faster and more straightforward way, please do Smile
I was only having problems with the smb:// arguments and the slashes' orientations Smile


- tvont - 2008-12-29

Thanks, -but this was not the error...happened just after too much trial and error...

Any ideas left?

code again:
import os, sys
t = '"'
file = sys.argv[1].replace('smb://','\\\\')
file = t + file.replace('/','\\') + t
os.execl('c:\VLC\vlc.exe','c:\VLC\vlc.exe','--fullscreen',file,)

error again:

C:\Program Files\python>python c:\python26\vlc.py o:\test.avi
Traceback (most recent call last):
File "c:\python26\vlc.py", line 5, in <module>
os.execl('c:\VLC\vlc.exe','c:\VLC\vlc.exe','--fullscreen',file,)
File "c:\program files\python\lib\os.py", line 296, in execl
execv(file, args)
OSError: [Errno 22] Invalid argument

...seems the script expects some args

Thanks,

TvonT


- tvont - 2008-12-29

RandomXBMCUser Wrote:Have xbmc launch a batch file, and in the batch file put whatever commandline arguments you want (for fullscreen, etc.) and put a %1 at the end so it can get the directory information from whatever calls the batch file.

Thanks, randomxbmcuser...but using a batch does not make sense in my case - i want to get rid of the smb "/" problem.


- Mshake - 2008-12-29

Your second error code, unsure if it's simply a " problem or something with copy and paste.

C:\Program Files\python>python c:\python26\vlc.py o:\test.avi-> needs to be "o:\test.avi"

And in your line above, is python installed in Program Files\Python OR c:\Python26Huh? I am confused with your commandline above

Can you try to copy my settings and check back? My settings,
c:\python26 -> python installed here
c:\ -> scripts here
c:\Kmplayer\kmplayer.exe -> installed here

I will also try to install VLC and test from my end later today (after work, in about 10 hours, in the interim I will be online)

Sorry many is having some troubles but like I have mentioned a couple of times, not 100% sure this works for everyone but I am satisfied for now. Still fingers crossed and hoping there would be an internal patch to rectify the smb:// issue Smile


- PantsOnFire - 2008-12-30

Still trying to get LaunchPlayer to work correctly 100%.

I've cleaned XP of any references to xbmc.
Downloaded 16734 Jester - LaunchPlayer. Installed it.

Tried launching MPC, won't go fullscreen no matter what. So I tried with ZoomPlayer.
It's working, but after the video ends and ZoomPlayer closes, focus does not return to XBMC. You can see XBMC but the start bar is in front of it, so any keys you hit mean you are operating windows not XBMC.

I need XBMC to grab focus back. Can anyone help?

I include screenshot to illustrate.

Image

(for the record, this still happens even if I have absolutely no other programs running which could steal focus).


- Mshake - 2008-12-30

I had the same issue
MPC - will not fullscreen no matter what I did. Commandline Mlayerc.exe /fullscreen works fine, just not via the command passed by external launcher

Zoomplayer - I did play around briefly but again there was a focussing issue. In the end I went with kmplayer, all good although u can probably see the splash window closing say 0.10 of a second and you will get xbmc in focus back