Leapcast (chromecast emu) with MP (1 Viewer)

biohazardxxx

Portal Pro
August 5, 2010
104
15
Home Country
Germany Germany
Hi all,

today I could make it to setup leapcast at my HTPC running MediaPortal 1.5 by following the leapcast setup guide. Very cool to beam a YouTube stream to the TV :cool:
Unfortunatly when MP is running in fullscreen and I'm sending a stream to the HTPC the chrome window is started always in background of MP (not visible). While MP is not running or running windowed it starts chrome with focus on top of all other windows.

The "always on top" option in MP is not enabled. Taking a look into the chrome parameters I could not find any for starting on top or with focus.
I'm not sure if this is the right forum but I think so since it is only MP staying on top of the chrome window (also with MP2 it is not an issue).

Does any one have an idea how to fix that?

Regards
Bio
 
Last edited:

biohazardxxx

Portal Pro
August 5, 2010
104
15
Home Country
Germany Germany
Finally I got it working really good with a two additional lines in leapcast source and a help programm to minimize mediaportal and restore it (I know this should be possible inside python but I could not make it work).
Short HowTo:
1. make sure you got leapcast running: https://gist.github.com/eyecatchup/6219118
2. Get my vb.net help tool to change show state of windows and copy the executable to your windows dir
https://dl.dropboxusercontent.com/u/23413755/Minimizer.exe
(The source is in the attachment to self compile)
3. edit file C:\leapcast\leapcast\services\leap_factory.py
add after
Code:
        logging.debug(args)
        self.pid = subprocess.Popen(args)
(some where at line 31) this line:
Code:
subprocess.Popen('minimizer MediaPortal* Minimize')

add after
Code:
def stop_app(self):
(somewhere at line 135) this line:
Code:
subprocess.Popen('minimizer MediaPortal* Restore').wait()

As an alternative replace the file from the attachment (probably it is a good idea to compare with origin file before in case of version changes).
4. in start-leapcast.vbs change
Return = WshShell.Run(Cmd, 7, True)
to
Return = WshShell.Run(Cmd, 0, True)
5. put a shortcut for start-leapcast.vbs into autostart folder in start menu

Hope it helps! let me know if you encounter problems.
 

Attachments

  • Minimizer.zip
    47.7 KB
  • leap_factory.py.txt
    5.7 KB
Last edited:

ibmonkey

MP Donator
  • Premium Supporter
  • December 1, 2007
    231
    43
    Home Country
    United Kingdom United Kingdom
    This looks really interesting, I will have to give this a try when I get some tinkering time.

    I've never wrote one, but I'm wondering if eventually this could all be wrapped up into a MP plugin (with leapcast included)
     

    biohazardxxx

    Portal Pro
    August 5, 2010
    104
    15
    Home Country
    Germany Germany
    Ok I've now have a workaround which make this solution run perfectly :)

    To end orphan processes of leapcast and python before starting add this code to your VBS start script after the line:
    Set WshShell = WScript.CreateObject("WScript.Shell")

    Code:
    'Kill leapcast if already running!
    Dim objWMIService, colProcessList
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'leapcast.exe' or Name = 'python.exe'")
    For Each objProcess in colProcessList
      Return = WshShell.Run("taskkill /PID " & objProcess.ProcessId, 0, True)
    Next

    Then import the attached windows task (change the user after adding!).

    By this a windows task will run the Start.vbs after resuming from Standby.

    Happy casting ;)
     

    Attachments

    • RestartLeapcast.xml
      3.5 KB

    0kk0

    Portal Member
    March 28, 2011
    13
    16
    39
    Home Country
    Netherlands Netherlands
    biohazardxxx, thnx for sharing your stuff!

    I've made a litte .net app for selecting a display chromecast window should start.
    Because in my situation mediaportal starts at secondary monitor..
    So..
    It will start IF mediaportal has started on a location you can change in app.config (in my case my secondary display) else it will start non fullscreen on primary monitor.

    Need to make two changes:

    1) file: C:\leapcast\leapcast\environment.py

    Code:
    Environment.fullscreen = True

    to

    Code:
    if args.fullscreen:
            Environment.fullscreen = False

    and in file: C:\leapcast\leapcast\services\leap_factory.py

    on the end of function

    Code:
    def post(self, sec):
            '''Start app'''
           ..
           ..
            self.set_app_status(status)
            self.finish()

    add a line:

    Code:
    subprocess.Popen('Maximizer')

    And copy Maximizer.exe and Maximizer.exe.config to c:\windows
     

    Attachments

    • Maximizer.7z
      5.5 KB

    Users who are viewing this thread

    Top Bottom