Tip - Single seat, wait for services to start before running Mediaportal

Discussion in 'Television (MyTV frontend and TV-Server)' started by dukeelam, March 7, 2007.

  1. dukeelam

    dukeelam Portal Member

    Joined:
    September 30, 2006
    Messages:
    31
    Likes Received:
    6
    Ratings:
    +6 / 0
    Home Country:
    Sweden Sweden
    Using a single seat setup i had problems with Mediaportal autostarting too fast, resulting in it could not find the TV server when entering My TV.
    I had to restart Mediaportal for it to work again, causing some irritation :)

    I made the script below to wait for the SQL and TV services to start before running Mediaportal. Maybe someone else has some use for it also.

    First run Mediaportal setup and uncheck the "Autostart MediaPortal when windows starts" option in "General".

    Use notepad and paste the code below in to it and save as a .cmd file, for instance "startmp.cmd" .
    Copy the script to your Startup folder on the Start menu.

    Important: You have to edit the path between the quotes on the last line to match your Mediaportal installation directory path (Check propertys on your Mediaportal start icon and copy the path from there).




    Code (Text):
    1.  
    2. @echo off
    3. rem script to wait for SQL Server and TV Service to start before running MediaPortal.
    4. echo Waiting for SQL Server to start...
    5. :NOSQL
    6. sc query MSSQL$SQLEXPRESS | FIND "RUNNING"
    7. if errorlevel 1 goto NOSQL
    8. echo.
    9. echo Waiting for TV Service to start...
    10. :NOTVSERICE
    11. sc query TVService | FIND "RUNNING"
    12. if errorlevel 1 goto NOTVSERICE
    13. echo.
    14. echo Starting MediaPortal!
    15. start /D"X:\THE PATH TO YOUR MEDIAPORTAL DIRECTORY" mediaportal.exe
    note by infinityloop
    startup delay feature has been added to mediaportal which should fix this problem ::here::

     
    • Like Like x 5
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. spiderman

    spiderman Portal Member

    Joined:
    July 11, 2006
    Messages:
    28
    Likes Received:
    0
    Location:
    Limburg
    Ratings:
    +0 / 0
    Home Country:
    Netherlands Netherlands
    Hi,

    Thanks a lot for this script.
    It works very good.

    Greatz,
    Spiderman
     
  4. Hetfield

    Hetfield Portal Pro

    Joined:
    March 3, 2007
    Messages:
    69
    Likes Received:
    9
    Ratings:
    +9 / 0
    Home Country:
    Finland Finland
    I have the same problem, and I'll try this trick. But someting like this should be included in MP start up natively...
     
  5. Hetfield

    Hetfield Portal Pro

    Joined:
    March 3, 2007
    Messages:
    69
    Likes Received:
    9
    Ratings:
    +9 / 0
    Home Country:
    Finland Finland
    Works for me, thanks. Here is batch file with some time stamp info for "debugging":

    @echo off

    echo Waiting for SQL Server to start: %date% %time%
    :NOSQL
    sc query MSSQL$SQLEXPRESS | FIND "RUNNING"
    if errorlevel 1 goto NOSQL
    echo SQL Server is running: %date% %time%

    echo Waiting for TV Service to start: %date% %time%
    :NOTVSERICE
    sc query TVService | FIND "RUNNING"
    if errorlevel 1 goto NOTVSERICE
    echo TV Service is running: %date% %time%

    echo Starting MediaPortal: %date% %time%
    start C:\MediaPortal\mediaportal.exe

    echo Waiting Web EPG import to be started: %date% %time%
    ping 1.1.1.1 -n 120 -w 1000 >NULL
    echo Starting to import Web EPG: %date% %time%
    start c:\XMLTV\XMLTV.lnk
     
  6. infinite.loop
    • Premium Supporter

    infinite.loop Retired Team Member

    Joined:
    December 26, 2004
    Messages:
    16,163
    Likes Received:
    3,861
    Gender:
    Male
    Location:
    127.0.0.1
    Ratings:
    +4,154 / 7
    Home Country:
    Austria Austria
    Show System Specs
    "normaly" the TV-Service tries to auto-reconnect to the SQL-Service after a couple of seconds if the SQL-Server is not found.

    does that not work in your case?
     
  7. Hetfield

    Hetfield Portal Pro

    Joined:
    March 3, 2007
    Messages:
    69
    Likes Received:
    9
    Ratings:
    +9 / 0
    Home Country:
    Finland Finland
    No it doesn't. Without this batch hack, TV will never show up before I close MP GUI with CRTL+ALT+DEL and restart it. After restart of GUI (or using this batch file) everything is OK. My quess about the problem is that the TV client has too poor error handling, or MP GUI doesn't handle the client plugin error well enough.

    See also my messages at the end of the following thread: https://forum.team-mediaportal.com/tv_service_doesnt_autostart-t22225.html?p=147120#post147120.

    This thread would maybe have been more correct place to have those writings. But in the other thread you can also find some log files, which hopefully will help you to track the problem.
     
  8. infinite.loop
    • Premium Supporter

    infinite.loop Retired Team Member

    Joined:
    December 26, 2004
    Messages:
    16,163
    Likes Received:
    3,861
    Gender:
    Male
    Location:
    127.0.0.1
    Ratings:
    +4,154 / 7
    Home Country:
    Austria Austria
    Show System Specs
    what do you mean by "MP GUI" ???
    Do you mean MediaPortal?

    what happens when you start the PC and go to "MyTV" ?
     
  9. Hetfield

    Hetfield Portal Pro

    Joined:
    March 3, 2007
    Messages:
    69
    Likes Received:
    9
    Ratings:
    +9 / 0
    Home Country:
    Finland Finland
    I mean MediaPortal.exe. When I start MediaPortal and go to My TV, the TV will never appear. MediaPortal hangs totally and doesn't seem to respond at all. It doesn't help even if I wait 30 min or more. After I once close and restart MediaPortal, everything is OK. You can find logs from the link in my previous post. The batch file in this thread solves the problem.
     
  10. luksmann

    luksmann Portal Pro

    Joined:
    November 10, 2005
    Messages:
    91
    Likes Received:
    2
    Occupation:
    SW/HW Tester
    Ratings:
    +2 / 0
    Home Country:
    Austria Austria
    I've got the same issue, but only after "waking" the htpc from standby. I always have to restart MP in order to get it work.

    When I try to enter MyTV I always get the error message "No TV-Stream found" or "No Audio/Video".
    After restarting everything works correctly...

    Greets, luksmann
     
  11. tourettes
    • Premium Supporter

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    That's a completely different issue.
     
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!