Leapcast (chromecast emu) with MP

Discussion in 'General' started by biohazardxxx, November 24, 2013.

  1. biohazardxxx

    biohazardxxx Portal Pro

    Joined:
    August 5, 2010
    Messages:
    104
    Likes Received:
    7
    Gender:
    Male
    Ratings:
    +12 / 0
    Home Country:
    Germany Germany
    Show System Specs
    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: November 24, 2013
    • Like Like x 2
    • Informative Informative x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. biohazardxxx

    biohazardxxx Portal Pro

    Joined:
    August 5, 2010
    Messages:
    104
    Likes Received:
    7
    Gender:
    Male
    Ratings:
    +12 / 0
    Home Country:
    Germany Germany
    Show System Specs
    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 (Text):
    1.         logging.debug(args)
    2.         self.pid = subprocess.Popen(args)
    (some where at line 31) this line:
    Code (Text):
    1. subprocess.Popen('minimizer MediaPortal* Minimize')
    add after
    Code (Text):
    1. def stop_app(self):
    (somewhere at line 135) this line:
    Code (Text):
    1. 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.
     

    Attached Files:

    Last edited: December 1, 2013
    • Thank You! Thank You! x 3
    • Like Like x 2
  4. ibmonkey
    • Premium Supporter

    ibmonkey MP Donator

    Joined:
    December 1, 2007
    Messages:
    231
    Likes Received:
    29
    Ratings:
    +39 / 0
    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)
     
  5. msj33
    • Premium Supporter

    msj33 MP Donator

    Joined:
    November 30, 2005
    Messages:
    471
    Likes Received:
    41
    Ratings:
    +69 / 3
    Home Country:
    England England
    This is great.........if only netflix worked
     
  6. spokkie_spok

    spokkie_spok Portal Member

    Joined:
    November 12, 2010
    Messages:
    5
    Likes Received:
    0
    Occupation:
    Aircraft Station Engineer B2 (Elektronics)
    Ratings:
    +0 / 0
    Home Country:
    Belgium Belgium
    This sounds great! gonna give it a try this weekend,
     
  7. biohazardxxx

    biohazardxxx Portal Pro

    Joined:
    August 5, 2010
    Messages:
    104
    Likes Received:
    7
    Gender:
    Male
    Ratings:
    +12 / 0
    Home Country:
    Germany Germany
    Show System Specs
  8. spokkie_spok

    spokkie_spok Portal Member

    Joined:
    November 12, 2010
    Messages:
    5
    Likes Received:
    0
    Occupation:
    Aircraft Station Engineer B2 (Elektronics)
    Ratings:
    +0 / 0
    Home Country:
    Belgium Belgium
    Thx mate, works like a charm!


    Greets Spokkie
     
  9. biohazardxxx

    biohazardxxx Portal Pro

    Joined:
    August 5, 2010
    Messages:
    104
    Likes Received:
    7
    Gender:
    Male
    Ratings:
    +12 / 0
    Home Country:
    Germany Germany
    Show System Specs
    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 (Text):
    1. 'Kill leapcast if already running!
    2. Dim objWMIService, colProcessList
    3. Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    4. Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'leapcast.exe' or Name = 'python.exe'")
    5. For Each objProcess in colProcessList
    6.   Return = WshShell.Run("taskkill /PID " & objProcess.ProcessId, 0, True)
    7. 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 ;)
     

    Attached Files:

    • Thank You! Thank You! x 1
  10. 0kk0

    0kk0 Portal Member

    Joined:
    March 28, 2011
    Messages:
    11
    Likes Received:
    13
    Ratings:
    +13 / 0
    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 (Text):
    1. Environment.fullscreen = True
    to

    Code (Text):
    1. if args.fullscreen:
    2.         Environment.fullscreen = False
    and in file: C:\leapcast\leapcast\services\leap_factory.py

    on the end of function

    Code (Text):
    1. def post(self, sec):
    2.         '''Start app'''
    3.        ..
    4.        ..
    5.         self.set_app_status(status)
    6.         self.finish()
    7.  
    add a line:

    Code (Text):
    1. subprocess.Popen('Maximizer')
    And copy Maximizer.exe and Maximizer.exe.config to c:\windows
     

    Attached Files:

    • Maximizer.7z
      File size:
      5.5 KB
      Uploaded:
      February 7, 2014
      Views:
      96
    • Like Like x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!