MythTV  0.25-pre
programinfo.h
Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 
00003 #ifndef MYTHPROGRAM_H_
00004 #define MYTHPROGRAM_H_
00005 
00006 // ANSI C
00007 #include <stdint.h> // for [u]int[32,64]_t
00008 #include <vector> // for GetNextRecordingList
00009 
00010 #include <QStringList>
00011 #include <QDateTime>
00012 #include <QHash>
00013 
00014 // MythTV headers
00015 #include "autodeletedeque.h"
00016 #include "recordingtypes.h"
00017 #include "programtypes.h"
00018 #include "mythdbcon.h"
00019 #include "mythexp.h"
00020 
00021 /* If NUMPROGRAMLINES gets updated following files need
00022    updates and code changes:
00023    mythplugins/mythweb/classes/MythBackend.php
00024    mythplugins/mythweb/modules/tv/classes/Program.php
00025    mythtv/bindings/perl/MythTV.pm
00026    mythtv/bindings/perl/MythTV/Program.pm
00027    mythtv/bindings/python/MythTV/MythData.py
00028 */
00029 #define NUMPROGRAMLINES 44
00030 
00031 class ProgramInfo;
00032 typedef AutoDeleteDeque<ProgramInfo*> ProgramList;
00033 
00064 class MSqlQuery;
00065 class ProgramInfoUpdater;
00066 class PMapDBReplacement;
00067 
00068 class MPUBLIC ProgramInfo
00069 {
00070     friend int pginfo_init_statics(void);
00071   public:
00073     ProgramInfo(void);
00075     ProgramInfo(const ProgramInfo &other);
00077     ProgramInfo(uint chanid, const QDateTime &recstartts);
00079     ProgramInfo(const QString &title,
00080                 const QString &subtitle,
00081                 const QString &description,
00082                 uint season,
00083                 uint episode,
00084                 const QString &category,
00085 
00086                 uint chanid,
00087                 const QString &channum,
00088                 const QString &chansign,
00089                 const QString &channame,
00090                 const QString &chanplaybackfilters,
00091 
00092                 const QString &recgroup,
00093                 const QString &playgroup,
00094 
00095                 const QString &pathname,
00096 
00097                 const QString &hostname,
00098                 const QString &storagegroup,
00099 
00100                 const QString &seriesid,
00101                 const QString &programid,
00102                 const QString &inetref,
00103 
00104                 int recpriority,
00105 
00106                 uint64_t filesize,
00107 
00108                 const QDateTime &startts,
00109                 const QDateTime &endts,
00110                 const QDateTime &recstartts,
00111                 const QDateTime &recendts,
00112 
00113                 float stars,
00114 
00115                 uint year,
00116                 const QDate &originalAirDate,
00117                 const QDateTime &lastmodified,
00118 
00119                 RecStatusType recstatus,
00120 
00121                 uint recordid,
00122 
00123                 RecordingDupInType dupin,
00124                 RecordingDupMethodType dupmethod,
00125 
00126                 uint findid,
00127 
00128                 uint programflags,
00129                 uint audioproperties,
00130                 uint videoproperties,
00131                 uint subtitleType);
00132 
00134     ProgramInfo(const QString &title,
00135                 const QString &subtitle,
00136                 const QString &description,
00137                 uint season,
00138                 uint episode,
00139                 const QString &category,
00140 
00141                 uint chanid,
00142                 const QString &channum,
00143                 const QString &chansign,
00144                 const QString &channame,
00145 
00146                 const QString &seriesid,
00147                 const QString &programid,
00148                 const QString &inetref,
00149 
00150                 const QDateTime &startts,
00151                 const QDateTime &endts,
00152                 const QDateTime &recstartts,
00153                 const QDateTime &recendts,
00154 
00155                 RecStatusType recstatus,
00156 
00157                 uint recordid,
00158 
00159                 RecordingType rectype,
00160 
00161                 uint findid,
00162 
00163                 bool duplicate);
00164 
00166     ProgramInfo(const QString &title,
00167                 const QString &subtitle,
00168                 const QString &description,
00169                 const QString &category,
00170 
00171                 uint chanid,
00172                 const QString &channum,
00173                 const QString &chansign,
00174                 const QString &channame,
00175                 const QString &chanplaybackfilters,
00176 
00177                 const QDateTime &startts,
00178                 const QDateTime &endts,
00179                 const QDateTime &recstartts,
00180                 const QDateTime &recendts,
00181 
00182                 const QString &seriesid,
00183                 const QString &programid,
00184                 const QString &catType,
00185 
00186                 float stars,
00187                 uint year,
00188                 const QDate &originalAirDate,
00189                 RecStatusType recstatus,
00190                 uint recordid,
00191                 RecordingType rectype,
00192                 uint findid,
00193 
00194                 bool commfree,
00195                 bool repeat,
00196 
00197                 uint videoprops,
00198                 uint audioprops,
00199                 uint subtitletype,
00200 
00201                 const ProgramList &schedList,
00202                 bool               oneChanid);
00204     ProgramInfo(const QString &title,
00205                 const QString &subtitle,
00206                 const QString &description,
00207                 uint season,
00208                 uint episode,
00209                 const QString &category,
00210 
00211                 uint chanid,
00212                 const QString &channum,
00213                 const QString &chansign,
00214                 const QString &channame,
00215                 const QString &chanplaybackfilters,
00216 
00217                 const QString &recgroup,
00218                 const QString &playgroup,
00219 
00220                 const QDateTime &startts,
00221                 const QDateTime &endts,
00222                 const QDateTime &recstartts,
00223                 const QDateTime &recendts,
00224 
00225                 const QString &seriesid,
00226                 const QString &programid,
00227                 const QString &inetref);
00229     ProgramInfo(const QString &pathname);
00231     ProgramInfo(const QString &pathname,
00232                 const QString &plot,
00233                 const QString &title,
00234                 const QString &subtitle,
00235                 const QString &director,
00236                 int season, int episode,
00237                 const QString &inetref,
00238                 uint length_in_minutes,
00239                 uint year,
00240                 const QString &programid);
00242     ProgramInfo(const QString &_title, uint _chanid,
00243                 const QDateTime &_startts, const QDateTime &_endts);
00245     ProgramInfo(const QString   &_title,   const QString   &_category,
00246                 const QDateTime &_startts, const QDateTime &_endts);
00247     ProgramInfo(QStringList::const_iterator &it,
00248                 QStringList::const_iterator  end) :
00249         chanid(0),
00250         positionMapDBReplacement(NULL)
00251     {
00252         if (!FromStringList(it, end))
00253             clear();
00254     }
00255     ProgramInfo(const QStringList &list) :
00256         chanid(0),
00257         positionMapDBReplacement(NULL)
00258     {
00259         QStringList::const_iterator it = list.begin();
00260         if (!FromStringList(it, list.end()))
00261             clear();
00262     }
00263 
00264     ProgramInfo &operator=(const ProgramInfo &other);
00265     virtual void clone(const ProgramInfo &other,
00266                        bool ignore_non_serialized_data = false);
00267 
00268     virtual void clear(void);
00269 
00270     // Destructor
00271     virtual ~ProgramInfo();
00272 
00273     // Serializers
00274     void ToStringList(QStringList &list) const;
00275     virtual void ToMap(QHash<QString, QString> &progMap,
00276                        bool showrerecord = false,
00277                        uint star_range = 10) const;
00278     virtual void SubstituteMatches(QString &str);
00279 
00280     // Used for scheduling recordings
00281     bool IsSameProgram(const ProgramInfo &other) const;
00282     bool IsSameTimeslot(const ProgramInfo &other) const;
00283     bool IsSameProgramTimeslot(const ProgramInfo &other) const;//sched only
00284     static int GetRecordingTypeRecPriority(RecordingType type);//sched only
00285     static bool UsingProgramIDAuthority(void)
00286     { 
00287         return usingProgIDAuth;
00288     };
00289     static void CheckProgramIDAuthorities(void);//sched only
00290 
00291     // Used for extending scheduled recordings
00292     bool IsSameProgramWeakCheck(const ProgramInfo &other) const;
00293     bool IsSameRecording(const ProgramInfo &other) const
00294         { return chanid == other.chanid && recstartts == other.recstartts; }
00295 
00296     // Quick gets
00299     QString MakeUniqueKey(void) const
00300         { return MakeUniqueKey(chanid, recstartts); }
00301     uint GetSecondsInRecording(void) const;
00302     QString ChannelText(const QString&) const;
00303     QString GetPathname(void) const { return pathname; }
00304     QString GetBasename(void) const { return pathname.section('/', -1); }
00305     bool IsVideoFile(void) const
00306         { return GetProgramInfoType() == kProgramInfoTypeVideoFile; }
00307     bool IsVideoDVD(void) const
00308         { return GetProgramInfoType() == kProgramInfoTypeVideoDVD; }
00309     bool IsVideoBD(void) const
00310         { return GetProgramInfoType() == kProgramInfoTypeVideoBD; }
00311     bool IsLocal(void) const { return pathname.left(1) == "/"
00312 #ifdef _WIN32
00313         || pathname.at(1) == ':'
00314 #endif
00315             ; }
00316     bool IsMythStream(void) const { return pathname.left(7) == "myth://"; }
00317     bool IsPathSet(void) const { return GetBasename() != pathname; }
00318     bool HasPathname(void) const { return !GetPathname().isEmpty(); }
00319     bool IsFileReadable(void) const;
00320 
00321     QString GetTitle(void)        const { return title; }
00322     QString GetSubtitle(void)     const { return subtitle; }
00323     QString GetDescription(void)  const { return description; }
00324     uint    GetSeason(void)       const { return season; }
00325     uint    GetEpisode(void)      const { return episode; }
00326     QString GetCategory(void)     const { return category; }
00329     uint    GetChanID(void)       const { return chanid; }
00333     QString GetChanNum(void)      const { return chanstr; }
00340     QString GetChannelSchedulingID(void) const { return chansign; }
00343     QString GetChannelName(void)  const { return channame; }
00344     QString GetChannelPlaybackFilters(void) const
00345         { return chanplaybackfilters; }
00347     QDateTime GetScheduledStartTime(void) const { return startts; }
00349     QString GetScheduledStartTime(MythDateFormat fmt) const
00350     {
00351         return (MythDate != fmt) ? startts.toString((Qt::DateFormat)fmt) :
00352             startts.toString("yyyyMMddhhmmss");
00353     }
00355     QDateTime GetScheduledEndTime(void)   const { return endts; }
00357     QString GetScheduledEndTime(MythDateFormat fmt) const
00358     {
00359         return (MythDate != fmt) ? endts.toString((Qt::DateFormat)fmt) :
00360             endts.toString("yyyyMMddhhmmss");
00361     }
00363     QDateTime GetRecordingStartTime(void) const { return recstartts; }
00365     QString GetRecordingStartTime(MythDateFormat fmt) const
00366     {
00367         return (MythDate != fmt) ? recstartts.toString((Qt::DateFormat)fmt) :
00368             recstartts.toString("yyyyMMddhhmmss");
00369     }
00372     QDateTime GetRecordingEndTime(void)   const { return recendts; }
00375     QString GetRecordingEndTime(MythDateFormat fmt) const
00376     {
00377         return (MythDate != fmt) ? recendts.toString((Qt::DateFormat)fmt) :
00378             recendts.toString("yyyyMMddhhmmss");
00379     }
00380     QString GetRecordingGroup(void)       const { return recgroup;     }
00381     QString GetPlaybackGroup(void)        const { return playgroup;    }
00382     QString GetHostname(void)             const { return hostname;     }
00383     QString GetStorageGroup(void)         const { return storagegroup; }
00384     uint    GetYearOfInitialRelease(void) const
00385     {
00386         return ((year) ? year :
00387                 (originalAirDate.isValid()) ? originalAirDate.year() : 0);
00388     }
00389     QDate   GetOriginalAirDate(void)      const { return originalAirDate; }
00390     QDateTime GetLastModifiedTime(void)   const { return lastmodified; }
00391     QString GetLastModifiedTime(MythDateFormat fmt) const
00392     {
00393         return (MythDate != fmt) ? lastmodified.toString((Qt::DateFormat)fmt) :
00394             lastmodified.toString("yyyyMMddhhmmss");
00395     }
00396     uint64_t GetFilesize(void)            const { return filesize;     }
00397     QString GetSeriesID(void)             const { return seriesid;     }
00398     QString GetProgramID(void)            const { return programid;    }
00399     QString GetInetRef(void)              const { return inetref;      }
00400     QString GetCategoryType(void)         const { return catType;      }
00401     int     GetRecordingPriority(void)    const { return recpriority;  }
00402     int     GetRecordingPriority2(void)   const { return recpriority2; }
00403     float   GetStars(void)                const { return stars;        }
00404     uint    GetStars(uint range_max)      const
00405         { return (int)(stars * range_max + 0.5f); }
00406 
00407     RecStatusType GetRecordingStatus(void)    const
00408         { return (RecStatusType)recstatus; }
00409     RecStatusType GetOldRecordingStatus(void) const
00410         { return (RecStatusType)oldrecstatus; }
00411     uint    GetPreferedInputID(void)          const { return prefinput; }
00412     uint    GetRecordingRuleID(void)          const { return recordid;  }
00413     uint    GetParentRecordingRuleID(void)    const { return parentid;  }
00414     RecordingType GetRecordingRuleType(void)  const
00415         { return (RecordingType)rectype;   }
00416 
00418     RecordingDupInType GetDuplicateCheckSource(void) const
00419         { return (RecordingDupInType)dupin; }
00420 
00422     RecordingDupMethodType GetDuplicateCheckMethod(void) const
00423         { return (RecordingDupMethodType)dupmethod; }
00424 
00425     uint    GetSourceID(void)             const { return sourceid;     }
00426     uint    GetInputID(void)              const { return inputid;      }
00427     uint    GetCardID(void)               const { return cardid;       }
00428 
00429     uint    GetFindID(void)               const { return findid;       }
00430 
00431     uint32_t GetProgramFlags(void)        const { return programflags; }
00432     ProgramInfoType GetProgramInfoType(void) const
00433         { return (ProgramInfoType)((programflags & FL_TYPEMASK) >> 16); }
00434     bool IsInUsePlaying(void)   const { return programflags & FL_INUSEPLAYING;}
00435     bool IsCommercialFree(void) const { return programflags & FL_CHANCOMMFREE;}
00436     bool HasCutlist(void)       const { return programflags & FL_CUTLIST;     }
00437     bool IsBookmarkSet(void)    const { return programflags & FL_BOOKMARK;    }
00438     bool IsWatched(void)        const { return programflags & FL_WATCHED;     }
00439     bool IsAutoExpirable(void)  const { return programflags & FL_AUTOEXP;     }
00440     bool IsPreserved(void)      const { return programflags & FL_PRESERVED;   }
00441     bool IsVideo(void)          const { return programflags & FL_TYPEMASK;    }
00442     bool IsRecording(void)      const { return !IsVideo();                    }
00443     bool IsRepeat(void)         const { return programflags & FL_REPEAT;      }
00444     bool IsDuplicate(void)      const { return programflags & FL_DUPLICATE;   }
00445     bool IsReactivated(void)    const { return programflags & FL_REACTIVATE;  }
00446     bool IsDeletePending(void)  const
00447         { return programflags & FL_DELETEPENDING; }
00448 
00449     uint GetSubtitleType(void)    const
00450         { return (properties&kSubtitlePropertyMask)>>kSubtitlePropertyOffset; }
00451     uint GetVideoProperties(void) const
00452         { return (properties & kVideoPropertyMask) >> kVideoPropertyOffset; }
00453     uint GetAudioProperties(void) const
00454         { return (properties & kAudioPropertyMask) >> kAudioPropertyOffset; }
00455 
00456     typedef enum
00457     {
00458         kLongDescription,
00459         kTitleSubtitle,
00460         kRecordingKey,
00461         kSchedulingKey,
00462     } Verbosity;
00463     QString toString(Verbosity v = kLongDescription, QString sep = ":",
00464                      QString grp = "\"") const;
00465 
00466     // Quick sets
00467     void SetTitle(const QString &t) { title = t; title.detach(); }
00468     void SetProgramInfoType(ProgramInfoType t)
00469         { programflags &= ~FL_TYPEMASK; programflags |= ((uint32_t)t<<16); }
00470     void SetPathname(const QString&) const;
00471     void SetChanID(uint _chanid) { chanid = _chanid; }
00472     void SetScheduledStartTime(const QDateTime &dt) { startts      = dt;    }
00473     void SetScheduledEndTime(  const QDateTime &dt) { endts        = dt;    }
00474     void SetRecordingStartTime(const QDateTime &dt) { recstartts   = dt;    }
00475     void SetRecordingEndTime(  const QDateTime &dt) { recendts     = dt;    }
00476     void SetRecordingGroup(const QString &group)    { recgroup     = group; }
00477     void SetPlaybackGroup( const QString &group)    { playgroup    = group; }
00478     void SetHostname(      const QString &host)     { hostname     = host;  }
00479     void SetStorageGroup(  const QString &group)    { storagegroup = group; }
00480     void SetFilesize(      uint64_t       sz)       { filesize     = sz;    }
00481     void SetSeriesID(      const QString &id)       { seriesid     = id;    }
00482     void SetProgramID(     const QString &id)       { programid    = id;    }
00483     void SetCategoryType(  const QString &type)     { catType      = type;  }
00484     void SetRecordingPriority(int priority)       { recpriority = priority; }
00485     void SetRecordingPriority2(int priority)     { recpriority2 = priority; }
00486     void SetRecordingRuleID(uint id)                { recordid     = id;    }
00487     void SetSourceID(uint id)                       { sourceid     = id;    }
00488     void SetInputID( uint id)                       { inputid      = id;    }
00489     void SetCardID(  uint id)                       { cardid       = id;    }
00490     void SetReactivated(bool reactivate)
00491     {
00492         programflags &= ~FL_REACTIVATE;
00493         programflags |= (reactivate) ? FL_REACTIVATE : 0;
00494     }
00495     void SetEditing(bool editing)
00496     {
00497         programflags &= ~FL_EDITING;
00498         programflags |= (editing) ? FL_EDITING : 0;
00499     }
00500     void SetFlagging(bool flagging)
00501     {
00502         programflags &= ~FL_COMMFLAG;
00503         programflags |= (flagging) ? FL_COMMFLAG : 0;
00504     }
00507     void SetIgnoreBookmark(bool ignore)
00508     {
00509         programflags &= ~FL_IGNOREBOOKMARK;
00510         programflags |= (ignore) ? FL_IGNOREBOOKMARK : 0;
00511     }
00512     void SetRecordingStatus(RecStatusType status) { recstatus = status; }
00513     void SetRecordingRuleType(RecordingType type) { rectype   = type;   }
00514     void SetPositionMapDBReplacement(PMapDBReplacement *pmap)
00515         { positionMapDBReplacement = pmap; }
00516 
00517     // Slow DB gets
00518     QString     QueryBasename(void) const;
00519     uint64_t    QueryFilesize(void) const;
00520     uint        QueryMplexID(void) const;
00521     QDateTime   QueryBookmarkTimeStamp(void) const;
00522     uint64_t    QueryBookmark(void) const;
00523     QString     QueryCategoryType(void) const;
00524     QStringList QueryDVDBookmark(const QString &serialid) const;
00525     bool        QueryIsEditing(void) const;
00526     bool        QueryIsInUse(QStringList &byWho) const;
00527     bool        QueryIsInUse(QString &byWho) const;
00528     bool        QueryIsDeleteCandidate(bool one_player_allowed = false) const;
00529     AutoExpireType QueryAutoExpire(void) const;
00530     TranscodingStatus QueryTranscodeStatus(void) const;
00531     bool        QueryTuningInfo(QString &channum, QString &input) const;
00532     uint        QueryAverageWidth(void) const;
00533     uint        QueryAverageHeight(void) const;
00534     uint        QueryAverageFrameRate(void) const;
00535     int64_t     QueryTotalDuration(void) const;
00536     int64_t     QueryTotalFrames(void) const;
00537     QString     QueryRecordingGroup(void) const;
00538     bool        QueryMarkupFlag(MarkTypes type) const;
00539     uint        QueryTranscoderID(void) const;
00540     uint64_t    QueryLastFrameInPosMap(void) const;
00541     bool        Reload(void);
00542 
00543     // Slow DB sets
00544     void SaveFilesize(uint64_t fsize);
00545     void SaveBookmark(uint64_t frame);
00546     void SaveDVDBookmark(const QStringList &fields) const;
00547     void SaveEditing(bool edit);
00548     void SaveTranscodeStatus(TranscodingStatus transFlag);
00549     void SaveWatched(bool watchedFlag);
00550     void SaveDeletePendingFlag(bool deleteFlag);
00551     void SaveCommFlagged(CommFlagStatus flag); // 1 = flagged, 2 = processing
00552     void SaveAutoExpire(AutoExpireType autoExpire, bool updateDelete = false);
00553     void SavePreserve(bool preserveEpisode);
00554     bool SaveBasename(const QString &basename);
00555     void SaveAspect(uint64_t frame, MarkTypes type, uint customAspect);
00556     void SaveResolution(uint64_t frame, uint width, uint height);
00557     void SaveFrameRate(uint64_t frame, uint framerate);
00558     void SaveTotalDuration(int64_t duration);
00559     void SaveTotalFrames(int64_t frames);
00560     void SaveVideoProperties(uint mask, uint video_property_flags);
00561     void SaveMarkupFlag(MarkTypes type) const;
00562     void ClearMarkupFlag(MarkTypes type) const { ClearMarkupMap(type); }
00563     void UpdateLastDelete(bool setTime) const;
00564     void MarkAsInUse(bool inuse, QString usedFor = "");
00565     void UpdateInUseMark(bool force = false);
00566     void SaveSeasonEpisode(uint seas, uint ep);
00567     void SaveInetRef(const QString &inet);
00568 
00569     // Extremely slow functions that cannot be called from the UI thread.
00570     QString DiscoverRecordingDirectory(void) const;
00571     QString GetPlaybackURL(bool checkMaster = false,
00572                            bool forceCheckLocal = false) const;
00573     ProgramInfoType DiscoverProgramInfoType(void) const;
00574 
00575     // Edit flagging map
00576     bool QueryCutList(frm_dir_map_t &, bool loadAutosave=false) const;
00577     void SaveCutList(frm_dir_map_t &, bool isAutoSave=false) const;
00578 
00579     // Commercial flagging map
00580     void QueryCommBreakList(frm_dir_map_t &) const;
00581     void SaveCommBreakList(frm_dir_map_t &) const;
00582 
00583     // Keyframe positions map
00584     void QueryPositionMap(frm_pos_map_t &, MarkTypes type) const;
00585     void ClearPositionMap(MarkTypes type) const;
00586     void SavePositionMap(frm_pos_map_t &, MarkTypes type,
00587                          int64_t min_frm = -1, int64_t max_frm = -1) const;
00588     void SavePositionMapDelta(frm_pos_map_t &, MarkTypes type) const;
00589 
00591     void SendUpdateEvent(void);
00593     void SendAddedEvent(void) const;
00595     void SendDeletedEvent(void) const;
00596 
00598     static QString i18n(const QString&);
00599 
00600     static QString MakeUniqueKey(uint chanid, const QDateTime &recstartts);
00601     static bool ExtractKey(const QString &uniquekey,
00602                            uint &chanid, QDateTime &recstartts);
00603     static bool ExtractKeyFromPathname(
00604         const QString &pathname, uint &chanid, QDateTime &recstartts);
00605     static bool QueryKeyFromPathname(
00606         const QString &pathname, uint &chanid, QDateTime &recstartts);
00607 
00608     static QString  QueryRecordingGroupPassword(const QString &group);
00609     static uint64_t QueryBookmark(uint chanid, const QDateTime &recstartts);
00610     static QMap<QString,uint32_t> QueryInUseMap(void);
00611     static QMap<QString,bool> QueryJobsRunning(int type);
00612     static QStringList LoadFromScheduler(const QString &altTable, int recordid);
00613 
00614   protected:
00615     // Flagging map support methods
00616     void QueryMarkupMap(frm_dir_map_t&, MarkTypes type,
00617                         bool merge = false) const;
00618     void SaveMarkupMap(const frm_dir_map_t &, MarkTypes type = MARK_ALL,
00619                        int64_t min_frm = -1, int64_t max_frm = -1) const;
00620     void ClearMarkupMap(MarkTypes type = MARK_ALL,
00621                         int64_t min_frm = -1, int64_t max_frm = -1) const;
00622 
00623     // Creates a basename from the start and end times
00624     QString CreateRecordBasename(const QString &ext) const;
00625 
00626     bool  LoadProgramFromRecorded(
00627         const uint chanid, const QDateTime &recstarttime);
00628 
00629     bool FromStringList(QStringList::const_iterator &it,
00630                         QStringList::const_iterator  end);
00631 
00632     static void QueryMarkupMap(
00633         const QString &video_pathname,
00634         frm_dir_map_t&, MarkTypes type, bool merge = false);
00635     static void QueryMarkupMap(
00636         uint chanid, const QDateTime &recstartts,
00637         frm_dir_map_t&, MarkTypes type, bool merge = false);
00638 
00639     static int InitStatics(void);
00640 
00641   protected:
00642     QString title;
00643     QString subtitle;
00644     QString description;
00645     uint    season;
00646     uint    episode;
00647     QString category;
00648 
00649     int32_t recpriority;
00650 
00651     uint32_t chanid;
00652     QString chanstr;
00653     QString chansign;
00654     QString channame;
00655     QString chanplaybackfilters;
00656 
00657     QString recgroup;
00658     QString playgroup;
00659 
00660     mutable QString pathname;
00661 
00662     QString hostname;
00663     QString storagegroup;
00664 
00665     QString seriesid;
00666     QString programid;
00667     QString inetref;
00668     QString catType;
00669 
00670     uint64_t filesize;
00671 
00672     QDateTime startts;
00673     QDateTime endts;
00674     QDateTime recstartts;
00675     QDateTime recendts;
00676 
00677     float stars; 
00678     QDate originalAirDate;
00679     QDateTime lastmodified;
00680     QDateTime lastInUseTime;
00681 
00682     uint32_t prefinput;
00683     int32_t recpriority2;
00684 
00685     uint32_t recordid;
00686     uint32_t parentid;
00687 
00688     uint32_t sourceid;
00689     uint32_t inputid;
00690     uint32_t cardid;
00691     uint32_t findid;
00692 
00693     uint32_t programflags;    
00694     uint16_t properties;      
00695     uint16_t year;
00696 
00697     int8_t recstatus;
00698     int8_t oldrecstatus;
00699     uint8_t rectype;
00700     uint8_t dupin;
00701     uint8_t dupmethod;
00702 
00703 // everything below this line is not serialized
00704     uint8_t availableStatus; // only used for playbackbox.cpp
00705   public:
00706     void SetAvailableStatus(AvailableStatusType status, const QString &where);
00707     AvailableStatusType GetAvailableStatus(void) const
00708         { return (AvailableStatusType) availableStatus; }
00709     int8_t spread;   // only used in guidegrid.cpp
00710     int8_t startCol; // only used in guidegrid.cpp
00711     QString sortTitle; // only use for sorting in frontend
00712 
00713     static const QString kFromRecordedQuery;
00714 
00715   protected:
00716     QString inUseForWhat;
00717     PMapDBReplacement *positionMapDBReplacement;
00718 
00719     static QMutex staticDataLock;
00720     static ProgramInfoUpdater *updater;
00721     static bool usingProgIDAuth;
00722 };
00723 
00724 Q_DECLARE_METATYPE(ProgramInfo*)
00725 
00726 MPUBLIC bool LoadFromProgram(
00727     ProgramList        &destination,
00728     const QString      &sql,
00729     const MSqlBindings &bindings,
00730     const ProgramList  &schedList,
00731     bool                oneChanid);
00732 
00733 MPUBLIC bool LoadFromOldRecorded(
00734     ProgramList        &destination,
00735     const QString      &sql,
00736     const MSqlBindings &bindings);
00737 
00738 MPUBLIC bool LoadFromRecorded(
00739     ProgramList        &destination,
00740     bool                possiblyInProgressRecordingsOnly,
00741     const QMap<QString,uint32_t> &inUseMap,
00742     const QMap<QString,bool> &isJobRunning,
00743     const QMap<QString, ProgramInfo*> &recMap,
00744     int                 sort = 0);
00745 
00746 template<typename TYPE>
00747 bool LoadFromScheduler(
00748     AutoDeleteDeque<TYPE*> &destination,
00749     bool               &hasConflicts,
00750     QString             altTable = "",
00751     int                 recordid = -1)
00752 {
00753     destination.clear();
00754     hasConflicts = false;
00755 
00756     QStringList slist = ProgramInfo::LoadFromScheduler(altTable, recordid);
00757     if (slist.empty())
00758         return false;
00759 
00760     hasConflicts = slist[0].toInt();
00761 
00762     QStringList::const_iterator sit = slist.begin()+2;
00763     while (sit != slist.end())
00764     {
00765         TYPE *p = new TYPE(sit, slist.end());
00766         destination.push_back(p);
00767         if (!p->HasPathname() && !p->GetChanID())
00768         {
00769             destination.clear();
00770             return false;
00771         }
00772     }
00773 
00774     if (destination.size() != slist[1].toUInt())
00775     {
00776         destination.clear();
00777         return false;
00778     }
00779 
00780     return true;
00781 }
00782 
00783 template<typename T>
00784 bool LoadFromScheduler(AutoDeleteDeque<T> &destination)
00785 {
00786     bool dummyConflicts;
00787     return LoadFromScheduler(destination, dummyConflicts, "", -1);
00788 }
00789 
00790 // Moved from programdetails.cpp/h, used by MythWelcome/MythShutdown
00791 // could be factored out
00792 MPUBLIC bool GetNextRecordingList(QDateTime &nextRecordingStart,
00793                                   bool *hasConflicts = NULL,
00794                                   vector<ProgramInfo> *list = NULL);
00795 
00796 class QMutex;
00797 class MPUBLIC PMapDBReplacement
00798 {
00799   public:
00800     PMapDBReplacement();
00801    ~PMapDBReplacement();
00802     QMutex *lock;
00803     QMap<MarkTypes,frm_pos_map_t> map;
00804 };
00805 
00806 #endif // MYTHPROGRAM_H_
00807 
00808 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends