Ticket #4807: save_last_chan3.diff

File save_last_chan3.diff, 2.3 KB (added by Mark Buechler <Mark.Buechler@…>, 16 years ago)

Updated Patch

  • tv_play.cpp

    old new void TV::HandleStateChange(void) 
    15011501        lockTimerOn = false;
    15021502
    15031503        SET_NEXT();
    1504         recorder->SpawnLiveTV(tvchain->GetID(), false, "");
     1504
     1505        uint chanid = gContext->GetNumSetting("DefaultChanid", 0);
     1506
     1507        if (chanid && !IsTunable(chanid))
     1508            chanid = 0;
     1509
     1510        QString channum = "";
     1511
     1512        if (chanid)
     1513        {
     1514            QStringList reclist;
     1515
     1516            MSqlQuery query(MSqlQuery::InitCon());
     1517            query.prepare("SELECT channum FROM channel "
     1518                          "WHERE chanid = :CHANID");
     1519            query.bindValue(":CHANID", chanid);
     1520            if (query.exec() && query.isActive() && query.size() > 0 && query.next())
     1521                channum = query.value(0).toString();
     1522            else
     1523                channum = QString::number(chanid);
     1524
     1525            bool getit = activerecorder->ShouldSwitchToAnotherCard(
     1526                QString::number(chanid));
     1527
     1528            if (getit)
     1529                reclist = GetValidRecorderList(chanid, channum);
     1530
     1531            if (reclist.size())
     1532            {
     1533                RemoteEncoder *testrec = NULL;
     1534                testrec = RemoteRequestFreeRecorderFromList(reclist);
     1535                if (testrec && testrec->IsValidRecorder())
     1536                {
     1537                    activerecorder = recorder = testrec;
     1538                    activerecorder->Setup();
     1539                }
     1540            }
     1541            else if (getit)
     1542                chanid = 0;
     1543        }
     1544
     1545        if (chanid && !channum.isEmpty())
     1546            recorder->SpawnLiveTV(tvchain->GetID(), false, channum);
     1547        else
     1548            recorder->SpawnLiveTV(tvchain->GetID(), false, "");
    15051549
    15061550        tvchain->ReloadAll();
    15071551
  • NuppelVideoPlayer.cpp

    old new int NuppelVideoPlayer::OpenFile(bool ski 
    11661166
    11671167    bookmarkseek = GetBookmark();
    11681168
     1169    int expire_type = m_playbackinfo->GetAutoExpireFromRecorded();
     1170
     1171    if (expire_type == kLiveTVAutoExpire)
     1172        gContext->SaveSetting("DefaultChanid", m_playbackinfo->chanid);
     1173
    11691174    return IsErrored() ? -1 : 0;
    11701175}
    11711176