MythTV  0.26-pre
recordinginfo.h
Go to the documentation of this file.
00001 #ifndef _RECORDING_INFO_H_
00002 #define _RECORDING_INFO_H_
00003 
00004 #include "mythtvexp.h"
00005 #include "programinfo.h"
00006 
00007 class RecordingRule;
00008 
00017 // Note: methods marked with "//pi" could be moved to ProgramInfo without
00018 // breaking linkage or adding new classes to libmyth. For some of them
00019 // RecordingRule::signalChange would need to be moved to remoteutil.{cpp,h},
00020 // but that is a static method which is fairly easy to move.
00021 // These methods are in RecordingInfo because it currently makes sense
00022 // for them to be in this class in terms of related functions being here.
00023 
00024 class RecordingInfo;
00025 class RecordingRule;
00026 
00027 typedef AutoDeleteDeque<RecordingInfo*> RecordingList;
00028 
00029 class MTV_PUBLIC RecordingInfo : public ProgramInfo
00030 {
00031   public:
00032     RecordingInfo(void) : 
00033         oldrecstatus(rsUnknown),
00034         savedrecstatus(rsUnknown),
00035         future(false),
00036         record(NULL) {}
00037     RecordingInfo(const RecordingInfo &other) :
00038         ProgramInfo(other),
00039         oldrecstatus(other.oldrecstatus),
00040         savedrecstatus(other.savedrecstatus),
00041         future(other.future),
00042         record(NULL) {}
00043     RecordingInfo(const ProgramInfo &other) :
00044         ProgramInfo(other),
00045         oldrecstatus(rsUnknown),
00046         savedrecstatus(rsUnknown),
00047         future(false),
00048         record(NULL) {}
00049     RecordingInfo(uint _chanid, const QDateTime &_recstartts) :
00050         ProgramInfo(_chanid, _recstartts),
00051         oldrecstatus(rsUnknown),
00052         savedrecstatus(rsUnknown),
00053         future(false),
00054         record(NULL) {}
00055     RecordingInfo(QStringList::const_iterator &it,
00056                   QStringList::const_iterator  end) :
00057         ProgramInfo(it, end),
00058         oldrecstatus(rsUnknown),
00059         savedrecstatus(rsUnknown),
00060         future(false),
00061         record(NULL) {}
00064     RecordingInfo(
00065         const QString &title,
00066         const QString &subtitle,
00067         const QString &description,
00068         uint season,
00069         uint episode,
00070         const QString &category,
00071 
00072         uint chanid,
00073         const QString &chanstr,
00074         const QString &chansign,
00075         const QString &channame,
00076 
00077         const QString &recgroup,
00078         const QString &playgroup,
00079 
00080         const QString &hostname,
00081         const QString &storagegroup,
00082 
00083         uint year,
00084 
00085         const QString &seriesid,
00086         const QString &programid,
00087         const QString &inetref,
00088         const QString &catType,
00089 
00090         int recpriority,
00091 
00092         const QDateTime &startts,
00093         const QDateTime &endts,
00094         const QDateTime &recstartts,
00095         const QDateTime &recendts,
00096 
00097         float stars,
00098         const QDate &originalAirDate,
00099 
00100         bool repeat,
00101 
00102         RecStatusType oldrecstatus,
00103         bool reactivate,
00104 
00105         uint recordid,
00106         uint parentid,
00107         RecordingType rectype,
00108         RecordingDupInType dupin,
00109         RecordingDupMethodType dupmethod,
00110 
00111         uint sourceid,
00112         uint inputid,
00113         uint cardid,
00114 
00115         uint findid,
00116 
00117         bool commfree,
00118         uint subtitleType,
00119         uint videoproperties,
00120         uint audioproperties,
00121         bool future);
00122 
00125     RecordingInfo(
00126         const QString &title,
00127         const QString &subtitle,
00128         const QString &description,
00129         uint season,
00130         uint episode,
00131         const QString &category,
00132 
00133         uint chanid,
00134         const QString &chanstr,
00135         const QString &chansign,
00136         const QString &channame,
00137 
00138         const QString &recgroup,
00139         const QString &playgroup,
00140 
00141         const QString &seriesid,
00142         const QString &programid,
00143         const QString &inetref,
00144 
00145         int recpriority,
00146 
00147         const QDateTime &startts,
00148         const QDateTime &endts,
00149         const QDateTime &recstartts,
00150         const QDateTime &recendts,
00151 
00152         RecStatusType recstatus,
00153 
00154         uint recordid,
00155         RecordingType rectype,
00156         RecordingDupInType dupin,
00157         RecordingDupMethodType dupmethod,
00158 
00159         uint findid,
00160 
00161         bool commfree);
00162 
00163     // Create ProgramInfo that overlaps the desired time on the
00164     // specified channel id.
00165     typedef enum {
00166         kNoProgram           = 0,
00167         kFoundProgram        = 1,
00168         kFakedLiveTVProgram  = 2,
00169         kFakedZeroMinProgram = 3,
00170     } LoadStatus;
00171     RecordingInfo(uint _chanid, const QDateTime &desiredts,
00172                   bool genUnknown, uint maxHours = 0,
00173                   LoadStatus *status = NULL);
00174 
00175   public:
00176     RecordingInfo &operator=(const RecordingInfo &other)
00177         { clone(other); return *this; }
00178     RecordingInfo &operator=(const ProgramInfo &other)
00179         { clone(other); return *this; }
00180     virtual void clone(const RecordingInfo &other,
00181                        bool ignore_non_serialized_data = false);
00182     virtual void clone(const ProgramInfo &other,
00183                        bool ignore_non_serialized_data = false);
00184 
00185     virtual void clear(void);
00186 
00187     // Destructor
00188     virtual ~RecordingInfo();
00189 
00190     // Serializers
00191     virtual void SubstituteMatches(QString &str);
00192 
00193     // Quick gets
00196     QString MakeUniqueSchedulerKey(void) const
00197         { return MakeUniqueKey(chanid, startts); }
00198 
00199     // Used to query and set RecordingRule info
00200     RecordingRule *GetRecordingRule(void);
00201     int getRecordID(void);
00202     int GetAutoRunJobs(void) const;
00203     RecordingType GetProgramRecordingStatus(void);
00204     QString GetProgramRecordingProfile(void) const;
00205     void ApplyRecordStateChange(RecordingType newstate, bool save = true);
00206     void ApplyRecordRecPriorityChange(int);
00207     void ToggleRecord(void);
00208 
00209     // these five can be moved to programinfo
00210     void AddHistory(bool resched = true, bool forcedup = false, 
00211                     bool future = false);//pi
00212     void DeleteHistory(void);//pi
00213     void ForgetHistory(void);//pi
00214     void SetDupHistory(void);//pi
00215 
00216     // Used to update database with recording info
00217     void StartedRecording(QString ext);
00218     void FinishedRecording(bool allowReRecord);
00219     void UpdateRecordingEnd(void);//pi
00220     void ReactivateRecording(void);//pi
00221     void ApplyRecordRecID(void);//pi
00222     void ApplyRecordRecGroupChange(const QString &newrecgroup);
00223     void ApplyRecordPlayGroupChange(const QString &newrecgroup);
00224     void ApplyStorageGroupChange(const QString &newstoragegroup);
00225     void ApplyRecordRecTitleChange(const QString &newTitle,
00226                                    const QString &newSubtitle,
00227                                    const QString &newDescription);
00228     void ApplyTranscoderProfileChange(const QString &profile) const;//pi
00229     void ApplyTranscoderProfileChangeById(int);
00230 
00231     RecStatusType oldrecstatus;
00232     RecStatusType savedrecstatus;
00233     bool future;
00234 
00235   private:
00236     mutable class RecordingRule *record;
00237 
00238   protected:
00239     static bool InsertProgram(const RecordingInfo *pg,
00240                               const RecordingRule *rule);
00241 
00242     static QString unknownTitle;
00243 };
00244 
00245 Q_DECLARE_METATYPE(RecordingInfo*)
00246 Q_DECLARE_METATYPE(RecordingInfo)
00247 
00248 #endif // _RECORDING_INFO_H_
00249 
00250 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends