MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
programinfo.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef MYTHPROGRAM_H_
4 #define MYTHPROGRAM_H_
5 
6 // ANSI C
7 #include <stdint.h> // for [u]int[32,64]_t
8 #include <vector> // for GetNextRecordingList
9 
10 #include <QStringList>
11 #include <QDateTime>
12 #include <QHash>
13 
14 // MythTV headers
15 #include "autodeletedeque.h"
16 #include "recordingtypes.h"
17 #include "programtypes.h"
18 #include "mythdbcon.h"
19 #include "mythexp.h"
20 #include "mythdate.h"
21 
22 /* If NUMPROGRAMLINES gets updated following files need
23  updates and code changes:
24  mythweb/modules/tv/classes/Program.php (layout)
25  mythtv/bindings/perl/MythTV.pm (version number)
26  mythtv/bindings/perl/MythTV/Program.pm (layout)
27  mythtv/bindings/php/MythBackend.php (version number)
28  mythtv/bindings/php/MythTVProgram.php (layout)
29  mythtv/bindings/php/MythTVRecording.php (layout)
30  mythtv/bindings/python/MythTV/static.py (version number)
31  mythtv/bindings/python/MythTV/mythproto.py (layout)
32 */
33 #define NUMPROGRAMLINES 47
34 
37 
68 class MSqlQuery;
69 class ProgramInfoUpdater;
70 class PMapDBReplacement;
71 
72 class MPUBLIC ProgramInfo
73 {
74  friend int pginfo_init_statics(void);
75  public:
76  enum CategoryType { kCategoryNone, kCategoryMovie, kCategorySeries,
77  kCategorySports, kCategoryTVShow };
78 
80  ProgramInfo(void);
82  ProgramInfo(const ProgramInfo &other);
84  ProgramInfo(uint chanid, const QDateTime &recstartts);
86  ProgramInfo(const QString &title,
87  const QString &subtitle,
88  const QString &description,
89  uint season,
90  uint episode,
91  const QString &syndicatedepisode,
92  const QString &category,
93 
94  uint chanid,
95  const QString &channum,
96  const QString &chansign,
97  const QString &channame,
98  const QString &chanplaybackfilters,
99 
100  const QString &recgroup,
101  const QString &playgroup,
102 
103  const QString &pathname,
104 
105  const QString &hostname,
106  const QString &storagegroup,
107 
108  const QString &seriesid,
109  const QString &programid,
110  const QString &inetref,
111 
112  int recpriority,
113 
114  uint64_t filesize,
115 
116  const QDateTime &startts,
117  const QDateTime &endts,
118  const QDateTime &recstartts,
119  const QDateTime &recendts,
120 
121  float stars,
122 
123  uint year,
124  uint partnumber,
125  uint parttotal,
126 
127  const QDate &originalAirDate,
128  const QDateTime &lastmodified,
129 
130  RecStatusType recstatus,
131 
132  uint recordid,
133 
134  RecordingDupInType dupin,
135  RecordingDupMethodType dupmethod,
136 
137  uint findid,
138 
139  uint programflags,
140  uint audioproperties,
141  uint videoproperties,
142  uint subtitleType);
143 
145  ProgramInfo(const QString &title,
146  const QString &subtitle,
147  const QString &description,
148  uint season,
149  uint episode,
150  const QString &category,
151 
152  uint chanid,
153  const QString &channum,
154  const QString &chansign,
155  const QString &channame,
156 
157  const QString &seriesid,
158  const QString &programid,
159  const QString &inetref,
160 
161  const QDateTime &startts,
162  const QDateTime &endts,
163  const QDateTime &recstartts,
164  const QDateTime &recendts,
165 
166  RecStatusType recstatus,
167 
168  uint recordid,
169 
170  RecordingType rectype,
171 
172  uint findid,
173 
174  bool duplicate);
175 
177  ProgramInfo(const QString &title,
178  const QString &subtitle,
179  const QString &description,
180  const QString &syndicatedepisode,
181  const QString &category,
182 
183  uint chanid,
184  const QString &channum,
185  const QString &chansign,
186  const QString &channame,
187  const QString &chanplaybackfilters,
188 
189  const QDateTime &startts,
190  const QDateTime &endts,
191  const QDateTime &recstartts,
192  const QDateTime &recendts,
193 
194  const QString &seriesid,
195  const QString &programid,
196  const CategoryType catType,
197 
198  float stars,
199  uint year,
200  uint partnumber,
201  uint parttotal,
202  const QDate &originalAirDate,
203  RecStatusType recstatus,
204  uint recordid,
205  RecordingType rectype,
206  uint findid,
207 
208  bool commfree,
209  bool repeat,
210 
211  uint videoprops,
212  uint audioprops,
213  uint subtitletype,
214 
215  const ProgramList &schedList);
217  ProgramInfo(const QString &title,
218  const QString &subtitle,
219  const QString &description,
220  uint season,
221  uint episode,
222  const QString &category,
223 
224  uint chanid,
225  const QString &channum,
226  const QString &chansign,
227  const QString &channame,
228  const QString &chanplaybackfilters,
229 
230  const QString &recgroup,
231  const QString &playgroup,
232 
233  const QDateTime &startts,
234  const QDateTime &endts,
235  const QDateTime &recstartts,
236  const QDateTime &recendts,
237 
238  const QString &seriesid,
239  const QString &programid,
240  const QString &inetref);
242  ProgramInfo(const QString &pathname);
244  ProgramInfo(const QString &pathname,
245  const QString &plot,
246  const QString &title,
247  const QString &subtitle,
248  const QString &director,
249  int season, int episode,
250  const QString &inetref,
251  uint length_in_minutes,
252  uint year,
253  const QString &programid);
255  ProgramInfo(const QString &_title, uint _chanid,
256  const QDateTime &_startts, const QDateTime &_endts);
258  ProgramInfo(const QString &_title, const QString &_category,
259  const QDateTime &_startts, const QDateTime &_endts);
260  ProgramInfo(QStringList::const_iterator &it,
261  QStringList::const_iterator end) :
262  chanid(0),
263  positionMapDBReplacement(NULL)
264  {
265  if (!FromStringList(it, end))
266  clear();
267  }
268  ProgramInfo(const QStringList &list) :
269  chanid(0),
270  positionMapDBReplacement(NULL)
271  {
272  QStringList::const_iterator it = list.begin();
273  if (!FromStringList(it, list.end()))
274  clear();
275  }
276 
277  ProgramInfo &operator=(const ProgramInfo &other);
278  virtual void clone(const ProgramInfo &other,
279  bool ignore_non_serialized_data = false);
280 
281  virtual void clear(void);
282 
283  // Destructor
284  virtual ~ProgramInfo();
285 
286  // Serializers
287  void ToStringList(QStringList &list) const;
288  virtual void ToMap(QHash<QString, QString> &progMap,
289  bool showrerecord = false,
290  uint star_range = 10) const;
291  virtual void SubstituteMatches(QString &str);
292 
293  // Used for scheduling recordings
294  bool IsSameProgram(const ProgramInfo &other) const;
295  bool IsSameTimeslot(const ProgramInfo &other) const;
296  bool IsSameProgramTimeslot(const ProgramInfo &other) const;//sched only
297  static bool UsingProgramIDAuthority(void)
298  {
299  return usingProgIDAuth;
300  };
301  static void CheckProgramIDAuthorities(void);//sched only
302 
303  // Used for extending scheduled recordings
304  bool IsSameProgramWeakCheck(const ProgramInfo &other) const;
305  bool IsSameRecording(const ProgramInfo &other) const
306  { return chanid == other.chanid && recstartts == other.recstartts; }
307 
308  // Quick gets
311  QString MakeUniqueKey(void) const
312  { return MakeUniqueKey(chanid, recstartts); }
313  uint GetSecondsInRecording(void) const;
314  QString ChannelText(const QString&) const;
315  QString GetPathname(void) const { return pathname; }
316  QString GetBasename(void) const { return pathname.section('/', -1); }
317  bool IsVideoFile(void) const
318  { return GetProgramInfoType() == kProgramInfoTypeVideoFile; }
319  bool IsVideoDVD(void) const
320  { return GetProgramInfoType() == kProgramInfoTypeVideoDVD; }
321  bool IsVideoBD(void) const
322  { return GetProgramInfoType() == kProgramInfoTypeVideoBD; }
323  bool IsLocal(void) const { return pathname.left(1) == "/"
324 #ifdef _WIN32
325  || pathname.at(1) == ':'
326 #endif
327  ; }
328  bool IsMythStream(void) const { return pathname.left(7) == "myth://"; }
329  bool IsPathSet(void) const { return GetBasename() != pathname; }
330  bool HasPathname(void) const { return !GetPathname().isEmpty(); }
331  bool IsFileReadable(void) const;
332 
333  QString GetTitle(void) const { return title; }
334  QString GetSubtitle(void) const { return subtitle; }
335  QString GetDescription(void) const { return description; }
336  uint GetSeason(void) const { return season; }
337  uint GetEpisode(void) const { return episode; }
338  QString GetCategory(void) const { return category; }
341  uint GetChanID(void) const { return chanid; }
345  QString GetChanNum(void) const { return chanstr; }
352  QString GetChannelSchedulingID(void) const { return chansign; }
355  QString GetChannelName(void) const { return channame; }
356  QString GetChannelPlaybackFilters(void) const
357  { return chanplaybackfilters; }
359  QDateTime GetScheduledStartTime(void) const { return startts; }
361  QString GetScheduledStartTime(MythDate::Format fmt) const
362  {
363  return MythDate::toString(startts, fmt);
364  }
366  QDateTime GetScheduledEndTime(void) const { return endts; }
368  QString GetScheduledEndTime(MythDate::Format fmt) const
369  {
370  return MythDate::toString(endts, fmt);
371  }
373  QDateTime GetRecordingStartTime(void) const { return recstartts; }
375  QString GetRecordingStartTime(MythDate::Format fmt) const
376  {
377  return MythDate::toString(recstartts, fmt);
378  }
381  QDateTime GetRecordingEndTime(void) const { return recendts; }
384  QString GetRecordingEndTime(MythDate::Format fmt) const
385  {
386  return MythDate::toString(recendts, fmt);
387  }
388  QString GetRecordingGroup(void) const { return recgroup; }
389  QString GetPlaybackGroup(void) const { return playgroup; }
390  QString GetHostname(void) const { return hostname; }
391  QString GetStorageGroup(void) const { return storagegroup; }
392  uint GetYearOfInitialRelease(void) const
393  {
394  return ((year) ? year :
395  (originalAirDate.isValid()) ? originalAirDate.year() : 0);
396  }
397  QDate GetOriginalAirDate(void) const { return originalAirDate; }
398  QDateTime GetLastModifiedTime(void) const { return lastmodified; }
399  QString GetLastModifiedTime(MythDate::Format fmt) const
400  {
401  return MythDate::toString(lastmodified, fmt);
402  }
403  uint64_t GetFilesize(void) const { return filesize; }
404  QString GetSeriesID(void) const { return seriesid; }
405  QString GetProgramID(void) const { return programid; }
406  QString GetInetRef(void) const { return inetref; }
407  CategoryType GetCategoryType(void) const { return catType; }
408  QString GetCategoryTypeString(void) const;
409  int GetRecordingPriority(void) const { return recpriority; }
410  int GetRecordingPriority2(void) const { return recpriority2; }
411  float GetStars(void) const { return stars; }
412  uint GetStars(uint range_max) const
413  { return (int)(stars * range_max + 0.5f); }
414 
415  RecStatusType GetRecordingStatus(void) const
416  { return (RecStatusType)recstatus; }
417  RecStatusType GetOldRecordingStatus(void) const
418  { return (RecStatusType)oldrecstatus; }
419  uint GetPreferedInputID(void) const { return prefinput; }
420  uint GetRecordingRuleID(void) const { return recordid; }
421  uint GetParentRecordingRuleID(void) const { return parentid; }
422  RecordingType GetRecordingRuleType(void) const
423  { return (RecordingType)rectype; }
424 
426  RecordingDupInType GetDuplicateCheckSource(void) const
427  { return (RecordingDupInType)dupin; }
428 
430  RecordingDupMethodType GetDuplicateCheckMethod(void) const
431  { return (RecordingDupMethodType)dupmethod; }
432 
433  uint GetSourceID(void) const { return sourceid; }
434  uint GetInputID(void) const { return inputid; }
435  uint GetCardID(void) const { return cardid; }
436 
437  uint GetFindID(void) const { return findid; }
438 
439  uint32_t GetProgramFlags(void) const { return programflags; }
440  ProgramInfoType GetProgramInfoType(void) const
441  { return (ProgramInfoType)((programflags & FL_TYPEMASK) >> 16); }
442  bool IsGeneric(void) const;
443  bool IsInUsePlaying(void) const { return programflags & FL_INUSEPLAYING;}
444  bool IsCommercialFree(void) const { return programflags & FL_CHANCOMMFREE;}
445  bool HasCutlist(void) const { return programflags & FL_CUTLIST; }
446  bool IsBookmarkSet(void) const { return programflags & FL_BOOKMARK; }
447  bool IsWatched(void) const { return programflags & FL_WATCHED; }
448  bool IsAutoExpirable(void) const { return programflags & FL_AUTOEXP; }
449  bool IsPreserved(void) const { return programflags & FL_PRESERVED; }
450  bool IsVideo(void) const { return programflags & FL_TYPEMASK; }
451  bool IsRecording(void) const { return !IsVideo(); }
452  bool IsRepeat(void) const { return programflags & FL_REPEAT; }
453  bool IsDuplicate(void) const { return programflags & FL_DUPLICATE; }
454  bool IsReactivated(void) const { return programflags & FL_REACTIVATE; }
455  bool IsDeletePending(void) const
456  { return programflags & FL_DELETEPENDING; }
457 
458  uint GetSubtitleType(void) const
459  { return (properties&kSubtitlePropertyMask)>>kSubtitlePropertyOffset; }
460  uint GetVideoProperties(void) const
461  { return (properties & kVideoPropertyMask) >> kVideoPropertyOffset; }
462  uint GetAudioProperties(void) const
463  { return (properties & kAudioPropertyMask) >> kAudioPropertyOffset; }
464 
465  typedef enum
466  {
471  } Verbosity;
472  QString toString(Verbosity v = kLongDescription, QString sep = ":",
473  QString grp = "\"") const;
474 
475  // Quick sets
476  void SetTitle(const QString &t) { title = t; title.detach(); }
477  void SetProgramInfoType(ProgramInfoType t)
478  { programflags &= ~FL_TYPEMASK; programflags |= ((uint32_t)t<<16); }
479  void SetPathname(const QString&) const;
480  void SetChanID(uint _chanid) { chanid = _chanid; }
481  void SetScheduledStartTime(const QDateTime &dt) { startts = dt; }
482  void SetScheduledEndTime( const QDateTime &dt) { endts = dt; }
483  void SetRecordingStartTime(const QDateTime &dt) { recstartts = dt; }
484  void SetRecordingEndTime( const QDateTime &dt) { recendts = dt; }
485  void SetRecordingGroup(const QString &group) { recgroup = group; }
486  void SetPlaybackGroup( const QString &group) { playgroup = group; }
487  void SetHostname( const QString &host) { hostname = host; }
488  void SetStorageGroup( const QString &group) { storagegroup = group; }
489  void SetFilesize( uint64_t sz) { filesize = sz; }
490  void SetSeriesID( const QString &id) { seriesid = id; }
491  void SetProgramID( const QString &id) { programid = id; }
492  void SetCategory( const QString &cat) { category = cat; }
493  void SetCategoryType( const CategoryType type) { catType = type; }
494  void SetRecordingPriority(int priority) { recpriority = priority; }
495  void SetRecordingPriority2(int priority) { recpriority2 = priority; }
496  void SetRecordingRuleID(uint id) { recordid = id; }
497  void SetSourceID(uint id) { sourceid = id; }
498  void SetInputID( uint id) { inputid = id; }
499  void SetCardID( uint id) { cardid = id; }
500  void SetReactivated(bool reactivate)
501  {
502  programflags &= ~FL_REACTIVATE;
503  programflags |= (reactivate) ? FL_REACTIVATE : 0;
504  }
505  void SetEditing(bool editing)
506  {
507  programflags &= ~FL_EDITING;
508  programflags |= (editing) ? FL_EDITING : 0;
509  }
510  void SetFlagging(bool flagging)
511  {
512  programflags &= ~FL_COMMFLAG;
513  programflags |= (flagging) ? FL_COMMFLAG : 0;
514  }
517  void SetIgnoreBookmark(bool ignore)
518  {
519  programflags &= ~FL_IGNOREBOOKMARK;
520  programflags |= (ignore) ? FL_IGNOREBOOKMARK : 0;
521  }
522  void SetRecordingStatus(RecStatusType status) { recstatus = status; }
524  void SetPositionMapDBReplacement(PMapDBReplacement *pmap)
525  { positionMapDBReplacement = pmap; }
526 
527  // Slow DB gets
528  QString QueryBasename(void) const;
529  uint64_t QueryFilesize(void) const;
530  uint QueryMplexID(void) const;
531  QDateTime QueryBookmarkTimeStamp(void) const;
532  uint64_t QueryBookmark(void) const;
533  CategoryType QueryCategoryType(void) const;
534  QStringList QueryDVDBookmark(const QString &serialid) const;
535  bool QueryIsEditing(void) const;
536  bool QueryIsInUse(QStringList &byWho) const;
537  bool QueryIsInUse(QString &byWho) const;
538  bool QueryIsDeleteCandidate(bool one_player_allowed = false) const;
539  AutoExpireType QueryAutoExpire(void) const;
540  TranscodingStatus QueryTranscodeStatus(void) const;
541  bool QueryTuningInfo(QString &channum, QString &input) const;
542  QString QueryInputDisplayName(void) const;
543  uint QueryAverageWidth(void) const;
544  uint QueryAverageHeight(void) const;
545  uint QueryAverageFrameRate(void) const;
546  MarkTypes QueryAverageAspectRatio(void) const;
547  int64_t QueryTotalDuration(void) const;
548  int64_t QueryTotalFrames(void) const;
549  QString QueryRecordingGroup(void) const;
550  bool QueryMarkupFlag(MarkTypes type) const;
551  uint QueryTranscoderID(void) const;
552  uint64_t QueryLastFrameInPosMap(void) const;
553  bool Reload(void);
554 
555  // Slow DB sets
556  void SaveFilesize(uint64_t fsize);
557  void SaveBookmark(uint64_t frame);
558  void SaveDVDBookmark(const QStringList &fields) const;
559  void SaveEditing(bool edit);
560  void SaveTranscodeStatus(TranscodingStatus transFlag);
561  void SaveWatched(bool watchedFlag);
562  void SaveDeletePendingFlag(bool deleteFlag);
563  void SaveCommFlagged(CommFlagStatus flag); // 1 = flagged, 2 = processing
564  void SaveAutoExpire(AutoExpireType autoExpire, bool updateDelete = false);
565  void SavePreserve(bool preserveEpisode);
566  bool SaveBasename(const QString &basename);
567  void SaveAspect(uint64_t frame, MarkTypes type, uint customAspect);
568  void SaveResolution(uint64_t frame, uint width, uint height);
569  void SaveFrameRate(uint64_t frame, uint framerate);
570  void SaveTotalDuration(int64_t duration);
571  void SaveTotalFrames(int64_t frames);
572  void SaveVideoProperties(uint mask, uint video_property_flags);
573  void SaveMarkupFlag(MarkTypes type) const;
574  void ClearMarkupFlag(MarkTypes type) const { ClearMarkupMap(type); }
575  void UpdateLastDelete(bool setTime) const;
576  void MarkAsInUse(bool inuse, QString usedFor = "");
577  void UpdateInUseMark(bool force = false);
578  void SaveSeasonEpisode(uint seas, uint ep);
579  void SaveInetRef(const QString &inet);
580 
581  // Extremely slow functions that cannot be called from the UI thread.
582  QString DiscoverRecordingDirectory(void) const;
583  QString GetPlaybackURL(bool checkMaster = false,
584  bool forceCheckLocal = false) const;
585  ProgramInfoType DiscoverProgramInfoType(void) const;
586 
587  // Edit flagging map
588  bool QueryCutList(frm_dir_map_t &, bool loadAutosave=false) const;
589  void SaveCutList(frm_dir_map_t &, bool isAutoSave=false) const;
590 
591  // Commercial flagging map
592  void QueryCommBreakList(frm_dir_map_t &) const;
593  void SaveCommBreakList(frm_dir_map_t &) const;
594 
595  // Keyframe positions map
596  void QueryPositionMap(frm_pos_map_t &, MarkTypes type) const;
597  void ClearPositionMap(MarkTypes type) const;
598  void SavePositionMap(frm_pos_map_t &, MarkTypes type,
599  int64_t min_frm = -1, int64_t max_frm = -1) const;
600  void SavePositionMapDelta(frm_pos_map_t &, MarkTypes type) const;
601 
603  void SendUpdateEvent(void);
605  void SendAddedEvent(void) const;
607  void SendDeletedEvent(void) const;
608 
610  static QString i18n(const QString&);
611 
612  static QString MakeUniqueKey(uint chanid, const QDateTime &recstartts);
613  static bool ExtractKey(const QString &uniquekey,
614  uint &chanid, QDateTime &recstartts);
615  static bool ExtractKeyFromPathname(
616  const QString &pathname, uint &chanid, QDateTime &recstartts);
617  static bool QueryKeyFromPathname(
618  const QString &pathname, uint &chanid, QDateTime &recstartts);
619 
620  static QString QueryRecordingGroupPassword(const QString &group);
621  static uint64_t QueryBookmark(uint chanid, const QDateTime &recstartts);
622  static QMap<QString,uint32_t> QueryInUseMap(void);
623  static QMap<QString,bool> QueryJobsRunning(int type);
624  static QStringList LoadFromScheduler(const QString &altTable, int recordid);
625 
626  protected:
627  // Flagging map support methods
628  void QueryMarkupMap(frm_dir_map_t&, MarkTypes type,
629  bool merge = false) const;
630  void SaveMarkupMap(const frm_dir_map_t &, MarkTypes type = MARK_ALL,
631  int64_t min_frm = -1, int64_t max_frm = -1) const;
632  void ClearMarkupMap(MarkTypes type = MARK_ALL,
633  int64_t min_frm = -1, int64_t max_frm = -1) const;
634 
635  // Creates a basename from the start and end times
636  QString CreateRecordBasename(const QString &ext) const;
637 
638  bool LoadProgramFromRecorded(
639  const uint chanid, const QDateTime &recstarttime);
640 
641  bool FromStringList(QStringList::const_iterator &it,
642  QStringList::const_iterator end);
643 
644  static void QueryMarkupMap(
645  const QString &video_pathname,
646  frm_dir_map_t&, MarkTypes type, bool merge = false);
647  static void QueryMarkupMap(
648  uint chanid, const QDateTime &recstartts,
649  frm_dir_map_t&, MarkTypes type, bool merge = false);
650 
651  static int InitStatics(void);
652 
653  protected:
654  QString title;
655  QString subtitle;
656  QString description;
660  QString category;
661 
662  int32_t recpriority;
663 
664  uint32_t chanid;
665  QString chanstr;
666  QString chansign;
667  QString channame;
669 
670  QString recgroup;
671  QString playgroup;
672 
673  mutable QString pathname;
674 
675  QString hostname;
676  QString storagegroup;
677 
678  QString seriesid;
679  QString programid;
680  QString inetref;
682 
683  uint64_t filesize;
684 
685  QDateTime startts;
686  QDateTime endts;
687  QDateTime recstartts;
688  QDateTime recendts;
689 
690  float stars;
692  QDateTime lastmodified;
693  QDateTime lastInUseTime;
694 
695  uint32_t prefinput;
696  int32_t recpriority2;
697 
698  uint32_t recordid;
699  uint32_t parentid;
700 
701  uint32_t sourceid;
702  uint32_t inputid;
703  uint32_t cardid;
704  uint32_t findid;
705 
706  uint32_t programflags;
711 
712  int8_t recstatus;
713  int8_t oldrecstatus;
714  uint8_t rectype;
715  uint8_t dupin;
716  uint8_t dupmethod;
717 
718 // everything below this line is not serialized
719  uint8_t availableStatus; // only used for playbackbox.cpp
720  public:
721  void SetAvailableStatus(AvailableStatusType status, const QString &where);
722  AvailableStatusType GetAvailableStatus(void) const
723  { return (AvailableStatusType) availableStatus; }
724  int8_t spread; // only used in guidegrid.cpp
725  int8_t startCol; // only used in guidegrid.cpp
726  QString sortTitle; // only use for sorting in frontend
727 
728  static const QString kFromRecordedQuery;
729 
730  protected:
731  QString inUseForWhat;
733 
734  static QMutex staticDataLock;
736  static bool usingProgIDAuth;
737 };
738 
739 
740 MPUBLIC bool LoadFromProgram(
741  ProgramList &destination,
742  const QString &sql,
743  const MSqlBindings &bindings,
744  const ProgramList &schedList);
745 
746 MPUBLIC bool LoadFromOldRecorded(
747  ProgramList &destination,
748  const QString &sql,
749  const MSqlBindings &bindings);
750 
751 MPUBLIC bool LoadFromRecorded(
752  ProgramList &destination,
753  bool possiblyInProgressRecordingsOnly,
754  const QMap<QString,uint32_t> &inUseMap,
755  const QMap<QString,bool> &isJobRunning,
756  const QMap<QString, ProgramInfo*> &recMap,
757  int sort = 0);
758 
759 template<typename TYPE>
761  AutoDeleteDeque<TYPE*> &destination,
762  bool &hasConflicts,
763  QString altTable = "",
764  int recordid = -1)
765 {
766  destination.clear();
767  hasConflicts = false;
768 
769  QStringList slist = ProgramInfo::LoadFromScheduler(altTable, recordid);
770  if (slist.empty())
771  return false;
772 
773  hasConflicts = slist[0].toInt();
774 
775  QStringList::const_iterator sit = slist.begin()+2;
776  while (sit != slist.end())
777  {
778  TYPE *p = new TYPE(sit, slist.end());
779  destination.push_back(p);
780  if (!p->HasPathname() && !p->GetChanID())
781  {
782  destination.clear();
783  return false;
784  }
785  }
786 
787  if (destination.size() != slist[1].toUInt())
788  {
789  destination.clear();
790  return false;
791  }
792 
793  return true;
794 }
795 
796 template<typename T>
798 {
799  bool dummyConflicts;
800  return LoadFromScheduler(destination, dummyConflicts, "", -1);
801 }
802 
803 // Moved from programdetails.cpp/h, used by MythWelcome/MythShutdown
804 // could be factored out
805 MPUBLIC bool GetNextRecordingList(QDateTime &nextRecordingStart,
806  bool *hasConflicts = NULL,
807  vector<ProgramInfo> *list = NULL);
808 
809 class QMutex;
810 class MPUBLIC PMapDBReplacement
811 {
812  public:
815  QMutex *lock;
816  QMap<MarkTypes,frm_pos_map_t> map;
817 };
818 
819 MPUBLIC QString format_season_and_episode(int seasEp, int digits = -1);
820 
821 MPUBLIC QString myth_category_type_to_string(ProgramInfo::CategoryType category_type);
823 
825 
826 #endif // MYTHPROGRAM_H_
827 
828 /* vim: set expandtab tabstop=4 shiftwidth=4: */