CECRemote [0.9.7] (2 Viewers)

RoChess

Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    How make this automatic?

    When HTPC powers on, and MediaPortal starts it doesn't do this magically.

    Either you're using the MePo option to boot with Windows (which is registry key entry), or you added MediaPortal launch shortcut to the "Startup" folder.

    Adjust either to instead launch a batch-script, or power-shell script or whatever you prefer, and then process whatever you want in there.

    Below is what I do on mine, and where I deal with AmbiBox is where I would deal with other tools as well if I use them, such as devcon for display restarts, dc2 for clone screen adjustments, or synergy commandline launch for complex configurations. At one point I was even sending network messages to let me know HTPC was finished booting, but it boots so quick now that there is no need for such trickery. I'd be happy to share more details on those methods though, but have to dig them up as that was back in 2009/2010 when I used those.

    PS: I'm on an SSD so it only adds like a second to run the entire script.

    Code:
    @Echo Off
    ::
    :: Auto backup/restore MediaPortal databases based on integrity check.
    ::
    :: Author  » RoChess
    :: Updated » July 19th 2013
    ::
    SET BACKUP=AutoBackup
    SET MEPO_PATH=Team MediaPortal\MediaPortal\database
    IF EXIST "%AllUsersProfile%\Application Data\%MEPO_PATH%\*.db3"    SET DB3_PATH=%AllUsersProfile%\Application Data\%MEPO_PATH%
    IF EXIST "%AllUsersProfile%\%MEPO_PATH%\*.db3"            SET DB3_PATH=%AllUsersProfile%\%MEPO_PATH%
    
    taskkill /F /T /IM AmbiBox.exe > nul
    start "AmbiBox" /D "C:\Program Files (x86)\AmbiBox" AmbiBox.exe
    
    IF "%DB3_PATH%"=="" GOTO Error_MePo
    IF NOT EXIST "%~dp0\sqlite3.exe" GOTO Error_SQLite
    
    :: Check to make sure MediaPortal is not still running
    ::
    tasklist | find /i /c "MediaPortal.exe" >nul &&goto MediaPortalRunning
    tasklist | find /i /c "PluginConfigLoader.exe" >nul &&goto MediaPortalRunning
    tasklist | find /i /c "Moving Pictures Config.exe" >nul &&goto MediaPortalRunning
    tasklist | find /i /c "MP-TVSeries-Configuration.exe" >nul &&goto MediaPortalRunning
    
    
    echo Auto Backup/Restore STARTED (%DATE% -- %TIME%) >"%~dpn0.log"
    echo.>>"%~dpn0.log"
    
    CD /D "%DB3_PATH%"
    FOR %%I IN (*.db3) DO (
        CALL:checkSQLite "%%I"
    )
    
    echo.>>"%~dpn0.log"
    echo Auto Backup/Restore FINISHED (%DATE% -- %TIME%) >>"%~dpn0.log"
    
    :LaunchMediaPortal
        :: Locating MediaPortal folder
        ::
        IF EXIST "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
            start "MediaPortal" "%ProgramFiles%\Team MediaPortal\MediaPortal\MediaPortal.exe"
        ) ELSE (
            IF EXIST "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"  (
                start "MediaPortal" "%ProgramFiles(x86)%\Team MediaPortal\MediaPortal\MediaPortal.exe"
            ) ELSE (
                Goto MediaPortalNotFound
            )
        )
    GOTO:EOF
    
    :checkSQLite
        IF %~z1 EQU 0 (
            echo    Aborting: "%~nx1" is ZERO bytes
            echo    Aborting: "%~nx1" is ZERO bytes >>"%~dpn0.log"
            GOTO:EOF
        )
        SET Pass=No
        echo PRAGMA integrity_check; | "%~dp0\sqlite3.exe" "%~dpf1" | find /c "ok" > nul &&SET Pass=Yes
        IF "%Pass%"=="Yes" (
            echo    Updating backup for: "%~nx1"
            echo    Updating backup for: "%~nx1" >>"%~dpn0.log"
            xcopy "%DB3_PATH%\%~nx1" "%DB3_PATH%\%BACKUP%\" /I /C /D /Y /Q >nul
        )
        IF "%Pass%"=="No" (
            echo    ERROR: DATABASE CORRUPT!
            IF NOT EXIST "%DB3_PATH%\%BACKUP%\%~nx1" (
                echo     - No backup exists for: "%~nx1"
                echo     - No backup exists for: "%~nx1" >>"%~dpn0.log"
            )
            IF EXIST "%DB3_PATH%\%BACKUP%\%~nx1" (
                echo     - Restoring last-known good backup for: "%~nx1"
                echo     - Restoring last-known good backup for: "%~nx1" >>"%~dpn0.log"
                xcopy "%DB3_PATH%\%BACKUP%\%~nx1" "%DB3_PATH%\" /I /C /Y /Q >nul
            )
        )
    GOTO:EOF
    
    :MediaPortalRunning
        echo   WARNING: MediaPortal is still running!!
        echo.
        echo     MediaPortal and/or Configuration tools are still active.
        echo     Try it again later, after giving it more time to finish.
    GOTO ErrorDelay
    
    :MediaPortalNotFound
        echo   WARNING: MediaPortal *NOT* Found!!
        echo.
        echo     Unable to locate MediaPortal in the default location.
        echo     Please adjust this script manually to use your custom folder.
    goto ErrorDelay
    
    :Error_MePo
        echo   ABORTING: MediaPortal databases not found
        echo.
        echo     Nothing to do, please verify your MediaPortal installation.
    GOTO ErrorDelay
    
    :Error_SQLite
        echo   ABORTING: SQLite.exe command-line tool missing!
        echo.
        echo     Download binary shell for Windows from: http://www.sqlite.org/download.html
        echo     Unzip and copy sqlite3.exe to:
        echo.
        echo         "%~dp0"
    GOTO ErrorDelay
    
    :ErrorDelay
        echo.
        echo   This window will self-destruct in a few seconds.
        echo.
        ping 1.0 -n 1 -w 5000 > nul
    GOTO:EOF
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,640
    10,576
    Kyiv
    Home Country
    Ukraine Ukraine
    @RoChess
    If I turn on my computer, the Media Portal is loaded, and after a couple of minutes, I turn on the TV, everything is fine, the sound is there, the control is there, no problems.
    But if I specify in HDMI-CEC to turn on the TV, everything is fine, but there is no sound when playing. I think if I set a delay in HDMI-CEC to turn on the TV, everything should be fine. If that doesn't work, then try your solution. :)
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    @RoChess
    If I turn on my computer, the Media Portal is loaded, and after a couple of minutes, I turn on the TV, everything is fine, the sound is there, the control is there, no problems.
    But if I specify in HDMI-CEC to turn on the TV, everything is fine, but there is no sound when playing. I think if I set a delay in HDMI-CEC to turn on the TV, everything should be fine. If that doesn't work, then try your solution. :)

    It can take some trial-and-error indeed to figure out what works.

    TV not being on before HTPC initializes HDMI to seek video and audio sources seems the main issue. Video will always work, because in worst case it will fall back to basic video and then reinitialize itself, but audio is a different beast. That's why I had the suggestion of 'devcon' to force a reinit on the videocard without a full reboot.

    But it might just be a setting on TV to force the auto-healing. On my LG for example I have to force the HDMI input to be a 'PC' (on older TVs the DVI option helps), because the default setting are designed more for a BluRay player, and this causes issues with overscan then.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,640
    10,576
    Kyiv
    Home Country
    Ukraine Ukraine
    It can take some trial-and-error indeed to figure out what works.
    Before that, I turned on the TV by hand, i.e. I turned on the computer, waited until the Media Portal was loaded, turned on the TV, everything was fine.
    Then I decided to turn on the TV via HDMI-CEC, selected TV in the plugin, and now I turn on the computer, while the Media Portal is loading, the TV turns on. When I try to play a movie, there is no sound.
    I.e. the only difference is in the way the TV is turned on (manually or HDMI-CEC) and the difference in the moment of turning on.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,640
    10,576
    Kyiv
    Home Country
    Ukraine Ukraine
    Do we have any developers in this thread? :):coffee::whistle:
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,640
    10,576
    Kyiv
    Home Country
    Ukraine Ukraine
    I'll add a configuration through the settings file, and make a pool requester.
     

    TLD

    Portal Pro
    October 26, 2007
    954
    387
    Rainy Washington
    Home Country
    United States of America United States of America
    I'm thinking about using this method to control MediaPortal.
    Is anybody using this with a newer LG TV?
    If so how is it working?
     

    mrmojo666

    MP Donator
  • Premium Supporter
  • January 24, 2006
    603
    182
    Turin
    Home Country
    Italy Italy
    I'm thinking about using this method to control MediaPortal.
    Is anybody using this with a newer LG TV?
    If so how is it working?
    I've tried the plugin, the plugin is good, the problem with newer tvs is this shitty piece of crap Control your TV from Kodi, or vice versa! USB - CEC Adapter they keep don't upgrade their hw so it's just fatasies that it works with any kind of UHD modern res , bitdepth , even with 1080 with high bitdepth there are problems. I would avoid that HW. If you manage to use this plugin with something else its a great addition.
     

    TLD

    Portal Pro
    October 26, 2007
    954
    387
    Rainy Washington
    Home Country
    United States of America United States of America
    I've tried the plugin, the plugin is good, the problem with newer tvs is this shitty piece of crap Control your TV from Kodi, or vice versa! USB - CEC Adapter they keep don't upgrade their hw so it's just fatasies that it works with any kind of UHD modern res , bitdepth , even with 1080 with high bitdepth there are problems. I would avoid that HW. If you manage to use this plugin with something else its a great addition.
    Well that doesn't sound promising since the first post said that hardware is required, and I view UHD content.
    Is there any other hardware that works?
     

    Users who are viewing this thread

    Top Bottom