Ticket #7257: pre-post_playback.patch

File pre-post_playback.patch, 3.3 KB (added by Marcus Brown <marcusbrutus@…>, 15 years ago)
  • libs/libmythtv/tv_play.cpp

    diff -ur mythtv.org/libs/libmythtv/tv_play.cpp mythtv/libs/libmythtv/tv_play.cpp
    old new  
    222222    {
    223223        if (curProgram)
    224224        {
     225            /* If PrePlaybackCmd defined then blindly execute prior to starting recording playback */
     226            /* eg: 'lights_dim.sh &' */
     227            /* Append '&' to command to prevent blocking */
     228            QString preplayback_cmd = gContext->GetSetting("PrePlaybackCmd", "");
     229            if (!preplayback_cmd.isEmpty())
     230            {
     231                VERBOSE(VB_PLAYBACK, QString("Executing pre-playback command: " + preplayback_cmd));
     232                myth_system(preplayback_cmd);
     233            }
     234
    225235            VERBOSE(VB_PLAYBACK, LOC + "tv->Playback() -- begin");
    226236            if (!tv->Playback(*curProgram))
    227237                quitAll = true;
     
    229239        }
    230240        else if (RemoteGetFreeRecorderCount())
    231241        {
     242            /* If PrePlaybackCmd defined then blindly execute prior to starting livetv playback */
     243            QString preplayback_cmd = gContext->GetSetting("PrePlaybackCmd", "");
     244            if (!preplayback_cmd.isEmpty())
     245            {
     246                VERBOSE(VB_PLAYBACK, QString("Executing pre-playback command: " + preplayback_cmd));
     247                myth_system(preplayback_cmd);
     248            }
     249
    232250            VERBOSE(VB_PLAYBACK, LOC + "tv->LiveTV() -- begin");
    233251            if (!tv->LiveTV(showDialogs, startInGuide))
    234252            {
     
    10671085    TV::exit(0);
    10681086    TV::wait();
    10691087
     1088    /* If PostPlaybackCmd defined then blindly execute when recording or livetv playback complete */
     1089    /* eg: 'lights_on.sh &' */
     1090    QString postplayback_cmd = gContext->GetSetting("PostPlaybackCmd", "");
     1091    if (!postplayback_cmd.isEmpty())
     1092    {
     1093        VERBOSE(VB_PLAYBACK, QString("Executing post-playback command: " + postplayback_cmd));
     1094        myth_system(postplayback_cmd);
     1095    }
     1096
    10701097    VERBOSE(VB_PLAYBACK, "TV::~TV() -- lock");
    10711098
    10721099    // restore window to gui size and position
  • programs/mythfrontend/main.cpp

    diff -ur mythtv.org/programs/mythfrontend/main.cpp mythtv/programs/mythfrontend/main.cpp
    old new  
    813813        }
    814814    }
    815815
     816    /* If PrePlaybackCmd defined then blindly execute prior to starting video playback */
     817    /* eg: 'lights_dim.sh &' */
     818    /* Append '&' to command to prevent blocking */
     819    QString preplayback_cmd = gContext->GetSetting("PrePlaybackCmd", "");
     820    if (!preplayback_cmd.isEmpty())
     821    {
     822        VERBOSE(VB_PLAYBACK, QString("Executing pre-playback command: " + preplayback_cmd));
     823        myth_system(preplayback_cmd);
     824    }
     825
    816826    TV::StartTV(pginfo);
    817827
     828    /* If PostPlaybackCmd defined then blindly execute when video playback complete */
     829    /* eg: 'lights_on.sh &' */
     830    QString postplayback_cmd = gContext->GetSetting("PostPlaybackCmd", "");
     831    if (!postplayback_cmd.isEmpty())
     832    {
     833        VERBOSE(VB_PLAYBACK, QString("Executing post-playback command: " + postplayback_cmd));
     834        myth_system(postplayback_cmd);
     835    }
     836
    818837    res = 0;
    819838
    820839    sleep(1);