Ticket #6862: 6862-v5.patch

File 6862-v5.patch, 93.8 KB (added by danielk, 14 years ago)

Updated patch

  • libs/libmythtv/recordinglist.h

     
    99// of the list while the linked list erase() is always O(1), but all other
    1010// operations are faster with the deque.
    1111
    12 #define PGLIST_USE_LINKED_LIST
     12//#define PGLIST_USE_LINKED_LIST
    1313
    1414// C++ headers
    1515#ifdef PGLIST_USE_LINKED_LIST
     
    2929// MythTV headers
    3030#include "mythexp.h"
    3131#include "mythdbcon.h"
    32 #include "programinfo.h" // for ProgramDetailList
    3332
     33class RecordingList;
     34MPUBLIC bool LoadFromScheduler(
     35    RecordingList      &destination,
     36    bool               &hasConflicts,
     37    QString             altTable = "",
     38    int                 recordid = -1);
     39
    3440/** \class RecordingList
    3541 *  \brief List of RecordingInfo instances, with helper functions.
    3642 */
     
    4551
    4652    RecordingInfo *operator[](uint index);
    4753    const RecordingInfo *operator[](uint index) const;
    48     bool operator==(const RecordingList &b) const;
    4954
    50     bool FromScheduler(bool    &hasConflicts,
    51                        QString  altTable = "",
    52                        int      recordid = -1);
    53 
    54     bool FromScheduler(void)
    55     {
    56         bool dummyConflicts;
    57         return FromScheduler(dummyConflicts, "", -1);
    58     };
    59 
    60     bool FromProgram(const QString &sql, MSqlBindings &bindings,
    61                      RecordingList &schedList, bool oneChanid = false);
    62 
    63     bool FromProgram(const QString &sql, MSqlBindings &bindings)
    64     {
    65         RecordingList dummySched;
    66         return FromProgram(sql, bindings, dummySched);
    67     }
    68 
    69     bool FromRecorded( bool bDescending, RecordingList *pSchedList);
    70 
    71     bool FromOldRecorded(const QString &sql, MSqlBindings &bindings);
    72 
    73     static bool GetProgramDetailList(
    74         QDateTime         &nextRecordingStart,
    75         bool              *hasConflicts = NULL,
    76         ProgramDetailList *list = NULL);
    77 
    7855    RecordingInfo *take(uint i);
    7956    iterator erase(iterator it);
    8057    void clear(void);
     
    9168    void push_back(RecordingInfo *pginfo) { pglist.push_back(pginfo); }
    9269
    9370    // compatibility with old Q3PtrList
    94     bool isEmpty(void) const { return empty(); }
    95     size_t count(void) const { return size(); }
    96     RecordingInfo *at(uint index) { return (*this)[index]; }
    97     void prepend(RecordingInfo *pginfo) { push_front(pginfo); }
    98     void append(RecordingInfo *pginfo) { push_back(pginfo); }
    9971    void setAutoDelete(bool auto_delete) { autodelete = auto_delete; }
    10072
    10173  protected:
  • libs/libmythtv/programdetail.cpp

     
     1#include "programdetail.h"
     2#include "programlist.h"
     3#include "programinfo.h"
     4
     5bool GetProgramDetailList(
     6    QDateTime &nextRecordingStart, bool *hasConflicts, ProgramDetailList *list)
     7{
     8    nextRecordingStart = QDateTime();
     9
     10    bool dummy;
     11    bool *conflicts = (hasConflicts) ? hasConflicts : &dummy;
     12
     13    ProgramList progList;
     14    if (!LoadFromScheduler(progList, *conflicts))
     15        return false;
     16
     17    // find the earliest scheduled recording
     18    ProgramList::const_iterator it = progList.begin();
     19    for (; it != progList.end(); ++it)
     20    {
     21        if (((*it)->recstatus == rsWillRecord) &&
     22            (nextRecordingStart.isNull() ||
     23             nextRecordingStart > (*it)->recstartts))
     24        {
     25            nextRecordingStart = (*it)->recstartts;
     26        }
     27    }
     28
     29    if (!list)
     30        return true;
     31
     32    // save the details of the earliest recording(s)
     33    for (it = progList.begin(); it != progList.end(); ++it)
     34    {
     35        if (((*it)->recstatus  == rsWillRecord) &&
     36            ((*it)->recstartts == nextRecordingStart))
     37        {
     38            ProgramDetail prog;
     39            prog.channame  = (*it)->channame;
     40            prog.title     = (*it)->title;
     41            prog.subtitle  = (*it)->subtitle;
     42            prog.startTime = (*it)->recstartts;
     43            prog.endTime   = (*it)->recendts;
     44            list->push_back(prog);
     45        }
     46    }
     47
     48    return true;
     49}
  • libs/libmythtv/programdetail.h

     
     1#ifndef _PROGRAM_DETAIL_H_
     2#define _PROGRAM_DETAIL_H_
     3
     4// C++ headers
     5#include <vector>
     6using namespace std;
     7
     8// Qt headers
     9#include <QString>
     10#include <QDateTime>
     11
     12// MythTV headers
     13#include "mythexp.h"
     14
     15class MPUBLIC ProgramDetail
     16{
     17  public:
     18    QString   channame;
     19    QString   title;
     20    QString   subtitle;
     21    QDateTime startTime;
     22    QDateTime endTime;
     23};
     24typedef vector<ProgramDetail> ProgramDetailList;
     25
     26bool GetProgramDetailList(
     27    QDateTime         &nextRecordingStart,
     28    bool              *hasConflicts = NULL,
     29    ProgramDetailList *list = NULL);
     30
     31#endif // _PROGRAM_DETAIL_H_
  • libs/libmythtv/libmythtv.pro

     
    154154HEADERS += transporteditor.h        listingsources.h
    155155HEADERS += myth_imgconvert.h
    156156HEADERS += channelgroup.h           channelgroupsettings.h
    157 HEADERS += recordingrule.h
     157HEADERS += recordingrule.h          programdetail.h
    158158
    159159SOURCES += recordinginfo.cpp        recordinglist.cpp
    160160SOURCES += RingBuffer.cpp           avfringbuffer.cpp
     
    175175SOURCES += transporteditor.cpp
    176176SOURCES += channelgroup.cpp         channelgroupsettings.cpp
    177177SOURCES += myth_imgconvert.cpp
    178 SOURCES += recordingrule.cpp
     178SOURCES += recordingrule.cpp        programdetail.cpp
    179179
    180180# DiSEqC
    181181HEADERS += diseqc.h                 diseqcsettings.h
  • libs/libmythtv/viewschdiff.cpp

     
    397397        }
    398398    }
    399399
    400     recListBefore.FromScheduler(conflictBool);
    401     recListAfter.FromScheduler(conflictBool, altTable, recordid);
     400    LoadFromScheduler(recListBefore, conflictBool);
     401    LoadFromScheduler(recListAfter,  conflictBool, altTable, recordid);
    402402
    403403    recListBefore.sort(comp_recstart_less_than);
    404404    recListAfter.sort(comp_recstart_less_than);
  • libs/libmythtv/recordinginfo.h

     
    2121
    2222class MPUBLIC RecordingInfo : public ProgramInfo
    2323{
     24    friend class RecordingList;
     25
    2426  public:
    2527    RecordingInfo(void) : record(NULL) {}
    2628    RecordingInfo(const RecordingInfo &other) :
    2729        ProgramInfo(other), record(NULL) {}
    2830    RecordingInfo(const ProgramInfo &other) :
    2931        ProgramInfo(other), record(NULL) {}
     32
     33  protected:
     34    RecordingInfo(const MSqlQuery   &query,
     35                  const ProgramList &schedList,
     36                  bool               oneChanid) :
     37        ProgramInfo(query, schedList, oneChanid), record(NULL) {}
     38
     39  public:
    3040    RecordingInfo &operator=(const RecordingInfo &other) {return clone(other);}
    3141    RecordingInfo &operator=(const ProgramInfo &other) { return clone(other); }
    3242
  • libs/libmythtv/tv_play.cpp

     
    76817681    };
    76827682
    76837683    ProgramList progList;
    7684     progList.FromProgram(querystr, bindings);
     7684    ProgramList dummySched;
     7685    LoadFromProgram(progList, querystr, bindings, dummySched, false);
    76857686
    7686     if (progList.isEmpty())
     7687    if (progList.empty())
    76877688    {
    76887689        infoMap["dbstarttime"] = "";
    76897690        return;
     
    1152511526        for (Iprog = progLists.begin(); Iprog != progLists.end(); Iprog++)
    1152611527        {
    1152711528            const ProgramList &plist = *Iprog;
    11528             int progIndex = plist.count();
     11529            uint progIndex = (uint) plist.size();
    1152911530
    1153011531            if (plist[0]->recgroup != currecgroup)
    1153111532            {
  • libs/libmythtv/recordinglist.cpp

     
    44#include "mythcontext.h"
    55#include "mythdb.h"
    66#include "util.h"
    7 #include "recordinginfo.h"
    87#include "recordinglist.h"
     8#include "recordinginfo.h"
    99#include "jobqueue.h"
    1010
    1111RecordingList::~RecordingList(void)
     
    3737    return (*(const_cast<RecordingList*>(this)))[index];
    3838}
    3939
    40 bool RecordingList::operator==(const RecordingList &b) const
    41 {
    42     const_iterator it_a  = pglist.begin();
    43     const_iterator it_b  = b.pglist.begin();
    44     const_iterator end_a = pglist.end();
    45     const_iterator end_b = b.pglist.end();
    46 
    47     for (; it_a != end_a && it_b != end_b; ++it_a, ++it_b)
    48     {
    49         if (*it_a != *it_b)
    50             return false;
    51     }
    52 
    53     return (it_a == end_a) && (it_b == end_b);
    54 }
    55 
    5640RecordingInfo *RecordingList::take(uint index)
    5741{
    5842#ifndef PGLIST_USE_LINKED_LIST
     
    11296#endif
    11397}
    11498
    115 bool RecordingList::FromScheduler(bool &hasConflicts, QString tmptable,
    116                                 int recordid)
     99bool LoadFromScheduler(
     100    RecordingList &destination, bool &hasConflicts,
     101    QString tmptable, int recordid)
    117102{
    118     clear();
     103    destination.clear();
    119104    hasConflicts = false;
    120105
    121106    if (gContext->IsBackend())
    122107        return false;
    123108
    124109    QString query;
    125     if (tmptable != "")
     110    if (!tmptable.isEmpty())
    126111    {
    127112        query = QString("QUERY_GETALLPENDING %1 %2")
    128                         .arg(tmptable).arg(recordid);
    129     } else {
     113            .arg(tmptable).arg(recordid);
     114    }
     115    else
     116    {
    130117        query = QString("QUERY_GETALLPENDING");
    131118    }
    132119
     
    134121    if (!gContext->SendReceiveStringList(slist) || slist.size() < 2)
    135122    {
    136123        VERBOSE(VB_IMPORTANT,
    137                 "RecordingList::FromScheduler(): Error querying master.");
     124                "LoadFromScheduler(): Error querying master.");
    138125        return false;
    139126    }
    140127
     
    148135        RecordingInfo *p = new RecordingInfo();
    149136        result = p->FromStringList(sit, slist.end());
    150137        if (result)
    151             pglist.push_back(p);
     138            destination.push_back(p);
    152139        else
    153140            delete p;
    154141    }
    155142
    156     if (pglist.size() != slist[1].toUInt())
     143    if (destination.size() != slist[1].toUInt())
    157144    {
    158145        VERBOSE(VB_IMPORTANT,
    159                 "RecordingList::FromScheduler(): Length mismatch");
    160         clear();
     146                "LoadFromScheduler(): Length mismatch.");
     147        destination.clear();
    161148        result = false;
    162149    }
    163150
    164151    return result;
    165152}
    166 
    167 bool RecordingList::FromProgram(const QString &sql, MSqlBindings &bindings,
    168                               RecordingList &schedList, bool oneChanid)
    169 {
    170     clear();
    171 
    172     QString querystr = QString(
    173         "SELECT DISTINCT program.chanid, program.starttime, program.endtime, "
    174         "    program.title, program.subtitle, program.description, "
    175         "    program.category, channel.channum, channel.callsign, "
    176         "    channel.name, program.previouslyshown, channel.commmethod, "
    177         "    channel.outputfilters, program.seriesid, program.programid, "
    178         "    program.airdate, program.stars, program.originalairdate, "
    179         "    program.category_type, oldrecstatus.recordid, "
    180         "    oldrecstatus.rectype, oldrecstatus.recstatus, "
    181         "    oldrecstatus.findid "
    182         "FROM program "
    183         "LEFT JOIN channel ON program.chanid = channel.chanid "
    184         "LEFT JOIN oldrecorded AS oldrecstatus ON "
    185         "    program.title = oldrecstatus.title AND "
    186         "    channel.callsign = oldrecstatus.station AND "
    187         "    program.starttime = oldrecstatus.starttime "
    188         ) + sql;
    189 
    190     if (!sql.contains(" GROUP BY "))
    191         querystr += " GROUP BY program.starttime, channel.channum, "
    192             "  channel.callsign, program.title ";
    193     if (!sql.contains(" ORDER BY "))
    194     {
    195         querystr += " ORDER BY program.starttime, ";
    196         QString chanorder = gContext->GetSetting("ChannelOrdering", "channum");
    197         if (chanorder != "channum")
    198             querystr += chanorder + " ";
    199         else // approximation which the DB can handle
    200             querystr += "atsc_major_chan,atsc_minor_chan,channum,callsign ";
    201     }
    202     if (!sql.contains(" LIMIT "))
    203         querystr += " LIMIT 20000 ";
    204 
    205     MSqlQuery query(MSqlQuery::InitCon());
    206     query.prepare(querystr);
    207     MSqlBindings::const_iterator it;
    208     for (it = bindings.begin(); it != bindings.end(); ++it)
    209         if (querystr.contains(it.key()))
    210             query.bindValue(it.key(), it.value());
    211 
    212     if (!query.exec())
    213     {
    214         MythDB::DBError("RecordingList::FromProgram", query);
    215         return false;
    216     }
    217 
    218     while (query.next())
    219     {
    220         RecordingInfo *p = new RecordingInfo;
    221         p->chanid = query.value(0).toString();
    222         p->startts = QDateTime::fromString(query.value(1).toString(),
    223                                            Qt::ISODate);
    224         p->endts = QDateTime::fromString(query.value(2).toString(),
    225                                          Qt::ISODate);
    226         p->recstartts = p->startts;
    227         p->recendts = p->endts;
    228         p->lastmodified = p->startts;
    229         p->title = query.value(3).toString();
    230         p->subtitle = query.value(4).toString();
    231         p->description = query.value(5).toString();
    232         p->category = query.value(6).toString();
    233         p->chanstr = query.value(7).toString();
    234         p->chansign = query.value(8).toString();
    235         p->channame = query.value(9).toString();
    236         p->repeat = query.value(10).toInt();
    237         p->chancommfree = COMM_DETECT_COMMFREE == query.value(11).toInt();
    238         p->chanOutputFilters = query.value(12).toString();
    239         p->seriesid = query.value(13).toString();
    240         p->programid = query.value(14).toString();
    241         p->year = query.value(15).toString();
    242         p->stars = query.value(16).toString().toFloat();
    243 
    244         if (query.value(17).isNull() || query.value(17).toString().isEmpty())
    245         {
    246             p->originalAirDate = QDate (0, 1, 1);
    247             p->hasAirDate = false;
    248         }
    249         else
    250         {
    251             p->originalAirDate =
    252                 QDate::fromString(query.value(17).toString(),Qt::ISODate);
    253 
    254             if (p->originalAirDate > QDate(1940, 1, 1))
    255                 p->hasAirDate = true;
    256             else
    257                 p->hasAirDate = false;
    258         }
    259         p->catType = query.value(18).toString();
    260         p->recordid = query.value(19).toInt();
    261         p->rectype = RecordingType(query.value(20).toInt());
    262         p->recstatus = RecStatusType(query.value(21).toInt());
    263         p->findid = query.value(22).toInt();
    264 
    265         iterator it = schedList.pglist.begin();
    266         for (; it != schedList.pglist.end(); ++it)
    267         {
    268             RecordingInfo *s = *it;
    269             if (p->IsSameTimeslot(*s))
    270             {
    271                 p->recordid = s->recordid;
    272                 p->recstatus = s->recstatus;
    273                 p->rectype = s->rectype;
    274                 p->recpriority = s->recpriority;
    275                 p->recstartts = s->recstartts;
    276                 p->recendts = s->recendts;
    277                 p->cardid = s->cardid;
    278                 p->inputid = s->inputid;
    279                 p->dupin = s->dupin;
    280                 p->dupmethod = s->dupmethod;
    281                 p->findid = s->findid;
    282 
    283                 if (s->recstatus == rsWillRecord ||
    284                     s->recstatus == rsRecording)
    285                 {
    286                     if (oneChanid)
    287                     {
    288                         p->chanid   = s->chanid;
    289                         p->chanstr  = s->chanstr;
    290                         p->chansign = s->chansign;
    291                         p->channame = s->channame;
    292                     }
    293                     else if ((p->chanid != s->chanid) &&
    294                              (p->chanstr != s->chanstr))
    295                     {
    296                         p->recstatus = rsOtherShowing;
    297                     }
    298                 }
    299             }
    300         }
    301 
    302         pglist.push_back(p);
    303     }
    304 
    305     return true;
    306 }
    307 
    308 bool RecordingList::FromRecorded( bool bDescending, RecordingList *pSchedList )
    309 {
    310     clear();
    311 
    312     QString     fs_db_name = "";
    313     QDateTime   rectime    = QDateTime::currentDateTime().addSecs(
    314                               -gContext->GetNumSetting("RecordOverTime"));
    315 
    316     QString ip        = gContext->GetSetting("BackendServerIP");
    317     QString port      = gContext->GetSetting("BackendServerPort");
    318 
    319     // ----------------------------------------------------------------------
    320 
    321     QMap<QString, int> inUseMap;
    322 
    323     QString     inUseKey;
    324     QString     inUseForWhat;
    325     QDateTime   oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
    326 
    327     MSqlQuery   query(MSqlQuery::InitCon());
    328 
    329     query.prepare("SELECT DISTINCT chanid, starttime, recusage "
    330                   " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;");
    331     query.bindValue(":ONEHOURAGO", oneHourAgo);
    332 
    333     if (query.exec())
    334     {
    335         while (query.next())
    336         {
    337             inUseKey = query.value(0).toString() + " " +
    338                        query.value(1).toDateTime().toString(Qt::ISODate);
    339             inUseForWhat = query.value(2).toString();
    340 
    341             if (!inUseMap.contains(inUseKey))
    342                 inUseMap[inUseKey] = 0;
    343 
    344             if ((inUseForWhat == "player") ||
    345                 (inUseForWhat == "preview player") ||
    346                 (inUseForWhat == "PIP player"))
    347                 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSEPLAYING;
    348             else if (inUseForWhat == "recorder")
    349                 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING;
    350         }
    351     }
    352 
    353     // ----------------------------------------------------------------------
    354 
    355     QMap<QString,bool> is_job_running;
    356     query.prepare("SELECT chanid, starttime, status FROM jobqueue "
    357                   "WHERE type = :TYPE");
    358     query.bindValue(":TYPE", JOB_COMMFLAG);
    359     if (query.exec())
    360     {
    361         while (query.next())
    362         {
    363             uint      chanid     = query.value(0).toUInt();
    364             QDateTime recstartts = query.value(1).toDateTime();
    365             int       tmpStatus  = query.value(2).toInt();
    366             if ((tmpStatus != JOB_UNKNOWN) &&
    367                 (tmpStatus != JOB_QUEUED) &&
    368                 (!(tmpStatus & JOB_DONE)))
    369             {
    370                 is_job_running[
    371                     QString("%1###%2")
    372                     .arg(chanid).arg(recstartts.toString())] = true;
    373             }
    374         }
    375     }
    376 
    377     // ----------------------------------------------------------------------
    378 
    379     QString thequery =
    380         "SELECT recorded.chanid,recorded.starttime,recorded.endtime,"
    381         "recorded.title,recorded.subtitle,recorded.description,"
    382         "recorded.hostname,channum,name,callsign,commflagged,cutlist,"
    383         "recorded.autoexpire,editing,bookmark,recorded.category,"
    384         "recorded.recgroup,record.dupin,record.dupmethod,"
    385         "record.recordid,outputfilters,"
    386         "recorded.seriesid,recorded.programid,recorded.filesize, "
    387         "recorded.lastmodified, recorded.findid, "
    388         "recorded.originalairdate, recorded.playgroup, "
    389         "recorded.basename, recorded.progstart, "
    390         "recorded.progend, recorded.stars, "
    391         "recordedprogram.audioprop+0, recordedprogram.videoprop+0, "
    392         "recordedprogram.subtitletypes+0, recorded.watched, "
    393         "recorded.storagegroup "
    394         "FROM recorded "
    395         "LEFT JOIN record ON recorded.recordid = record.recordid "
    396         "LEFT JOIN channel ON recorded.chanid = channel.chanid "
    397         "LEFT JOIN recordedprogram ON "
    398         " ( recorded.chanid    = recordedprogram.chanid AND "
    399         "   recorded.progstart = recordedprogram.starttime ) "
    400         "WHERE ( recorded.deletepending = 0 OR "
    401         "        recorded.lastmodified <= DATE_SUB(NOW(), INTERVAL 5 MINUTE) "
    402         "      ) "
    403         "ORDER BY recorded.starttime";
    404 
    405     if ( bDescending )
    406         thequery += " DESC";
    407 
    408     QString chanorder = gContext->GetSetting("ChannelOrdering", "channum");
    409     if (chanorder != "channum")
    410         thequery += ", " + chanorder;
    411     else // approximation which the DB can handle
    412         thequery += ",atsc_major_chan,atsc_minor_chan,channum,callsign";
    413 
    414     query.prepare(thequery);
    415 
    416     if (!query.exec())
    417     {
    418         MythDB::DBError("RecordingList::FromRecorded", query);
    419         return true;
    420     }
    421 
    422     while (query.next())
    423     {
    424         RecordingInfo *proginfo = new RecordingInfo;
    425 
    426         proginfo->chanid        = query.value(0).toString();
    427         proginfo->startts       = query.value(29).toDateTime();
    428         proginfo->endts         = query.value(30).toDateTime();
    429         proginfo->recstartts    = query.value(1).toDateTime();
    430         proginfo->recendts      = query.value(2).toDateTime();
    431         proginfo->title         = query.value(3).toString();
    432         proginfo->subtitle      = query.value(4).toString();
    433         proginfo->description   = query.value(5).toString();
    434         proginfo->hostname      = query.value(6).toString();
    435 
    436         proginfo->dupin         = RecordingDupInType(query.value(17).toInt());
    437         proginfo->dupmethod     = RecordingDupMethodType(query.value(18).toInt());
    438         proginfo->recordid      = query.value(19).toInt();
    439         proginfo->chanOutputFilters = query.value(20).toString();
    440         proginfo->seriesid      = query.value(21).toString();
    441         proginfo->programid     = query.value(22).toString();
    442         proginfo->filesize      = stringToLongLong(query.value(23).toString());
    443         proginfo->lastmodified  = QDateTime::fromString(query.value(24).toString(), Qt::ISODate);
    444         proginfo->findid        = query.value(25).toInt();
    445 
    446         if (query.value(26).isNull() ||
    447             query.value(26).toString().isEmpty())
    448         {
    449             proginfo->originalAirDate = QDate (0, 1, 1);
    450             proginfo->hasAirDate      = false;
    451         }
    452         else
    453         {
    454             proginfo->originalAirDate =
    455                 QDate::fromString(query.value(26).toString(),Qt::ISODate);
    456 
    457             if (proginfo->originalAirDate > QDate(1940, 1, 1))
    458                 proginfo->hasAirDate  = true;
    459             else
    460                 proginfo->hasAirDate  = false;
    461         }
    462 
    463         proginfo->pathname = query.value(28).toString();
    464 
    465 
    466         if (proginfo->hostname.isEmpty() || proginfo->hostname.isNull())
    467             proginfo->hostname = gContext->GetHostName();
    468 
    469         if (!query.value(7).toString().isEmpty())
    470         {
    471             proginfo->chanstr  = query.value(7).toString();
    472             proginfo->channame = query.value(8).toString();
    473             proginfo->chansign = query.value(9).toString();
    474         }
    475         else
    476         {
    477             proginfo->chanstr  = "#" + proginfo->chanid;
    478             proginfo->channame = "#" + proginfo->chanid;
    479             proginfo->chansign = "#" + proginfo->chanid;
    480         }
    481 
    482         int flags = 0;
    483 
    484         flags |= (query.value(10).toInt() == 1)           ? FL_COMMFLAG : 0;
    485         flags |= (query.value(11).toInt() == 1)           ? FL_CUTLIST  : 0;
    486         flags |=  query.value(12).toInt()                 ? FL_AUTOEXP  : 0;
    487         flags |= (query.value(14).toInt() == 1)           ? FL_BOOKMARK : 0;
    488         flags |= (query.value(35).toInt() == 1)           ? FL_WATCHED  : 0;
    489 
    490         inUseKey = query.value(0).toString() + " " +
    491             query.value(1).toDateTime().toString(Qt::ISODate);
    492 
    493         if (inUseMap.contains(inUseKey))
    494             flags |= inUseMap[inUseKey];
    495 
    496         if (query.value(13).toInt())
    497         {
    498             flags |= FL_EDITING;
    499         }
    500         else if (query.value(10).toInt() == COMM_FLAG_PROCESSING)
    501         {
    502             bool running =
    503                 is_job_running.find(
    504                     QString("%1###%2")
    505                     .arg(proginfo->chanid)
    506                     .arg(proginfo->recstartts.toString())) !=
    507                 is_job_running.end();
    508             if (running)
    509                 flags |= FL_EDITING;
    510             else
    511                 proginfo->SetCommFlagged(COMM_FLAG_NOT_FLAGGED);
    512         }
    513 
    514         proginfo->programflags = flags;
    515 
    516         proginfo->audioproperties = query.value(32).toInt();
    517         proginfo->videoproperties = query.value(33).toInt();
    518         proginfo->subtitleType = query.value(34).toInt();
    519 
    520         proginfo->category     = query.value(15).toString();
    521         proginfo->recgroup     = query.value(16).toString();
    522         proginfo->playgroup    = query.value(27).toString();
    523         proginfo->storagegroup = query.value(36).toString();
    524         proginfo->recstatus    = rsRecorded;
    525 
    526         if ((pSchedList != NULL) && (proginfo->recendts > rectime))
    527         {
    528             iterator it = pSchedList->pglist.begin();
    529             for (; it != pSchedList->pglist.end(); ++it)
    530             {
    531                 ProgramInfo *s = *it;
    532                 if (s && s->recstatus    == rsRecording &&
    533                     proginfo->chanid     == s->chanid   &&
    534                     proginfo->recstartts == s->recstartts)
    535                 {
    536                     proginfo->recstatus = rsRecording;
    537                     break;
    538                 }
    539             }
    540         }
    541 
    542         proginfo->stars = query.value(31).toDouble();
    543 
    544         pglist.push_back(proginfo);
    545     }
    546 
    547     return true;
    548 }
    549 
    550 
    551 bool RecordingList::FromOldRecorded(const QString &sql, MSqlBindings &bindings)
    552 {
    553     clear();
    554     MSqlQuery query(MSqlQuery::InitCon());
    555 
    556     query.prepare("SELECT oldrecorded.chanid, starttime, endtime, "
    557                   " title, subtitle, description, category, seriesid, "
    558                   " programid, channel.channum, channel.callsign, "
    559                   " channel.name, findid, rectype, recstatus, recordid, "
    560                   " duplicate "
    561                   " FROM oldrecorded "
    562                   " LEFT JOIN channel ON oldrecorded.chanid = channel.chanid "
    563                   + sql);
    564     query.bindValues(bindings);
    565 
    566     if (!query.exec() || !query.isActive())
    567     {
    568         MythDB::DBError("RecordingList::FromOldRecorded", query);
    569         return false;
    570     }
    571 
    572     while (query.next())
    573     {
    574         RecordingInfo *p = new RecordingInfo;
    575         p->chanid = query.value(0).toString();
    576         p->startts = QDateTime::fromString(query.value(1).toString(),
    577                                            Qt::ISODate);
    578         p->endts = QDateTime::fromString(query.value(2).toString(),
    579                                          Qt::ISODate);
    580         p->recstartts = p->startts;
    581         p->recendts = p->endts;
    582         p->lastmodified = p->startts;
    583         p->title = query.value(3).toString();
    584         p->subtitle = query.value(4).toString();
    585         p->description = query.value(5).toString();
    586         p->category = query.value(6).toString();
    587         p->seriesid = query.value(7).toString();
    588         p->programid = query.value(8).toString();
    589         p->chanstr = query.value(9).toString();
    590         p->chansign = query.value(10).toString();
    591         p->channame = query.value(11).toString();
    592         p->findid = query.value(12).toInt();
    593         p->rectype = RecordingType(query.value(13).toInt());
    594         p->recstatus = RecStatusType(query.value(14).toInt());
    595         p->recordid = query.value(15).toInt();
    596         p->duplicate = query.value(16).toInt();
    597 
    598         pglist.push_back(p);
    599     }
    600 
    601     return true;
    602 }
    603 
    604 bool RecordingList::GetProgramDetailList(
    605     QDateTime &nextRecordingStart, bool *hasConflicts, ProgramDetailList *list)
    606 {
    607     nextRecordingStart = QDateTime();
    608 
    609     bool dummy;
    610     bool *conflicts = (hasConflicts) ? hasConflicts : &dummy;
    611 
    612     RecordingList progList;
    613     if (!progList.FromScheduler(*conflicts))
    614         return false;
    615 
    616     // find the earliest scheduled recording
    617     RecordingList::const_iterator it = progList.begin();
    618     for (; it != progList.end(); ++it)
    619     {
    620         if (((*it)->recstatus == rsWillRecord) &&
    621             (nextRecordingStart.isNull() ||
    622              nextRecordingStart > (*it)->recstartts))
    623         {
    624             nextRecordingStart = (*it)->recstartts;
    625         }
    626     }
    627 
    628     if (!list)
    629         return true;
    630 
    631     // save the details of the earliest recording(s)
    632     for (it = progList.begin(); it != progList.end(); ++it)
    633     {
    634         if (((*it)->recstatus  == rsWillRecord) &&
    635             ((*it)->recstartts == nextRecordingStart))
    636         {
    637             ProgramDetail prog;
    638             prog.channame  = (*it)->channame;
    639             prog.title     = (*it)->title;
    640             prog.subtitle  = (*it)->subtitle;
    641             prog.startTime = (*it)->recstartts;
    642             prog.endTime   = (*it)->recendts;
    643             list->push_back(prog);
    644         }
    645     }
    646 
    647     return true;
    648 }
  • libs/libmyth/programinfo.h

     
    213213 *  view or record.
    214214 */
    215215
     216class MSqlQuery;
     217class ProgramList;
     218
    216219class MPUBLIC ProgramInfo
    217220{
     221    friend class ProgramList;
     222
    218223  public:
    219     // Constructors and bulk set methods.
     224    // Constructors
    220225    ProgramInfo(void);
    221226    ProgramInfo(const ProgramInfo &other);
     227    ProgramInfo(const MSqlQuery   &query,
     228                const ProgramList &schedList,
     229                bool               oneChanid);
     230    // Bulk set methods
     231  public:
    222232
    223233    typedef enum {
    224234        kNoProgram           = 0,
     
    462472
    463473Q_DECLARE_METATYPE(ProgramInfo*)
    464474
    465 class MPUBLIC ProgramDetail
    466 {
    467   public:
    468     QString   channame;
    469     QString   title;
    470     QString   subtitle;
    471     QDateTime startTime;
    472     QDateTime endTime;
    473 };
    474 typedef vector<ProgramDetail> ProgramDetailList;
    475 
    476475#endif // MYTHPROGRAM_H_
    477476
    478477/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • libs/libmyth/programlist.h

     
    99// of the list while the linked list erase() is always O(1), but all other
    1010// operations are faster with the deque.
    1111
    12 #define PGLIST_USE_LINKED_LIST
     12//#define PGLIST_USE_LINKED_LIST
    1313
    1414// C++ headers
    1515#ifdef PGLIST_USE_LINKED_LIST
     
    2929// MythTV headers
    3030#include "mythexp.h"
    3131#include "mythdbcon.h"
    32 #include "programinfo.h" // for ProgramDetailList
    3332
     33class ProgramList;
     34MPUBLIC bool LoadFromProgram(
     35    ProgramList        &destination,
     36    const QString      &sql,
     37    const MSqlBindings &bindings,
     38    const ProgramList  &schedList,
     39    bool                oneChanid);
     40
     41
     42MPUBLIC bool LoadFromOldRecorded(
     43    ProgramList        &destination,
     44    const QString      &sql,
     45    const MSqlBindings &bindings);
     46
     47MPUBLIC bool LoadFromRecorded(
     48    ProgramList        &destination,
     49    bool                orderDescending,
     50    bool                possiblyInProgressRecordingsOnly,
     51    const ProgramList  &schedList);
     52
     53MPUBLIC bool LoadFromScheduler(
     54    ProgramList        &destination,
     55    bool               &hasConflicts,
     56    QString             altTable = "",
     57    int                 recordid = -1);
     58
     59MPUBLIC bool LoadFromScheduler(ProgramList &destination);
     60
    3461/** \class ProgramList
    3562 *  \brief List of ProgramInfo instances, with helper functions.
    3663 */
    3764class MPUBLIC ProgramList
    3865{
     66    friend class RecordingList;
    3967  public:
    4068    ProgramList(bool auto_delete = true) : autodelete(auto_delete) {}
    4169    ~ProgramList();
     
    4573
    4674    ProgramInfo *operator[](uint index);
    4775    const ProgramInfo *operator[](uint index) const;
    48     bool operator==(const ProgramList &b) const;
    4976
    50     bool FromScheduler(bool    &hasConflicts,
    51                        QString  altTable = "",
    52                        int      recordid = -1);
    53 
    54     bool FromScheduler(void)
    55     {
    56         bool dummyConflicts;
    57         return FromScheduler(dummyConflicts, "", -1);
    58     };
    59 
    60     bool FromProgram(const QString &sql, MSqlBindings &bindings,
    61                      ProgramList &schedList, bool oneChanid = false);
    62 
    63     bool FromProgram(const QString &sql, MSqlBindings &bindings)
    64     {
    65         ProgramList dummySched;
    66         return FromProgram(sql, bindings, dummySched);
    67     }
    68 
    69     bool FromRecorded( bool bDescending, ProgramList *pSchedList);
    70 
    71     bool FromOldRecorded(const QString &sql, MSqlBindings &bindings);
    72 
    73     static bool GetProgramDetailList(
    74         QDateTime         &nextRecordingStart,
    75         bool              *hasConflicts = NULL,
    76         ProgramDetailList *list = NULL);
    77 
    7877    ProgramInfo *take(uint i);
    7978    iterator erase(iterator it);
    8079    void clear(void);
     
    9190    void push_back(ProgramInfo *pginfo) { pglist.push_back(pginfo); }
    9291
    9392    // compatibility with old Q3PtrList
    94     bool isEmpty(void) const { return empty(); }
    95     size_t count(void) const { return size(); }
    96     ProgramInfo *at(uint index) { return (*this)[index]; }
    97     void prepend(ProgramInfo *pginfo) { push_front(pginfo); }
    98     void append(ProgramInfo *pginfo) { push_back(pginfo); }
    9993    void setAutoDelete(bool auto_delete) { autodelete = auto_delete; }
    10094
    10195  protected:
  • libs/libmyth/programinfo.cpp

     
    224224{
    225225}
    226226
     227ProgramInfo::ProgramInfo(
     228    const MSqlQuery &query, const ProgramList &schedList, bool oneChanid)
     229{
     230    if (!query.isValid())
     231    {
     232        ProgramInfo blank;
     233        *this = blank;
     234    }
     235
     236    chanid = query.value(0).toString();
     237    startts = QDateTime::fromString(query.value(1).toString(),
     238                                    Qt::ISODate);
     239    endts = QDateTime::fromString(query.value(2).toString(),
     240                                  Qt::ISODate);
     241    recstartts = startts;
     242    recendts = endts;
     243    lastmodified = startts;
     244    title = query.value(3).toString();
     245    subtitle = query.value(4).toString();
     246    description = query.value(5).toString();
     247    category = query.value(6).toString();
     248    chanstr = query.value(7).toString();
     249    chansign = query.value(8).toString();
     250    channame = query.value(9).toString();
     251    repeat = query.value(10).toInt();
     252    chancommfree = COMM_DETECT_COMMFREE == query.value(11).toInt();
     253    chanOutputFilters = query.value(12).toString();
     254    seriesid = query.value(13).toString();
     255    programid = query.value(14).toString();
     256    year = query.value(15).toString();
     257    stars = query.value(16).toString().toFloat();
     258
     259    if (query.value(17).isNull() || query.value(17).toString().isEmpty())
     260    {
     261        originalAirDate = QDate (0, 1, 1);
     262        hasAirDate = false;
     263    }
     264    else
     265    {
     266        originalAirDate =
     267            QDate::fromString(query.value(17).toString(),Qt::ISODate);
     268
     269        if (originalAirDate > QDate(1940, 1, 1))
     270            hasAirDate = true;
     271        else
     272            hasAirDate = false;
     273    }
     274    catType = query.value(18).toString();
     275    recordid = query.value(19).toInt();
     276    rectype = RecordingType(query.value(20).toInt());
     277    recstatus = RecStatusType(query.value(21).toInt());
     278    findid = query.value(22).toInt();
     279
     280
     281    ProgramList::const_iterator it = schedList.begin();
     282    for (; it != schedList.end(); ++it)
     283    {
     284        if (!IsSameTimeslot(**it))
     285            continue;
     286
     287        const ProgramInfo &s = **it;
     288        recordid    = s.recordid;
     289        recstatus   = s.recstatus;
     290        rectype     = s.rectype;
     291        recpriority = s.recpriority;
     292        recstartts  = s.recstartts;
     293        recendts    = s.recendts;
     294        cardid      = s.cardid;
     295        inputid     = s.inputid;
     296        dupin       = s.dupin;
     297        dupmethod   = s.dupmethod;
     298        findid      = s.findid;
     299
     300        if (s.recstatus == rsWillRecord || s.recstatus == rsRecording)
     301        {
     302            if (oneChanid)
     303            {
     304                chanid   = s.chanid;
     305                chanstr  = s.chanstr;
     306                chansign = s.chansign;
     307                channame = s.channame;
     308            }
     309            else if ((chanid != s.chanid) && (chanstr != s.chanstr))
     310            {
     311                recstatus = rsOtherShowing;
     312            }
     313        }
     314    }
     315}
     316
    227317/** \fn ProgramInfo::operator=(const ProgramInfo &other)
    228318 *  \brief Copies important fields from other ProgramInfo.
    229319 */
     
    9361026    bindings[":STARTTS1"] = str_startts;
    9371027    bindings[":STARTTS2"] = str_startts;
    9381028
    939     schedList.FromScheduler();
    940     progList.FromProgram(querystr, bindings, schedList);
     1029    LoadFromScheduler(schedList);
     1030    LoadFromProgram(progList, querystr, bindings, schedList, false);
    9411031
    942     if (!progList.isEmpty())
     1032    if (!progList.empty())
    9431033    {
    9441034        ProgramInfo *pginfo = progList[0];
    9451035
     
    10161106    bindings[":CHANID"]  = QString::number(_chanid);
    10171107    bindings[":STARTTS"] = dtime.toString("yyyy-MM-ddThh:mm:50");
    10181108
    1019     progList.FromProgram(querystr, bindings, schedList);
     1109    LoadFromProgram(progList, querystr, bindings, schedList, false);
    10201110
    1021     if (!progList.isEmpty())
     1111    if (!progList.empty())
    10221112        nextstart = (*progList.begin())->startts;
    10231113
    10241114    if (nextstart > startts && nextstart < recendts)
  • libs/libmyth/programlist.cpp

     
    55#include "mythdb.h"
    66#include "util.h"
    77#include "programlist.h"
     8#include "programinfo.h"
    89
    910ProgramList::~ProgramList(void)
    1011{
     
    3536    return (*(const_cast<ProgramList*>(this)))[index];
    3637}
    3738
    38 bool ProgramList::operator==(const ProgramList &b) const
    39 {
    40     const_iterator it_a  = pglist.begin();
    41     const_iterator it_b  = b.pglist.begin();
    42     const_iterator end_a = pglist.end();
    43     const_iterator end_b = b.pglist.end();
    44 
    45     for (; it_a != end_a && it_b != end_b; ++it_a, ++it_b)
    46     {
    47         if (*it_a != *it_b)
    48             return false;
    49     }
    50 
    51     return (it_a == end_a) && (it_b == end_b);
    52 }
    53 
    5439ProgramInfo *ProgramList::take(uint index)
    5540{
    5641#ifndef PGLIST_USE_LINKED_LIST
     
    11095#endif
    11196}
    11297
    113 bool ProgramList::FromScheduler(bool &hasConflicts, QString tmptable,
    114                                 int recordid)
    115 {
    116     clear();
    117     hasConflicts = false;
     98//////////////////////////////////////////////////////////////////////
    11899
    119     if (gContext->IsBackend())
    120         return false;
    121 
    122     QString query;
    123     if (tmptable != "")
    124     {
    125         query = QString("QUERY_GETALLPENDING %1 %2")
    126                         .arg(tmptable).arg(recordid);
    127     } else {
    128         query = QString("QUERY_GETALLPENDING");
    129     }
    130 
    131     QStringList slist( query );
    132     if (!gContext->SendReceiveStringList(slist) || slist.size() < 2)
    133     {
    134         VERBOSE(VB_IMPORTANT,
    135                 "ProgramList::FromScheduler(): Error querying master.");
    136         return false;
    137     }
    138 
    139     hasConflicts = slist[0].toInt();
    140 
    141     bool result = true;
    142     QStringList::const_iterator sit = slist.begin()+2;
    143 
    144     while (result && sit != slist.end())
    145     {
    146         ProgramInfo *p = new ProgramInfo();
    147         result = p->FromStringList(sit, slist.end());
    148         if (result)
    149             pglist.push_back(p);
    150         else
    151             delete p;
    152     }
    153 
    154     if (pglist.size() != slist[1].toUInt())
    155     {
    156         VERBOSE(VB_IMPORTANT,
    157                 "ProgramList::FromScheduler(): Length mismatch");
    158         clear();
    159         result = false;
    160     }
    161 
    162     return result;
    163 }
    164 
    165 bool ProgramList::FromProgram(const QString &sql, MSqlBindings &bindings,
    166                               ProgramList &schedList, bool oneChanid)
     100static bool FromProgramQuery(
     101    const QString &sql, const MSqlBindings &bindings, MSqlQuery &query)
    167102{
    168     clear();
    169 
    170103    QString querystr = QString(
    171104        "SELECT DISTINCT program.chanid, program.starttime, program.endtime, "
    172105        "    program.title, program.subtitle, program.description, "
     
    200133    if (!sql.contains(" LIMIT "))
    201134        querystr += " LIMIT 20000 ";
    202135
     136    query.prepare(querystr);
     137    MSqlBindings::const_iterator it;
     138    for (it = bindings.begin(); it != bindings.end(); ++it)
     139    {
     140        if (querystr.contains(it.key()))
     141            query.bindValue(it.key(), it.value());
     142    }
     143
     144    if (!query.exec())
     145    {
     146        MythDB::DBError("LoadFromProgramQuery", query);
     147        return false;
     148    }
     149
     150    return true;
     151}
     152
     153bool LoadFromProgram(
     154    ProgramList &destination,
     155    const QString &sql, const MSqlBindings &bindings,
     156    const ProgramList &schedList, bool oneChanid)
     157{
     158    destination.clear();
     159
    203160    MSqlQuery query(MSqlQuery::InitCon());
     161    if (!FromProgramQuery(sql, bindings, query))
     162        return false;
     163
     164    while (query.next())
     165        destination.push_back(new ProgramInfo(query, schedList, oneChanid));
     166
     167    return true;
     168}
     169
     170bool LoadFromOldRecorded(
     171    ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
     172{
     173    destination.clear();
     174
     175    MSqlQuery query(MSqlQuery::InitCon());
     176   
     177    QString querystr =
     178        "SELECT oldrecorded.chanid, starttime, endtime, "
     179        "       title, subtitle, description, category, seriesid, "
     180        "       programid, channel.channum, channel.callsign, "
     181        "       channel.name, findid, rectype, recstatus, recordid, "
     182        "       duplicate "
     183        " FROM oldrecorded "
     184        " LEFT JOIN channel ON oldrecorded.chanid = channel.chanid "
     185        + sql;
     186
    204187    query.prepare(querystr);
    205188    MSqlBindings::const_iterator it;
    206189    for (it = bindings.begin(); it != bindings.end(); ++it)
     190    {
    207191        if (querystr.contains(it.key()))
    208192            query.bindValue(it.key(), it.value());
     193    }
    209194
    210195    if (!query.exec())
    211196    {
    212         MythDB::DBError("ProgramList::FromProgram", query);
     197        MythDB::DBError("LoadFromOldRecorded", query);
    213198        return false;
    214199    }
    215200
     
    228213        p->subtitle = query.value(4).toString();
    229214        p->description = query.value(5).toString();
    230215        p->category = query.value(6).toString();
    231         p->chanstr = query.value(7).toString();
    232         p->chansign = query.value(8).toString();
    233         p->channame = query.value(9).toString();
    234         p->repeat = query.value(10).toInt();
    235         p->chancommfree = COMM_DETECT_COMMFREE == query.value(11).toInt();
    236         p->chanOutputFilters = query.value(12).toString();
    237         p->seriesid = query.value(13).toString();
    238         p->programid = query.value(14).toString();
    239         p->year = query.value(15).toString();
    240         p->stars = query.value(16).toString().toFloat();
     216        p->seriesid = query.value(7).toString();
     217        p->programid = query.value(8).toString();
     218        p->chanstr = query.value(9).toString();
     219        p->chansign = query.value(10).toString();
     220        p->channame = query.value(11).toString();
     221        p->findid = query.value(12).toInt();
     222        p->rectype = RecordingType(query.value(13).toInt());
     223        p->recstatus = RecStatusType(query.value(14).toInt());
     224        p->recordid = query.value(15).toInt();
     225        p->duplicate = query.value(16).toInt();
    241226
    242         if (query.value(17).isNull() || query.value(17).toString().isEmpty())
    243         {
    244             p->originalAirDate = QDate (0, 1, 1);
    245             p->hasAirDate = false;
    246         }
    247         else
    248         {
    249             p->originalAirDate =
    250                 QDate::fromString(query.value(17).toString(),Qt::ISODate);
    251 
    252             if (p->originalAirDate > QDate(1940, 1, 1))
    253                 p->hasAirDate = true;
    254             else
    255                 p->hasAirDate = false;
    256         }
    257         p->catType = query.value(18).toString();
    258         p->recordid = query.value(19).toInt();
    259         p->rectype = RecordingType(query.value(20).toInt());
    260         p->recstatus = RecStatusType(query.value(21).toInt());
    261         p->findid = query.value(22).toInt();
    262 
    263         iterator it = schedList.pglist.begin();
    264         for (; it != schedList.pglist.end(); ++it)
    265         {
    266             ProgramInfo *s = *it;
    267             if (p->IsSameTimeslot(*s))
    268             {
    269                 p->recordid = s->recordid;
    270                 p->recstatus = s->recstatus;
    271                 p->rectype = s->rectype;
    272                 p->recpriority = s->recpriority;
    273                 p->recstartts = s->recstartts;
    274                 p->recendts = s->recendts;
    275                 p->cardid = s->cardid;
    276                 p->inputid = s->inputid;
    277                 p->dupin = s->dupin;
    278                 p->dupmethod = s->dupmethod;
    279                 p->findid = s->findid;
    280 
    281                 if (s->recstatus == rsWillRecord ||
    282                     s->recstatus == rsRecording)
    283                 {
    284                     if (oneChanid)
    285                     {
    286                         p->chanid   = s->chanid;
    287                         p->chanstr  = s->chanstr;
    288                         p->chansign = s->chansign;
    289                         p->channame = s->channame;
    290                     }
    291                     else if ((p->chanid != s->chanid) &&
    292                              (p->chanstr != s->chanstr))
    293                     {
    294                         p->recstatus = rsOtherShowing;
    295                     }
    296                 }
    297             }
    298         }
    299 
    300         pglist.push_back(p);
     227        destination.push_back(p);
    301228    }
    302229
    303230    return true;
    304231}
    305232
    306 bool ProgramList::FromRecorded( bool bDescending, ProgramList *pSchedList )
     233bool LoadFromRecorded(
     234    ProgramList &destination,
     235    bool orderDescending,
     236    bool possiblyInProgressTecordingsOnly,
     237    const ProgramList &schedList)
    307238{
    308     clear();
     239    destination.clear();
    309240
    310241    QString     fs_db_name = "";
    311242    QDateTime   rectime    = QDateTime::currentDateTime().addSecs(
     
    317248    // ----------------------------------------------------------------------
    318249
    319250    QMap<QString, int> inUseMap;
     251    QString   inUseKey;
     252    QString   inUseForWhat;
     253    QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
    320254
    321     QString     inUseKey;
    322     QString     inUseForWhat;
    323     QDateTime   oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
     255    MSqlQuery query(MSqlQuery::InitCon());
    324256
    325     MSqlQuery   query(MSqlQuery::InitCon());
    326 
    327257    query.prepare("SELECT DISTINCT chanid, starttime, recusage "
    328258                  " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;");
    329259    query.bindValue(":ONEHOURAGO", oneHourAgo);
     
    341271
    342272            if ((inUseForWhat == "player") ||
    343273                (inUseForWhat == "preview player") ||
    344                 (inUseForWhat == "PIP player"))
     274                (inUseForWhat == "pipplayer") ||
     275                (inUseForWhat == "pbpplayer"))
    345276                inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSEPLAYING;
    346277            else if (inUseForWhat == "recorder")
    347278                inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING;
     
    380311        "recorded.hostname,channum,name,callsign,commflagged,cutlist,"
    381312        "recorded.autoexpire,editing,bookmark,recorded.category,"
    382313        "recorded.recgroup,record.dupin,record.dupmethod,"
    383         "record.recordid,outputfilters,"
     314        "recorded.recordid,channel.outputfilters,"
    384315        "recorded.seriesid,recorded.programid,recorded.filesize, "
    385316        "recorded.lastmodified, recorded.findid, "
    386317        "recorded.originalairdate, recorded.playgroup, "
     
    388319        "recorded.progend, recorded.stars, "
    389320        "recordedprogram.audioprop+0, recordedprogram.videoprop+0, "
    390321        "recordedprogram.subtitletypes+0, recorded.watched, "
    391         "recorded.storagegroup "
     322        "recorded.storagegroup, "
     323        "recorded.transcoded, recorded.recpriority, "
     324        "recorded.preserve, recordedprogram.airdate "
    392325        "FROM recorded "
    393326        "LEFT JOIN record ON recorded.recordid = record.recordid "
    394327        "LEFT JOIN channel ON recorded.chanid = channel.chanid "
     
    396329        " ( recorded.chanid    = recordedprogram.chanid AND "
    397330        "   recorded.progstart = recordedprogram.starttime ) "
    398331        "WHERE ( recorded.deletepending = 0 OR "
    399         "        recorded.lastmodified <= DATE_SUB(NOW(), INTERVAL 5 MINUTE) "
    400         "      ) "
    401         "ORDER BY recorded.starttime";
     332        "        DATE_ADD(recorded.lastmodified, INTERVAL 5 MINUTE) <= NOW() "
     333        "      ) ";
    402334
    403     if ( bDescending )
    404         thequery += " DESC";
     335    if (possiblyInProgressTecordingsOnly)
     336    {
     337        thequery +=
     338            " AND recorded.endtime   >= NOW() "
     339            " AND recorded.starttime <= NOW() ";
     340    }
    405341
     342    thequery += "ORDER BY recorded.starttime";
     343    thequery += (orderDescending) ? " DESC " : "";
     344
    406345    QString chanorder = gContext->GetSetting("ChannelOrdering", "channum");
    407346    if (chanorder != "channum")
    408347        thequery += ", " + chanorder;
     
    449388        }
    450389        else
    451390        {
    452             proginfo->originalAirDate =
    453                 QDate::fromString(query.value(26).toString(),Qt::ISODate);
    454 
    455             if (proginfo->originalAirDate > QDate(1940, 1, 1))
    456                 proginfo->hasAirDate  = true;
    457             else
    458                 proginfo->hasAirDate  = false;
     391            QDate oad = QDate::fromString(
     392                query.value(26).toString(), Qt::ISODate);
     393            proginfo->originalAirDate = oad;
     394            proginfo->hasAirDate = oad.isValid() && (oad > QDate(1940, 1, 1));
    459395        }
    460396
    461397        proginfo->pathname = query.value(28).toString();
    462398
    463 
    464         if (proginfo->hostname.isEmpty() || proginfo->hostname.isNull())
     399        if (proginfo->hostname.isEmpty())
    465400            proginfo->hostname = gContext->GetHostName();
    466401
    467402        if (!query.value(7).toString().isEmpty())
     
    484419        flags |=  query.value(12).toInt()                 ? FL_AUTOEXP  : 0;
    485420        flags |= (query.value(14).toInt() == 1)           ? FL_BOOKMARK : 0;
    486421        flags |= (query.value(35).toInt() == 1)           ? FL_WATCHED  : 0;
     422        flags |= (query.value(37).toInt() == TRANSCODING_COMPLETE) ?
     423            FL_TRANSCODED : 0;
     424        flags |= (query.value(39).toInt() == 1)           ? FL_PRESERVED: 0;
    487425
    488426        inUseKey = query.value(0).toString() + " " +
    489427            query.value(1).toDateTime().toString(Qt::ISODate);
     
    520458        proginfo->playgroup    = query.value(27).toString();
    521459        proginfo->storagegroup = query.value(36).toString();
    522460        proginfo->recstatus    = rsRecorded;
     461        proginfo->recpriority  = query.value(38).toInt();
     462        proginfo->year         = query.value(40).toString();
    523463
    524         if ((pSchedList != NULL) && (proginfo->recendts > rectime))
     464        if (proginfo->recendts > rectime)
    525465        {
    526             iterator it = pSchedList->pglist.begin();
    527             for (; it != pSchedList->pglist.end(); ++it)
     466            ProgramList::const_iterator it = schedList.begin();
     467            for (; it != schedList.end(); ++it)
    528468            {
    529                 ProgramInfo *s = *it;
    530                 if (s && s->recstatus    == rsRecording &&
    531                     proginfo->chanid     == s->chanid   &&
    532                     proginfo->recstartts == s->recstartts)
     469                const ProgramInfo &s = **it;
     470                if (s.recstatus          == rsRecording &&
     471                    proginfo->chanid     == s.chanid    &&
     472                    proginfo->recstartts == s.recstartts)
    533473                {
    534474                    proginfo->recstatus = rsRecording;
    535475                    break;
     
    539479
    540480        proginfo->stars = query.value(31).toDouble();
    541481
    542         pglist.push_back(proginfo);
     482        destination.push_back(proginfo);
    543483    }
    544484
    545485    return true;
    546486}
    547487
    548 
    549 bool ProgramList::FromOldRecorded(const QString &sql, MSqlBindings &bindings)
     488bool LoadFromScheduler(
     489    ProgramList &destination, bool &hasConflicts,
     490    QString tmptable, int recordid)
    550491{
    551     clear();
    552     MSqlQuery query(MSqlQuery::InitCon());
     492    destination.clear();
     493    hasConflicts = false;
    553494
    554     query.prepare("SELECT oldrecorded.chanid, starttime, endtime, "
    555                   " title, subtitle, description, category, seriesid, "
    556                   " programid, channel.channum, channel.callsign, "
    557                   " channel.name, findid, rectype, recstatus, recordid, "
    558                   " duplicate "
    559                   " FROM oldrecorded "
    560                   " LEFT JOIN channel ON oldrecorded.chanid = channel.chanid "
    561                   + sql);
    562     query.bindValues(bindings);
     495    if (gContext->IsBackend())
     496        return false;
    563497
    564     if (!query.exec() || !query.isActive())
     498    QString query;
     499    if (!tmptable.isEmpty())
    565500    {
    566         MythDB::DBError("ProgramList::FromOldRecorded", query);
    567         return false;
     501        query = QString("QUERY_GETALLPENDING %1 %2")
     502            .arg(tmptable).arg(recordid);
    568503    }
    569 
    570     while (query.next())
     504    else
    571505    {
    572         ProgramInfo *p = new ProgramInfo;
    573         p->chanid = query.value(0).toString();
    574         p->startts = QDateTime::fromString(query.value(1).toString(),
    575                                            Qt::ISODate);
    576         p->endts = QDateTime::fromString(query.value(2).toString(),
    577                                          Qt::ISODate);
    578         p->recstartts = p->startts;
    579         p->recendts = p->endts;
    580         p->lastmodified = p->startts;
    581         p->title = query.value(3).toString();
    582         p->subtitle = query.value(4).toString();
    583         p->description = query.value(5).toString();
    584         p->category = query.value(6).toString();
    585         p->seriesid = query.value(7).toString();
    586         p->programid = query.value(8).toString();
    587         p->chanstr = query.value(9).toString();
    588         p->chansign = query.value(10).toString();
    589         p->channame = query.value(11).toString();
    590         p->findid = query.value(12).toInt();
    591         p->rectype = RecordingType(query.value(13).toInt());
    592         p->recstatus = RecStatusType(query.value(14).toInt());
    593         p->recordid = query.value(15).toInt();
    594         p->duplicate = query.value(16).toInt();
     506        query = QString("QUERY_GETALLPENDING");
     507    }
    595508
    596         pglist.push_back(p);
     509    QStringList slist( query );
     510    if (!gContext->SendReceiveStringList(slist) || slist.size() < 2)
     511    {
     512        VERBOSE(VB_IMPORTANT,
     513                "LoadFromScheduler(): Error querying master.");
     514        return false;
    597515    }
    598516
    599     return true;
    600 }
     517    hasConflicts = slist[0].toInt();
    601518
    602 bool ProgramList::GetProgramDetailList(
    603     QDateTime &nextRecordingStart, bool *hasConflicts, ProgramDetailList *list)
    604 {
    605     nextRecordingStart = QDateTime();
     519    bool result = true;
     520    QStringList::const_iterator sit = slist.begin()+2;
    606521
    607     bool dummy;
    608     bool *conflicts = (hasConflicts) ? hasConflicts : &dummy;
    609 
    610     ProgramList progList;
    611     if (!progList.FromScheduler(*conflicts))
    612         return false;
    613 
    614     // find the earliest scheduled recording
    615     ProgramList::const_iterator it = progList.begin();
    616     for (; it != progList.end(); ++it)
     522    while (result && sit != slist.end())
    617523    {
    618         if (((*it)->recstatus == rsWillRecord) &&
    619             (nextRecordingStart.isNull() ||
    620              nextRecordingStart > (*it)->recstartts))
    621         {
    622             nextRecordingStart = (*it)->recstartts;
    623         }
     524        ProgramInfo *p = new ProgramInfo();
     525        result = p->FromStringList(sit, slist.end());
     526        if (result)
     527            destination.push_back(p);
     528        else
     529            delete p;
    624530    }
    625531
    626     if (!list)
    627         return true;
    628 
    629     // save the details of the earliest recording(s)
    630     for (it = progList.begin(); it != progList.end(); ++it)
     532    if (destination.size() != slist[1].toUInt())
    631533    {
    632         if (((*it)->recstatus  == rsWillRecord) &&
    633             ((*it)->recstartts == nextRecordingStart))
    634         {
    635             ProgramDetail prog;
    636             prog.channame  = (*it)->channame;
    637             prog.title     = (*it)->title;
    638             prog.subtitle  = (*it)->subtitle;
    639             prog.startTime = (*it)->recstartts;
    640             prog.endTime   = (*it)->recendts;
    641             list->push_back(prog);
    642         }
     534        VERBOSE(VB_IMPORTANT,
     535                "LoadFromScheduler(): Length mismatch.");
     536        destination.clear();
     537        result = false;
    643538    }
    644539
    645     return true;
     540    return result;
    646541}
     542
     543bool LoadFromScheduler(ProgramList &destination)
     544{
     545    bool dummyConflicts;
     546    return LoadFromScheduler(destination, dummyConflicts, "", -1);
     547}
  • programs/mythfrontend/playbackbox.cpp

     
    11101110
    11111111    if (m_noRecordingsText)
    11121112    {
    1113         if (!progList.isEmpty())
     1113        if (!progList.empty())
    11141114            m_noRecordingsText->SetVisible(false);
    11151115        else
    11161116        {
     
    12571257
    12581258                if (m_viewMask != VIEW_NONE &&
    12591259                    (p->recgroup != "LiveTV" || m_recGroup == "LiveTV"))
    1260                     m_progLists[""].prepend(p);
     1260                    m_progLists[""].push_front(p);
    12611261
    12621262                asKey = p->MakeUniqueKey();
    12631263                if (asCache.contains(asKey))
     
    12711271                {
    12721272                    QString tmpTitle = tr("LiveTV");
    12731273                    sortedList[tmpTitle.toLower()] = tmpTitle;
    1274                     m_progLists[tmpTitle.toLower()].prepend(p);
     1274                    m_progLists[tmpTitle.toLower()].push_front(p);
    12751275                    m_progLists[tmpTitle.toLower()].setAutoDelete(false);
    12761276                    continue;
    12771277                }
     
    12851285
    12861286                    if (!sortedList.contains(sTitle))
    12871287                        sortedList[sTitle] = p->title;
    1288                     m_progLists[sortedList[sTitle].toLower()].prepend(p);
     1288                    m_progLists[sortedList[sTitle].toLower()].push_front(p);
    12891289                    m_progLists[sortedList[sTitle].toLower()].setAutoDelete(false);
    12901290                }
    12911291
     
    12931293                    !p->recgroup.isEmpty()) // Show recording groups
    12941294                {
    12951295                    sortedList[p->recgroup.toLower()] = p->recgroup;
    1296                     m_progLists[p->recgroup.toLower()].prepend(p);
     1296                    m_progLists[p->recgroup.toLower()].push_front(p);
    12971297                    m_progLists[p->recgroup.toLower()].setAutoDelete(false);
    12981298                }
    12991299
     
    13011301                    !p->category.isEmpty()) // Show categories
    13021302                {
    13031303                    sortedList[p->category.toLower()] = p->category;
    1304                     m_progLists[p->category.toLower()].prepend(p);
     1304                    m_progLists[p->category.toLower()].push_front(p);
    13051305                    m_progLists[p->category.toLower()].setAutoDelete(false);
    13061306                }
    13071307
     
    13121312                    QString tmpTitle = QString("(%1)")
    13131313                                               .arg(searchRule[p->recordid]);
    13141314                    sortedList[tmpTitle.toLower()] = tmpTitle;
    1315                     m_progLists[tmpTitle.toLower()].prepend(p);
     1315                    m_progLists[tmpTitle.toLower()].push_front(p);
    13161316                    m_progLists[tmpTitle.toLower()].setAutoDelete(false);
    13171317                }
    13181318
     
    13371337                        if (recidEpisodes[p->recordid] == 1 ||
    13381338                            p->recordid == 0 )
    13391339                        {
    1340                             m_progLists[m_watchGroupLabel].prepend(p);
     1340                            m_progLists[m_watchGroupLabel].push_front(p);
    13411341                            m_progLists[m_watchGroupLabel].setAutoDelete(false);
    13421342                        }
    13431343                        else
     
    40724072    }
    40734073
    40744074    // Create and add the "All Programs" entry
    4075     displayNames.prepend(tr("%1 [%n item(s)]", 0, totalItems)
    4076                          .arg(ProgramInfo::i18n("All Programs")));
    4077     groupNames.prepend("All Programs");
     4075    displayNames.push_front(tr("%1 [%n item(s)]", 0, totalItems)
     4076                            .arg(ProgramInfo::i18n("All Programs")));
     4077    groupNames.push_front("All Programs");
    40784078    m_recGroupType["All Programs"] = "recgroup";
    40794079
    40804080    // Find each category, and the number of recordings in each
  • programs/mythfrontend/guidegrid.cpp

     
    281281
    282282void GuideGrid::Load(void)
    283283{
    284     m_recList.FromScheduler();
     284    LoadFromScheduler(m_recList);
    285285    fillChannelInfos();
    286286
    287287    int maxchannel = max((int)GetChannelCount() - 1, 0);
     
    642642    bindings[":CHANID"]  = chanid;
    643643
    644644    ProgramList dummy;
    645     proglist.FromProgram(querystr, bindings, dummy);
     645    LoadFromProgram(proglist, querystr, bindings, dummy, false);
    646646
    647647    return proglist;
    648648}
     
    10091009        bindings[":STARTTS"] = m_currentStartTime.toString("yyyy-MM-ddThh:mm:00");
    10101010        bindings[":ENDTS"] = m_currentEndTime.toString("yyyy-MM-ddThh:mm:00");
    10111011
    1012         proglist->FromProgram(querystr, bindings, m_recList);
     1012        LoadFromProgram(*proglist, querystr, bindings, m_recList, false);
    10131013    }
    10141014
    10151015    return proglist;
     
    11201120
    11211121    vector<ProgramInfo*>::iterator it = unknownlist.begin();
    11221122    for (; it != unknownlist.end(); ++it)
    1123         proglist->append(*it);
     1123        proglist->push_back(*it);
    11241124
    11251125    MythRect programRect = m_guideGrid->GetArea();
    11261126
     
    12641264
    12651265        if (message == "SCHEDULE_CHANGE")
    12661266        {
    1267             m_recList.FromScheduler();
     1267            LoadFromScheduler(m_recList);
    12681268            fillProgramInfos();
    12691269            updateInfo();
    12701270        }
     
    15701570    maxchannel = max((int)GetChannelCount() - 1, 0);
    15711571    m_channelCount = min(m_guideGrid->getChannelCount(), maxchannel + 1);
    15721572
    1573     m_recList.FromScheduler();
     1573    LoadFromScheduler(m_recList);
    15741574    fillProgramInfos();
    15751575}
    15761576
     
    19561956    ri.ToggleRecord();
    19571957    *pginfo = ri;
    19581958
    1959     m_recList.FromScheduler();
     1959    LoadFromScheduler(m_recList);
    19601960    fillProgramInfos();
    19611961    updateInfo();
    19621962}
  • programs/mythfrontend/progfind.h

     
    11#ifndef PROGFIND_H_
    22#define PROGFIND_H_
    33
    4 // qt
     4// Qt
    55#include <QDateTime>
    66#include <QEvent>
    77
    8 // myth
     8// MythTV
    99#include "mythscreentype.h"
    1010#include "programlist.h"
    1111#include "mythdialogbox.h"
     12#include "playercontext.h"
    1213
    1314// mythfrontend
    1415#include "schedulecommon.h"
  • programs/mythfrontend/viewscheduled.cpp

     
    115115    return true;
    116116}
    117117
    118 void ViewScheduled::Load()
     118void ViewScheduled::Load(void)
    119119{
    120     m_recList.FromScheduler(m_conflictBool);
     120    LoadFromScheduler(m_recList, m_conflictBool);
    121121}
    122122
    123 void ViewScheduled::Init()
     123void ViewScheduled::Init(void)
    124124{
    125125    LoadList(true);
    126126}
     
    266266    m_recgroupList.clear();
    267267
    268268    if (!useExistingData)
    269         m_recList.FromScheduler(m_conflictBool);
     269        LoadFromScheduler(m_recList, m_conflictBool);
    270270
    271271    ProgramList::iterator pit = m_recList.begin();
    272272    QString currentDate;
     
    294294                m_maxinput = pginfo->inputid;
    295295
    296296            QDate date = (pginfo->recstartts).date();
    297             m_recgroupList[date].append(pginfo);
     297            m_recgroupList[date].push_back(pginfo);
    298298            m_recgroupList[date].setAutoDelete(false);
    299299
    300             m_recgroupList[m_defaultGroup].append(pginfo);
     300            m_recgroupList[m_defaultGroup].push_back(pginfo);
    301301
    302302            ++pit;
    303303        }
     
    339339
    340340        plist = m_recgroupList[m_currentGroup];
    341341
    342         int listPos = plist.count() - 1;
     342        int listPos = ((int) plist.size()) - 1;
    343343        int i;
    344344        for (i = listPos; i >= 0; --i)
    345345        {
     
    363363
    364364void ViewScheduled::ChangeGroup(MythUIButtonListItem* item)
    365365{
    366     if (!item || m_recList.isEmpty())
     366    if (!item || m_recList.empty())
    367367        return;
    368368
    369369    QDate group = qVariantValue<QDate>(item->GetData());
     
    382382                                                (GetChild("norecordings_info"));
    383383
    384384    if (norecordingText)
    385         norecordingText->SetVisible(m_recList.isEmpty());
     385        norecordingText->SetVisible(m_recList.empty());
    386386
    387     if (m_recList.isEmpty())
     387    if (m_recList.empty())
    388388        return;
    389389
    390390    ProgramList plist;
  • programs/mythfrontend/statusbox.cpp

     
    624624    }
    625625
    626626    ProgramList schedList;
    627     schedList.FromScheduler();
     627    LoadFromScheduler(schedList);
    628628
    629     tmpstr = tr("%n matching showing(s)", "", schedList.count());
     629    tmpstr = tr("%n matching showing(s)", "", schedList.size());
    630630    AddLogLine(tmpstr, tmpstr);
    631631
    632632    ProgramList::const_iterator it = schedList.begin();
  • programs/mythfrontend/programrecpriority.cpp

     
    12571257    m_nowMatch.clear();
    12581258    m_recMatch.clear();
    12591259    ProgramList schedList;
    1260     schedList.FromScheduler();
     1260    LoadFromScheduler(schedList);
    12611261    QDateTime now = QDateTime::currentDateTime();
    12621262
    12631263    ProgramList::const_iterator it = schedList.begin();
  • programs/mythfrontend/proglist.cpp

     
    88#include <algorithm>
    99using namespace std;
    1010
    11 // qt
     11// Qt
    1212#include <QApplication>
    1313#include <QRegExp>
    1414
    15 // libmyth
     15// MythTV
    1616#include "mythcontext.h"
    1717#include "remoteutil.h"
    18 
    19 // libmythtv
    2018#include "scheduledrecording.h"
    2119#include "recordingrule.h"
    2220#include "channelutil.h"
    2321#include "recordinginfo.h"
    24 
    25 // libmythdb
    2622#include "mythdb.h"
    2723#include "mythdbcon.h"
    2824#include "mythverbose.h"
    29 
    30 // libmythui
    3125#include "mythuitext.h"
    3226#include "mythuibutton.h"
    3327#include "mythuibuttonlist.h"
     
    289283        menuPopup->AddButton(tr("Upcoming"));
    290284        menuPopup->AddButton(tr("Custom Edit"));
    291285
    292         ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     286        ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    293287        if (m_type != plPreviouslyRecorded)
    294288        {
    295289            if (pi && pi->recordid > 0)
     
    612606
    613607void ProgLister::quickRecord()
    614608{
    615     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     609    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    616610
    617611    if (!pi)
    618612        return;
     
    624618
    625619void ProgLister::select()
    626620{
    627     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     621    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    628622
    629623    if (!pi)
    630624        return;
     
    637631
    638632void ProgLister::edit()
    639633{
    640     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     634    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    641635
    642636    EditScheduled(pi);
    643637}
    644638
    645639void ProgLister::customEdit()
    646640{
    647     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     641    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    648642
    649643    EditCustom(pi);
    650644}
     
    659653
    660654void ProgLister::deleteRule()
    661655{
    662     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     656    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    663657
    664658    if (!pi || pi->recordid <= 0)
    665659        return;
     
    690684
    691685void ProgLister::deleteOldEpisode()
    692686{
    693     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     687    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    694688
    695689    if (!pi)
    696690        return;
     
    705699    if (!ok)
    706700        return;
    707701
    708     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     702    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    709703
    710704    if (!pi)
    711705        return;
     
    724718
    725719void ProgLister::deleteOldTitle()
    726720{
    727     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     721    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    728722
    729723    if (!pi)
    730724        return;
     
    739733    if (!ok)
    740734        return;
    741735
    742     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     736    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    743737
    744738    if (!pi)
    745739        return;
     
    756750
    757751void ProgLister::oldRecordedActions()
    758752{
    759     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     753    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    760754
    761755    if (!pi)
    762756        return;
     
    797791
    798792void ProgLister::upcoming()
    799793{
    800     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     794    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    801795
    802796    if (!pi || m_type == plTitle)
    803797        return;
     
    807801
    808802void ProgLister::details()
    809803{
    810     ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     804    ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    811805
    812806    ShowDetails(pi);
    813807}
     
    14071401    }
    14081402
    14091403    if (m_type == plPreviouslyRecorded)
    1410         m_itemList.FromOldRecorded(where, bindings);
     1404    {
     1405        LoadFromOldRecorded(m_itemList, where, bindings);
     1406    }
    14111407    else
    14121408    {
    1413         m_schedList.FromScheduler();
    1414         m_itemList.FromProgram(where, bindings, m_schedList, oneChanid);
     1409        LoadFromScheduler(m_schedList);
     1410        LoadFromProgram(m_itemList, where, bindings, m_schedList, oneChanid);
    14151411    }
    14161412
    14171413    ProgramInfo *s;
     
    14651461    {
    14661462        vector<ProgramInfo *>::reverse_iterator r = sortedList.rbegin();
    14671463        for (; r != sortedList.rend(); r++)
    1468             m_itemList.append(*r);
     1464            m_itemList.push_back(*r);
    14691465    }
    14701466    else
    14711467    {
    14721468        vector<ProgramInfo *>::iterator i = sortedList.begin();
    14731469        for (; i != sortedList.end(); ++i)
    1474             m_itemList.append(*i);
     1470            m_itemList.push_back(*i);
    14751471    }
    14761472
    14771473    if (updateDisp)
     
    14811477void ProgLister::updateDisplay(bool restorePosition)
    14821478{
    14831479    if (m_messageText)
    1484         m_messageText->SetVisible((m_itemList.count() == 0));
     1480        m_messageText->SetVisible(m_itemList.empty());
    14851481
    14861482    InfoMap infoMap;
    14871483    ProgramInfo pginfo;
     
    15161512            comp = new plTitleSort();
    15171513
    15181514        int i;
    1519         for (i = m_itemList.count() - 2; i >= 0; i--)
     1515        for (i = m_itemList.size() - 2; i >= 0; i--)
    15201516        {
    15211517            bool dobreak;
    15221518            if (m_reverseSort)
     
    16991695        {
    17001696            if (resulttext == tr("Allow this episode to re-record"))
    17011697            {
    1702                 ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     1698                ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    17031699                if (pi)
    17041700                {
    17051701                    RecordingInfo ri(*pi);
     
    17091705            }
    17101706            else if (resulttext == tr("Never record this episode"))
    17111707            {
    1712                 ProgramInfo *pi = m_itemList.at(m_progList->GetCurrentPos());
     1708                ProgramInfo *pi = m_itemList[m_progList->GetCurrentPos()];
    17131709                if (pi)
    17141710                {
    17151711                    RecordingInfo ri(*pi);
  • programs/mythfrontend/progfind.cpp

     
    1 
    2 #include "progfind.h"
    3 
    4 // qt
     1// Qt
    52#include <QDateTime>
    63#include <QApplication>
    74#include <QStringList>
     
    96#include <QKeyEvent>
    107#include <QEvent>
    118
    12 // libmythdb
     9// MythTV
    1310#include "oldsettings.h"
    1411#include "mythdb.h"
    1512#include "mythdbcon.h"
    1613#include "mythdirs.h"
    17 
    18 // libmyth
    1914#include "mythcontext.h"
    20 
    21 // libmythtv
    2215#include "recordinginfo.h"
    2316#include "tv.h"
    24 
    25 // libmythui
    2617#include "mythuitext.h"
    2718#include "mythuitextedit.h"
    2819#include "mythuibuttonlist.h"
     
    3324#include "guidegrid.h"
    3425#include "proglist.h"
    3526#include "customedit.h"
     27#include "progfind.h"
    3628
    3729#define LOC      QString("ProgFinder: ")
    3830#define LOC_ERR  QString("ProgFinder, Error: ")
     
    587579
    588580    QDateTime progStart = QDateTime::currentDateTime();
    589581
    590     m_schedList.FromScheduler();
    591 
    592582    MSqlBindings bindings;
    593583    QString querystr = "WHERE program.title = :TITLE "
    594584                       "  AND program.endtime > :ENDTIME ";
    595585    bindings[":TITLE"] = progTitle;
    596586    bindings[":ENDTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
    597587
    598     m_showData.FromProgram(querystr, bindings, m_schedList);
     588    LoadFromScheduler(m_schedList);
     589    LoadFromProgram(m_showData, querystr, bindings, m_schedList, false);
    599590
    600591    updateTimesList();
    601592
  • programs/mythbackend/mythxml.cpp

     
    571571    for (RecIter itRecList =  recList.begin();
    572572                 itRecList != recList.end();   itRecList++)
    573573    {
    574         schedList.append( *itRecList );
     574        schedList.push_back( *itRecList );
    575575    }
    576576
    577577    // ----------------------------------------------------------------------
    578578
    579579    ProgramList progList;
     580    LoadFromProgram( progList, sSQL, bindings, schedList, false );
    580581
    581     progList.FromProgram( sSQL, bindings, schedList );
    582 
    583582    // Build Response
    584583
    585584    QDomDocument doc;
     
    623622    list.push_back( NameValue( "NumOfChannels", iChanCount   ));
    624623    list.push_back( NameValue( "Details"      , bDetails     ));
    625624
    626     list.push_back( NameValue( "Count"        , (int)progList.count() ));
     625    list.push_back( NameValue( "Count"        , (int)progList.size() ));
    627626    list.push_back( NameValue( "AsOf"         , QDateTime::currentDateTime()
    628627                                                .toString( Qt::ISODate )));
    629628    list.push_back( NameValue( "Version"      , MYTH_BINARY_VERSION ));
     
    684683    for (RecIter itRecList =  recList.begin();
    685684                 itRecList != recList.end();   itRecList++)
    686685    {
    687         schedList.append( *itRecList );
     686        schedList.push_back( *itRecList );
    688687    }
    689688
    690689    // ----------------------------------------------------------------------
    691690
    692691    ProgramList progList;
     692    LoadFromProgram( progList, sSQL, bindings, schedList, false );
    693693
    694     progList.FromProgram( sSQL, bindings, schedList );
    695 
    696694    ProgramList::iterator pgit = progList.begin();
    697695
    698696    if (pgit == progList.end())
     
    971969    for (RecIter itRecList =  recList.begin();
    972970                 itRecList != recList.end();   itRecList++)
    973971    {
    974         schedList.append( *itRecList );
     972        schedList.push_back( *itRecList );
    975973    }
    976974
    977975    // ----------------------------------------------------------------------
    978976
    979977    ProgramList progList;
     978    LoadFromRecorded( progList, bDescending, false, schedList );
    980979
    981     progList.FromRecorded( bDescending, &schedList );
    982 
    983980    // Build Response XML
    984981
    985982    QDomDocument doc;
     
    995992
    996993    NameValues list;
    997994
    998     list.push_back( NameValue( "Count"    , (int)progList.count()));
     995    list.push_back( NameValue( "Count"    , (int)progList.size()));
    999996    list.push_back( NameValue( "AsOf"     , QDateTime::currentDateTime()
    1000997                                            .toString( Qt::ISODate )));
    1001998    list.push_back( NameValue( "Version"  , MYTH_BINARY_VERSION ));
  • programs/mythbackend/mainserver.cpp

     
    10771077            {
    10781078                if (!pinfo.FromStringList(sit, slist.end()))
    10791079                    break;
    1080                 slavelist.append(new RecordingInfo(pinfo));
     1080                slavelist.push_back(new RecordingInfo(pinfo));
    10811081            }
    10821082            m_sched->SlaveConnected(slavelist);
    10831083        }
     
    12761276    MythSocket *pbssock = pbs->getSocket();
    12771277    QString playbackhost = pbs->getHostname();
    12781278
    1279     QString fs_db_name = "";
    1280 
    1281     QDateTime rectime = QDateTime::currentDateTime().addSecs(
    1282                             -gContext->GetNumSetting("RecordOverTime"));
    1283     RecIter ri;
    1284     RecList schedList;
     1279    RecList rlSchedList;
    12851280    if (m_sched)
    1286         m_sched->getAllPending(&schedList);
     1281        m_sched->getAllPending(&rlSchedList);
     1282    ProgramList schedList;
     1283    while (!rlSchedList.empty())
     1284    {
     1285        schedList.push_front(rlSchedList.front());
     1286        rlSchedList.pop_front();
     1287    }
    12871288
    1288     QString ip = gContext->GetSetting("BackendServerIP");
    1289     QString port = gContext->GetSetting("BackendServerPort");
     1289    ProgramList destination;
     1290    LoadFromRecorded(
     1291        destination, (type == "Delete"), (type == "Recording"), schedList);
    12901292
    1291     QMap<QString, int> inUseMap;
    1292     QString inUseKey;
    1293     QString inUseForWhat;
    1294     QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
    1295 
    1296     MSqlQuery query(MSqlQuery::InitCon());
    1297 
    1298     query.prepare("SELECT DISTINCT chanid, starttime, recusage "
    1299                   " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;");
    1300     query.bindValue(":ONEHOURAGO", oneHourAgo);
    1301 
    1302     if (query.exec() && query.isActive() && query.size() > 0)
    1303         while (query.next())
    1304         {
    1305             inUseKey = query.value(0).toString() + " " +
    1306                        query.value(1).toDateTime().toString(Qt::ISODate);
    1307             inUseForWhat = query.value(2).toString();
    1308 
    1309             if (!inUseMap.contains(inUseKey))
    1310                 inUseMap[inUseKey] = 0;
    1311 
    1312             if ((inUseForWhat == "player") ||
    1313                 (inUseForWhat == "preview player") ||
    1314                 (inUseForWhat == "pipplayer") ||
    1315                 (inUseForWhat == "pbpplayer"))
    1316                 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSEPLAYING;
    1317             else if (inUseForWhat == "recorder")
    1318                 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING;
    1319         }
    1320 
    1321 
    1322     QString thequery =
    1323         "SELECT recorded.chanid,recorded.starttime,recorded.endtime,"
    1324         "recorded.title,recorded.subtitle,recorded.description,"
    1325         "recorded.hostname,channum,name,callsign,commflagged,cutlist,"
    1326         "recorded.autoexpire,editing,bookmark,recorded.category,"
    1327         "recorded.recgroup,record.dupin,record.dupmethod,"
    1328         "recorded.recordid,channel.outputfilters,"
    1329         "recorded.seriesid,recorded.programid,recorded.filesize, "
    1330         "recorded.lastmodified, recorded.findid, "
    1331         "recorded.originalairdate, recorded.playgroup, "
    1332         "recorded.basename, recorded.progstart, "
    1333         "recorded.progend, recorded.stars, "
    1334         "recordedprogram.audioprop+0, recordedprogram.videoprop+0, "
    1335         "recordedprogram.subtitletypes+0, transcoded, "
    1336         "recorded.recpriority, watched, recorded.preserve, "
    1337         "recorded.storagegroup, recordedprogram.airdate "
    1338         "FROM recorded "
    1339         "LEFT JOIN record ON recorded.recordid = record.recordid "
    1340         "LEFT JOIN channel ON recorded.chanid = channel.chanid "
    1341         "LEFT JOIN recordedprogram ON "
    1342         " ( recorded.chanid = recordedprogram.chanid AND "
    1343         "  recorded.progstart = recordedprogram.starttime ) "
    1344         "WHERE ( recorded.deletepending = 0 OR "
    1345         "        DATE_ADD(recorded.lastmodified, INTERVAL 5 MINUTE) <= NOW() "
    1346         "      ) ";
    1347 
    1348     if (type == "Recording")
    1349         thequery += "AND recorded.endtime >= NOW() AND "
    1350             "recorded.starttime <= NOW()";
    1351 
    1352     thequery += "ORDER BY recorded.starttime";
    1353 
    1354     if (type == "Delete")
    1355         thequery += " DESC";
    1356 
    1357     QString chanorder = gContext->GetSetting("ChannelOrdering", "channum");
    1358     if (chanorder != "channum")
    1359         thequery += ", " + chanorder;
    1360     else // approximation which the DB can handle
    1361         thequery += ",atsc_major_chan,atsc_minor_chan,channum,callsign";
    1362 
    1363     QStringList outputlist;
    1364     QString fileprefix = gContext->GetFilePrefix();
     1293    QStringList outputlist(QString::number(destination.size()));
    13651294    QMap<QString, QString> backendIpMap;
    13661295    QMap<QString, QString> backendPortMap;
     1296    QString ip   = gContext->GetSetting("BackendServerIP");
     1297    QString port = gContext->GetSetting("BackendServerPort");
    13671298
    1368     query.prepare(thequery);
    1369 
    1370     if (!query.exec() || !query.isActive())
     1299    ProgramList::iterator it = destination.begin();
     1300    for (it = destination.begin(); it != destination.end(); ++it)
    13711301    {
    1372         MythDB::DBError("MainServer::HandleQueryRecordings", query);
    1373         outputlist << "0";
    1374     }
    1375     else
    1376     {
    1377         outputlist << QString::number(query.size());
     1302        ProgramInfo *proginfo = *it;
     1303        PlaybackSock *slave = NULL;
    13781304
    1379         while (query.next())
    1380         {
    1381             ProgramInfo *proginfo = new ProgramInfo;
     1305        if (proginfo->hostname != gContext->GetHostName())
     1306            slave = getSlaveByHostname(proginfo->hostname);
    13821307
    1383             proginfo->chanid = query.value(0).toString();
    1384             proginfo->startts = query.value(29).toDateTime();
    1385             proginfo->endts = query.value(30).toDateTime();
    1386             proginfo->recstartts = query.value(1).toDateTime();
    1387             proginfo->recendts = query.value(2).toDateTime();
    1388             proginfo->title = query.value(3).toString();
    1389             proginfo->subtitle = query.value(4).toString();
    1390             proginfo->description = query.value(5).toString();
    1391             proginfo->hostname = query.value(6).toString();
    1392 
    1393             proginfo->dupin = RecordingDupInType(query.value(17).toInt());
    1394             proginfo->dupmethod = RecordingDupMethodType(query.value(18).toInt());
    1395             proginfo->recordid = query.value(19).toInt();
    1396             proginfo->chanOutputFilters = query.value(20).toString();
    1397             proginfo->seriesid = query.value(21).toString();
    1398             proginfo->programid = query.value(22).toString();
    1399             proginfo->filesize = stringToLongLong(query.value(23).toString());
    1400             proginfo->lastmodified =
    1401                       QDateTime::fromString(query.value(24).toString(),
    1402                                             Qt::ISODate);
    1403             proginfo->findid = query.value(25).toInt();
    1404 
    1405             if (query.value(26).isNull() ||
    1406                 query.value(26).toString().isEmpty())
     1308        if ((proginfo->hostname == gContext->GetHostName()) ||
     1309            (!slave && masterBackendOverride))
     1310        {
     1311            proginfo->pathname = QString("myth://") + ip + ":" + port
     1312                + "/" + proginfo->pathname;
     1313            if (proginfo->filesize == 0)
    14071314            {
    1408                 proginfo->originalAirDate = QDate (0, 1, 1);
    1409                 proginfo->hasAirDate      = false;
    1410             }
    1411             else
    1412             {
    1413                 proginfo->originalAirDate =
    1414                     QDate::fromString(query.value(26).toString(),Qt::ISODate);
    1415 
    1416                 if (proginfo->originalAirDate > QDate(1940, 1, 1))
    1417                     proginfo->hasAirDate  = true;
    1418                 else
    1419                     proginfo->hasAirDate  = false;
    1420             }
    1421 
    1422             proginfo->pathname = query.value(28).toString();
    1423 
    1424             if (proginfo->hostname.isEmpty())
    1425                 proginfo->hostname = gContext->GetHostName();
    1426 
    1427             if (!query.value(7).toString().isEmpty())
    1428             {
    1429                 proginfo->chanstr = query.value(7).toString();
    1430                 proginfo->channame = query.value(8).toString();
    1431                 proginfo->chansign = query.value(9).toString();
    1432             }
    1433             else
    1434             {
    1435                 proginfo->chanstr = "#" + proginfo->chanid;
    1436                 proginfo->channame = "#" + proginfo->chanid;
    1437                 proginfo->chansign = "#" + proginfo->chanid;
    1438             }
    1439 
    1440             // Taken out of programinfo.cpp just to reduce the number of queries
    1441             int flags = 0;
    1442             flags |= (query.value(10).toInt() == 1) ? FL_COMMFLAG : 0;
    1443             flags |= (query.value(11).toInt() == 1) ? FL_CUTLIST : 0;
    1444             flags |= query.value(12).toInt() ? FL_AUTOEXP : 0;
    1445             flags |= (query.value(14).toInt() == 1) ? FL_BOOKMARK : 0;
    1446             flags |= (query.value(35).toInt() == TRANSCODING_COMPLETE) ?
    1447                       FL_TRANSCODED : 0;
    1448             flags |= (query.value(37).toInt() == 1) ? FL_WATCHED : 0;
    1449             flags |= (query.value(38).toInt() == 1) ? FL_PRESERVED : 0;
    1450 
    1451             inUseKey = query.value(0).toString() + " " +
    1452                        query.value(1).toDateTime().toString(Qt::ISODate);
    1453             if (inUseMap.contains(inUseKey))
    1454                 flags |= inUseMap[inUseKey];
    1455 
    1456             if (query.value(13).toInt())
    1457             {
    1458                 flags |= FL_EDITING;
    1459             }
    1460             else if (query.value(10).toInt() == COMM_FLAG_PROCESSING)
    1461             {
    1462                 if (JobQueue::IsJobRunning(JOB_COMMFLAG, proginfo))
    1463                     flags |= FL_EDITING;
    1464                 else
    1465                     proginfo->SetCommFlagged(COMM_FLAG_NOT_FLAGGED);
    1466             }
    1467 
    1468             proginfo->audioproperties = query.value(32).toInt();
    1469             proginfo->videoproperties = query.value(33).toInt();
    1470             proginfo->subtitleType = query.value(34).toInt();
    1471 
    1472             proginfo->programflags = flags;
    1473 
    1474             proginfo->category = query.value(15).toString();
    1475 
    1476             proginfo->recgroup = query.value(16).toString();
    1477             proginfo->playgroup = query.value(27).toString();
    1478             proginfo->storagegroup =
    1479                 query.value(39).toString();
    1480 
    1481             proginfo->recpriority = query.value(36).toInt();
    1482             proginfo->year = query.value(40).toString();
    1483 
    1484             proginfo->recstatus = rsRecorded;
    1485             if (proginfo->recendts > rectime)
    1486             {
    1487                 for (ri = schedList.begin(); ri != schedList.end(); ri++)
     1315                QString tmpURL = GetPlaybackURL(proginfo);
     1316                QFile checkFile(tmpURL);
     1317                if (!tmpURL.isEmpty() && checkFile.exists())
    14881318                {
    1489                     if ((*ri) && (*ri)->recstatus == rsRecording &&
    1490                         proginfo->chanid == (*ri)->chanid &&
    1491                         proginfo->recstartts == (*ri)->recstartts)
    1492                     {
    1493                         proginfo->recstatus = rsRecording;
    1494                         break;
    1495                     }
     1319                    proginfo->filesize = checkFile.size();
     1320                    if (proginfo->recendts < QDateTime::currentDateTime())
     1321                        proginfo->SetFilesize(proginfo->filesize);
    14961322                }
    14971323            }
    1498 
    1499             proginfo->stars = query.value(31).toDouble();
    1500 
    1501             PlaybackSock *slave = NULL;
    1502 
    1503             if (proginfo->hostname != gContext->GetHostName())
    1504                 slave = getSlaveByHostname(proginfo->hostname);
    1505 
    1506             if ((proginfo->hostname == gContext->GetHostName()) ||
    1507                 (!slave && masterBackendOverride))
     1324        }
     1325        else if (!slave)
     1326        {
     1327            proginfo->pathname = GetPlaybackURL(proginfo);
     1328            if (proginfo->pathname.isEmpty())
    15081329            {
    1509                 proginfo->pathname = QString("myth://") + ip + ":" + port
    1510                                      + "/" + proginfo->pathname;
    1511                 if (proginfo->filesize == 0)
    1512                 {
    1513                     QString tmpURL = GetPlaybackURL(proginfo);
    1514                     QFile checkFile(tmpURL);
    1515                     if (!tmpURL.isEmpty() && checkFile.exists())
    1516                     {
    1517                         proginfo->filesize = checkFile.size();
    1518                         if (proginfo->recendts < QDateTime::currentDateTime())
    1519                             proginfo->SetFilesize(proginfo->filesize);
    1520                     }
    1521                 }
     1330                VERBOSE(VB_IMPORTANT,
     1331                        "MainServer::HandleQueryRecordings()"
     1332                        "\n\t\t\tCouldn't find backend for: " +
     1333                        QString("\n\t\t\t%1 : \"%2\"")
     1334                        .arg(proginfo->title).arg(proginfo->subtitle));
     1335
     1336                proginfo->filesize = 0;
     1337                proginfo->pathname = "file not found";
    15221338            }
    1523             else if (!slave)
     1339        }
     1340        else
     1341        {
     1342            if (proginfo->filesize == 0)
    15241343            {
    1525                 proginfo->pathname = GetPlaybackURL(proginfo);
    1526                 if (proginfo->pathname.isEmpty())
     1344                if (!slave->FillProgramInfo(proginfo, playbackhost))
    15271345                {
    15281346                    VERBOSE(VB_IMPORTANT,
    15291347                            "MainServer::HandleQueryRecordings()"
    1530                             "\n\t\t\tCouldn't find backend for: " +
    1531                             QString("\n\t\t\t%1 : \"%2\"")
    1532                             .arg(proginfo->title).arg(proginfo->subtitle));
    1533 
    1534                     proginfo->filesize = 0;
    1535                     proginfo->pathname = "file not found";
     1348                            "\n\t\t\tCould not fill program info "
     1349                            "from backend");
    15361350                }
    1537             }
    1538             else
    1539             {
    1540                 if (proginfo->filesize == 0)
    1541                 {
    1542                     if (!slave->FillProgramInfo(proginfo, playbackhost))
    1543                     {
    1544                         VERBOSE(VB_IMPORTANT,
    1545                                 "MainServer::HandleQueryRecordings()"
    1546                                 "\n\t\t\tCould not fill program info "
    1547                                 "from backend");
    1548                     }
    1549                     else
    1550                     {
    1551                         if (proginfo->recendts < QDateTime::currentDateTime())
    1552                             proginfo->SetFilesize(proginfo->filesize);
    1553                     }
    1554                 }
    15551351                else
    15561352                {
    1557                     ProgramInfo *p = proginfo;
    1558                     if (!backendIpMap.contains(p->hostname))
    1559                         backendIpMap[p->hostname] =
    1560                             gContext->GetSettingOnHost("BackendServerIp",
    1561                                                        p->hostname);
    1562                     if (!backendPortMap.contains(p->hostname))
    1563                         backendPortMap[p->hostname] =
    1564                             gContext->GetSettingOnHost("BackendServerPort",
    1565                                                        p->hostname);
    1566                     p->pathname = QString("myth://") +
    1567                                   backendIpMap[p->hostname] + ":" +
    1568                                   backendPortMap[p->hostname] + "/" +
    1569                                   p->pathname;
     1353                    if (proginfo->recendts < QDateTime::currentDateTime())
     1354                        proginfo->SetFilesize(proginfo->filesize);
    15701355                }
    15711356            }
     1357            else
     1358            {
     1359                ProgramInfo *p = proginfo;
     1360                if (!backendIpMap.contains(p->hostname))
     1361                    backendIpMap[p->hostname] =
     1362                        gContext->GetSettingOnHost("BackendServerIp",
     1363                                                   p->hostname);
     1364                if (!backendPortMap.contains(p->hostname))
     1365                    backendPortMap[p->hostname] =
     1366                        gContext->GetSettingOnHost("BackendServerPort",
     1367                                                   p->hostname);
     1368                p->pathname = QString("myth://") +
     1369                    backendIpMap[p->hostname] + ":" +
     1370                    backendPortMap[p->hostname] + "/" +
     1371                    p->pathname;
     1372            }
     1373        }
    15721374
    1573             if (slave)
    1574                 slave->DownRef();
     1375        if (slave)
     1376            slave->DownRef();
    15751377
    1576             proginfo->ToStringList(outputlist);
    1577 
    1578             delete proginfo;
    1579         }
     1378        proginfo->ToStringList(outputlist);
    15801379    }
    15811380
    1582     for (ri = schedList.begin(); ri != schedList.end(); ri++)
    1583         delete (*ri);
    1584 
    15851381    SendResponse(pbssock, outputlist);
    15861382}
    15871383
  • programs/mythbackend/scheduler.cpp

     
    439439void Scheduler::FillRecordListFromMaster(void)
    440440{
    441441    RecordingList schedList(false);
    442     schedList.FromScheduler();
     442    bool dummy;
     443    LoadFromScheduler(schedList, dummy);
    443444
    444445    QMutexLocker lockit(reclist_lock);
    445446
  • programs/mythwelcome/welcomedialog.h

     
    66
    77// myth
    88#include "tvremoteutil.h"
    9 #include "programinfo.h"
     9#include "programdetail.h"
    1010#include "mythscreentype.h"
    1111#include "mythuibutton.h"
    1212#include "mythuitext.h"
  • programs/mythwelcome/welcomedialog.cpp

     
    1616#include "mythdbcon.h"
    1717#include "lcddevice.h"
    1818#include "tv.h"
    19 #include "programlist.h"
    2019#include "uitypes.h"
    2120#include "compat.h"
    2221#include "mythdirs.h"
     
    520519        return false;
    521520    }
    522521
    523     ProgramList::GetProgramDetailList(
     522    GetProgramDetailList(
    524523        m_nextRecordingStart, &m_hasConflicts, &m_scheduledList);
    525524
    526525    updateStatus();
  • programs/mythshutdown/main.cpp

     
    1313#include "mythsystem.h"
    1414#include "mythverbose.h"
    1515#include "mythversion.h"
    16 #include "programinfo.h"
    17 #include "programlist.h"
     16#include "programdetail.h"
    1817#include "jobqueue.h"
    1918#include "tv.h"
    2019#include "remoteutil.h"
     
    412411    }
    413412
    414413    QDateTime nextRecordingStart;
    415     ProgramList::GetProgramDetailList(nextRecordingStart);
     414    GetProgramDetailList(nextRecordingStart);
    416415
    417416    // set the wakeup time for the next scheduled recording
    418417    if (!nextRecordingStart.isNull())