MythTV  master
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Scheduler Class Reference

#include <scheduler.h>

Inheritance diagram for Scheduler:
Inheritance graph
[legend]
Collaboration diagram for Scheduler:
Collaboration graph
[legend]

Public Types

enum  SchedSortColumn {
  kSortTitle, kSortLastRecorded, kSortNextRecording, kSortPriority,
  kSortType
}
 

Public Member Functions

 Scheduler (bool runthread, QMap< int, EncoderLink * > *_tvList, const QString &tmptable="record", Scheduler *master_sched=nullptr)
 
 ~Scheduler () override
 
void Stop (void)
 
void Wait (void)
 
void SetExpirer (AutoExpire *autoExpirer)
 
AutoExpireGetExpirer ()
 
void Reschedule (const QStringList &request)
 
void RescheduleMatch (uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
 
void RescheduleCheck (const RecordingInfo &recinfo, const QString &why)
 
void ReschedulePlace (const QString &why)
 
void AddRecording (const RecordingInfo &pi)
 
void AddRecording (const ProgramInfo &prog)
 
void FillRecordListFromDB (uint recordid=0)
 
void FillRecordListFromMaster (void)
 
void UpdateRecStatus (RecordingInfo *pginfo)
 
void UpdateRecStatus (uint cardid, uint chanid, const QDateTime &startts, RecStatus::Type recstatus, const QDateTime &recendts)
 
bool GetAllPending (RecList &retList, int recRuleId=0) const
 
bool GetAllPending (ProgramList &retList, int recRuleId=0) const
 
void GetAllPending (QStringList &strList) const override
 
QMap< QString, ProgramInfo * > GetRecording (void) const override
 
RecordingInfoGetRecording (uint recordedid) const
 
void getConflicting (RecordingInfo *pginfo, QStringList &strlist)
 
void getConflicting (RecordingInfo *pginfo, RecList *retlist)
 
void PrintList (bool onlyFutureRecordings=false)
 
void SetMainServer (MainServer *ms)
 
MainServerGetMainServer ()
 
void SlaveConnected (const RecordingList &slavelist)
 
void SlaveDisconnected (uint cardid)
 
void DisableScheduling (void)
 
void EnableScheduling (void)
 
bool QueryScheduling (void) const
 
void GetNextLiveTVDir (uint cardid)
 
void ResetIdleTime (void)
 
RecStatus::Type GetRecStatus (const ProgramInfo &pginfo)
 
int GetError (void) const
 
void AddChildInput (uint parentid, uint childid)
 
void DelayShutdown ()
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
 MThread (const MThread &)=delete
 
MThreadoperator= (const MThread &)=delete
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority p=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (std::chrono::milliseconds time=std::chrono::milliseconds::max())
 Wait for the MThread to exit, with a maximum timeout. More...
 
- Public Member Functions inherited from MythScheduler
 MythScheduler ()=default
 
virtual ~MythScheduler ()=default
 

Static Public Member Functions

static void GetAllScheduled (QStringList &strList, SchedSortColumn sortBy=kSortTitle, bool ascending=true)
 Returns all scheduled programs serialized into a QStringList. More...
 
static void GetAllScheduled (RecList &proglist, SchedSortColumn sortBy=kSortTitle, bool ascending=true)
 Returns all scheduled programs. More...
 
static void PrintList (const RecList &list, bool onlyFutureRecordings=false)
 
static void PrintRec (const RecordingInfo *p, const QString &prefix="")
 
static bool WasStartedAutomatically ()
 
- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &name)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 

Protected Member Functions

void run (void) override
 Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More...
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 

Private Types

enum  OpenEndType { openEndNever = 0, openEndDiffChannel = 1, openEndAlways = 2 }
 
using IsSameKey = std::pair< const RecordingInfo *, const RecordingInfo * >
 
using IsSameCacheType = QMap< IsSameKey, bool >
 

Private Member Functions

bool InitInputInfoMap (void)
 
void CreateTempTables (void)
 
void DeleteTempTables (void)
 
void UpdateDuplicates (void)
 
bool FillRecordList (void)
 
void UpdateMatches (uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime)
 
void UpdateManuals (uint recordid)
 
void BuildWorkList (void)
 
bool ClearWorkList (void)
 
void AddNewRecords (void)
 
void AddNotListed (void)
 
void BuildNewRecordsQueries (uint recordid, QStringList &from, QStringList &where, MSqlBindings &bindings)
 
void PruneOverlaps (void)
 
void BuildListMaps (void)
 
void ClearListMaps (void)
 
bool IsBusyRecording (const RecordingInfo *rcinfo)
 
bool IsSameProgram (const RecordingInfo *a, const RecordingInfo *b) const
 
bool FindNextConflict (const RecList &cardlist, const RecordingInfo *p, RecConstIter &iter, OpenEndType openEnd=openEndNever, uint *paffinity=nullptr, bool ignoreinput=false) const
 
const RecordingInfoFindConflict (const RecordingInfo *p, OpenEndType openEnd=openEndNever, uint *affinity=nullptr, bool checkAll=false) const
 
void MarkOtherShowings (RecordingInfo *p)
 
void MarkShowingsList (const RecList &showinglist, RecordingInfo *p)
 
void BackupRecStatus (void)
 
void RestoreRecStatus (void)
 
bool TryAnotherShowing (RecordingInfo *p, bool samePriority, bool livetv=false)
 
void SchedNewRecords (void)
 
void SchedNewFirstPass (RecIter &start, const RecIter &end, int recpriority, int recpriority2)
 
void SchedNewRetryPass (const RecIter &start, const RecIter &end, bool samePriority, bool livetv=false)
 
void SchedLiveTV (void)
 
void PruneRedundants (void)
 
void UpdateNextRecord (void)
 
bool ChangeRecordingEnd (RecordingInfo *oldp, RecordingInfo *newp)
 
void ShutdownServer (std::chrono::seconds prerollseconds, QDateTime &idleSince)
 
void PutInactiveSlavesToSleep (void)
 
bool WakeUpSlave (const QString &slaveHostname, bool setWakingStatus=true)
 
void WakeUpSlaves (void)
 
int FillRecordingDir (const QString &title, const QString &hostname, const QString &storagegroup, const QDateTime &recstartts, const QDateTime &recendts, uint cardid, QString &recording_dir, const RecList &reclist)
 
void FillDirectoryInfoCache (void)
 
void OldRecordedFixups (void)
 
void ResetDuplicates (uint recordid, uint findid, const QString &title, const QString &subtitle, const QString &descrip, const QString &programid)
 
bool HandleReschedule (void)
 
bool HandleRunSchedulerStartup (std::chrono::seconds prerollseconds, std::chrono::minutes idleWaitForRecordingTime)
 
void HandleWakeSlave (RecordingInfo &ri, std::chrono::seconds prerollseconds)
 
bool HandleRecording (RecordingInfo &ri, bool &statuschanged, QDateTime &nextStartTime, QDateTime &nextWakeTime, std::chrono::seconds prerollseconds)
 
void HandleRecordingStatusChange (RecordingInfo &ri, RecStatus::Type recStatus, const QString &details)
 
bool AssignGroupInput (RecordingInfo &ri, std::chrono::seconds prerollseconds)
 
void HandleIdleShutdown (bool &blockShutdown, QDateTime &idleSince, std::chrono::seconds prerollseconds, std::chrono::seconds idleTimeoutSecs, std::chrono::minutes idleWaitForRecordingTime, bool statuschanged)
 
void EnqueueMatch (uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
 
void EnqueueCheck (const RecordingInfo &recinfo, const QString &why)
 
void EnqueuePlace (const QString &why)
 
bool HaveQueuedRequests (void)
 
void ClearRequestQueue (void)
 
bool CreateConflictLists (void)
 

Static Private Member Functions

static bool VerifyCards (void)
 
static bool CheckShutdownServer (std::chrono::seconds prerollseconds, QDateTime &idleSince, bool &blockShutdown, uint logmask)
 

Private Attributes

QString m_recordTable
 
QString m_priorityTable
 
MythDeque< QStringList > m_reschedQueue
 
QMutex m_schedLock
 
QMutex m_recordMatchLock
 
QWaitCondition m_reschedWait
 
RecList m_recList
 
RecList m_workList
 
RecList m_livetvList
 
QMap< uint, SchedInputInfom_sinputInfoMap
 
std::vector< RecList * > m_conflictLists
 
QMap< uint, RecListm_recordIdListMap
 
QMap< QString, RecListm_titleListMap
 
QDateTime m_schedTime
 
bool m_recListChanged {false}
 
bool m_specSched
 
bool m_schedulingEnabled {true}
 
QMap< int, boolm_schedAfterStartMap
 
QMap< int, EncoderLink * > * m_tvList {nullptr}
 
AutoExpirem_expirer {nullptr}
 
QSet< uintm_schedOrderWarned
 
bool m_doRun
 
MainServerm_mainServer {nullptr}
 
QMutex m_resetIdleTimeLock
 
bool m_resetIdleTime {false}
 
bool m_isShuttingDown {false}
 
MSqlQueryInfo m_dbConn
 
QMap< QString, FileSystemInfom_fsInfoCache
 
int m_error {0}
 
std::array< QSet< QString >, 4 > m_sysEvents
 
QDateTime m_livetvTime
 
QDateTime m_lastPrepareTime
 
std::chrono::milliseconds m_delayShutdownTime {0ms}
 
OpenEndType m_openEnd { openEndNever }
 
IsSameCacheType m_cacheIsSameProgram
 
int m_tmLastLog {0}
 

Additional Inherited Members

- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void usleep (std::chrono::microseconds time)
 
template<typename R , typename P >
static std::enable_if_t< std::chrono::treat_as_floating_point< R >::value, void > usleep (std::chrono::duration< R, P > time)
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prologExecuted {true}
 
bool m_epilogExecuted {true}
 

Detailed Description

Definition at line 45 of file scheduler.h.

Member Typedef Documentation

◆ IsSameKey

using Scheduler::IsSameKey = std::pair<const RecordingInfo*,const RecordingInfo*>
private

Definition at line 291 of file scheduler.h.

◆ IsSameCacheType

using Scheduler::IsSameCacheType = QMap<IsSameKey,bool>
private

Definition at line 292 of file scheduler.h.

Member Enumeration Documentation

◆ SchedSortColumn

Enumerator
kSortTitle 
kSortLastRecorded 
kSortNextRecording 
kSortPriority 
kSortType 

Definition at line 86 of file scheduler.h.

◆ OpenEndType

enum Scheduler::OpenEndType
private
Enumerator
openEndNever 
openEndDiffChannel 
openEndAlways 

Definition at line 128 of file scheduler.h.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( bool  runthread,
QMap< int, EncoderLink * > *  _tvList,
const QString &  tmptable = "record",
Scheduler master_sched = nullptr 
)

Definition at line 62 of file scheduler.cpp.

◆ ~Scheduler()

Scheduler::~Scheduler ( )
override

Definition at line 102 of file scheduler.cpp.

Member Function Documentation

◆ Stop()

void Scheduler::Stop ( void  )

Definition at line 138 of file scheduler.cpp.

Referenced by MainServer::Stop().

◆ Wait()

void Scheduler::Wait ( void  )
inline

Definition at line 53 of file scheduler.h.

Referenced by MainServer::Stop().

◆ SetExpirer()

void Scheduler::SetExpirer ( AutoExpire autoExpirer)
inline

Definition at line 55 of file scheduler.h.

Referenced by run_backend().

◆ GetExpirer()

AutoExpire* Scheduler::GetExpirer ( )
inline

Definition at line 56 of file scheduler.h.

◆ Reschedule()

void Scheduler::Reschedule ( const QStringList &  request)

◆ RescheduleMatch()

void Scheduler::RescheduleMatch ( uint  recordid,
uint  sourceid,
uint  mplexid,
const QDateTime &  maxstarttime,
const QString &  why 
)
inline

Definition at line 59 of file scheduler.h.

Referenced by MainServer::HandleGetPendingRecordings().

◆ RescheduleCheck()

void Scheduler::RescheduleCheck ( const RecordingInfo recinfo,
const QString &  why 
)
inline

◆ ReschedulePlace()

void Scheduler::ReschedulePlace ( const QString &  why)
inline

◆ AddRecording() [1/2]

void Scheduler::AddRecording ( const RecordingInfo pi)

Definition at line 1868 of file scheduler.cpp.

Referenced by AddRecording(), and MainServer::customEvent().

◆ AddRecording() [2/2]

void Scheduler::AddRecording ( const ProgramInfo prog)
inline

Definition at line 69 of file scheduler.h.

◆ FillRecordListFromDB()

void Scheduler::FillRecordListFromDB ( uint  recordid = 0)
Parameters
recordidRecord ID of recording that has changed, or 0 if anything might have been changed.

Definition at line 491 of file scheduler.cpp.

Referenced by handle_command(), and MainServer::HandleGetPendingRecordings().

◆ FillRecordListFromMaster()

void Scheduler::FillRecordListFromMaster ( void  )

Definition at line 574 of file scheduler.cpp.

Referenced by handle_command().

◆ UpdateRecStatus() [1/2]

void Scheduler::UpdateRecStatus ( RecordingInfo pginfo)

Definition at line 649 of file scheduler.cpp.

Referenced by MainServer::customEvent(), and MainServer::DoHandleStopRecording().

◆ UpdateRecStatus() [2/2]

void Scheduler::UpdateRecStatus ( uint  cardid,
uint  chanid,
const QDateTime &  startts,
RecStatus::Type  recstatus,
const QDateTime &  recendts 
)

Definition at line 706 of file scheduler.cpp.

◆ GetAllPending() [1/3]

bool Scheduler::GetAllPending ( RecList retList,
int  recRuleId = 0 
) const

◆ GetAllPending() [2/3]

bool Scheduler::GetAllPending ( ProgramList retList,
int  recRuleId = 0 
) const

Definition at line 1760 of file scheduler.cpp.

◆ GetAllPending() [3/3]

void Scheduler::GetAllPending ( QStringList &  strList) const
overridevirtual

Implements MythScheduler.

Definition at line 1825 of file scheduler.cpp.

◆ GetRecording() [1/2]

QMap< QString, ProgramInfo * > Scheduler::GetRecording ( void  ) const
overridevirtual

◆ GetRecording() [2/2]

RecordingInfo * Scheduler::GetRecording ( uint  recordedid) const

Definition at line 1796 of file scheduler.cpp.

◆ GetAllScheduled() [1/2]

void Scheduler::GetAllScheduled ( QStringList &  strList,
SchedSortColumn  sortBy = kSortTitle,
bool  ascending = true 
)
static

Returns all scheduled programs serialized into a QStringList.

Definition at line 1843 of file scheduler.cpp.

Referenced by Dvr::GetRecordScheduleList(), V2Dvr::GetRecordScheduleList(), and MainServer::HandleGetScheduledRecordings().

◆ GetAllScheduled() [2/2]

void Scheduler::GetAllScheduled ( RecList proglist,
SchedSortColumn  sortBy = kSortTitle,
bool  ascending = true 
)
static

Returns all scheduled programs.

Note
Caller is responsible for deleting the RecordingInfo's returned.

Definition at line 4895 of file scheduler.cpp.

◆ getConflicting() [1/2]

void Scheduler::getConflicting ( RecordingInfo pginfo,
QStringList &  strlist 
)

Definition at line 1711 of file scheduler.cpp.

Referenced by MainServer::HandleGetConflictingRecordings().

◆ getConflicting() [2/2]

void Scheduler::getConflicting ( RecordingInfo pginfo,
RecList retlist 
)

Definition at line 1727 of file scheduler.cpp.

◆ PrintList() [1/2]

void Scheduler::PrintList ( bool  onlyFutureRecordings = false)
inline

Definition at line 98 of file scheduler.h.

Referenced by handle_command(), and HandleReschedule().

◆ PrintList() [2/2]

void Scheduler::PrintList ( const RecList list,
bool  onlyFutureRecordings = false 
)
static

Definition at line 586 of file scheduler.cpp.

◆ PrintRec()

void Scheduler::PrintRec ( const RecordingInfo p,
const QString &  prefix = "" 
)
static

Definition at line 611 of file scheduler.cpp.

Referenced by PrintList(), SchedNewFirstPass(), SchedNewRetryPass(), and TryAnotherShowing().

◆ SetMainServer()

void Scheduler::SetMainServer ( MainServer ms)

Definition at line 145 of file scheduler.cpp.

Referenced by MainServer::MainServer(), and MainServer::Stop().

◆ GetMainServer()

MainServer* Scheduler::GetMainServer ( )
inline

Definition at line 104 of file scheduler.h.

Referenced by V2Status::V2Status().

◆ SlaveConnected()

void Scheduler::SlaveConnected ( const RecordingList slavelist)

Definition at line 831 of file scheduler.cpp.

Referenced by MainServer::HandleAnnounce().

◆ SlaveDisconnected()

void Scheduler::SlaveDisconnected ( uint  cardid)

Definition at line 906 of file scheduler.cpp.

Referenced by MainServer::HandleSlaveDisconnectedEvent().

◆ DisableScheduling()

void Scheduler::DisableScheduling ( void  )
inline

Definition at line 109 of file scheduler.h.

Referenced by run_backend().

◆ EnableScheduling()

void Scheduler::EnableScheduling ( void  )
inline

Definition at line 110 of file scheduler.h.

◆ QueryScheduling()

bool Scheduler::QueryScheduling ( void  ) const
inline

Definition at line 111 of file scheduler.h.

◆ GetNextLiveTVDir()

void Scheduler::GetNextLiveTVDir ( uint  cardid)

Definition at line 5090 of file scheduler.cpp.

Referenced by MainServer::customEvent().

◆ ResetIdleTime()

void Scheduler::ResetIdleTime ( void  )

Definition at line 150 of file scheduler.cpp.

Referenced by MainServer::customEvent().

◆ WasStartedAutomatically()

bool Scheduler::WasStartedAutomatically ( )
static

Definition at line 5686 of file scheduler.cpp.

Referenced by HandleRunSchedulerStartup().

◆ GetRecStatus()

RecStatus::Type Scheduler::GetRecStatus ( const ProgramInfo pginfo)

Definition at line 1806 of file scheduler.cpp.

Referenced by MainServer::customEvent().

◆ GetError()

int Scheduler::GetError ( void  ) const
inline

Definition at line 119 of file scheduler.h.

Referenced by run_backend().

◆ AddChildInput()

void Scheduler::AddChildInput ( uint  parentid,
uint  childid 
)

Definition at line 5866 of file scheduler.cpp.

Referenced by MainServer::HandleAddChildInput().

◆ DelayShutdown()

void Scheduler::DelayShutdown ( )

Definition at line 3073 of file scheduler.cpp.

Referenced by Myth::DelayShutdown(), and V2Myth::DelayShutdown().

◆ run()

void Scheduler::run ( void  )
overrideprotectedvirtual

Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.

Note
If you override this method you must call RunProlog before you do any work and RunEpilog before you exit the run method.

Reimplemented from MThread.

Definition at line 2031 of file scheduler.cpp.

◆ VerifyCards()

bool Scheduler::VerifyCards ( void  )
staticprivate

Definition at line 157 of file scheduler.cpp.

Referenced by Scheduler().

◆ InitInputInfoMap()

bool Scheduler::InitInputInfoMap ( void  )
private

Definition at line 5822 of file scheduler.cpp.

Referenced by Scheduler().

◆ CreateTempTables()

void Scheduler::CreateTempTables ( void  )
private

Definition at line 4158 of file scheduler.cpp.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ DeleteTempTables()

void Scheduler::DeleteTempTables ( void  )
private

Definition at line 4206 of file scheduler.cpp.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ UpdateDuplicates()

void Scheduler::UpdateDuplicates ( void  )
private

Definition at line 4222 of file scheduler.cpp.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ FillRecordList()

bool Scheduler::FillRecordList ( void  )
private

Definition at line 440 of file scheduler.cpp.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ UpdateMatches()

void Scheduler::UpdateMatches ( uint  recordid,
uint  sourceid,
uint  mplexid,
const QDateTime &  maxstarttime 
)
private

Definition at line 3988 of file scheduler.cpp.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ UpdateManuals()

void Scheduler::UpdateManuals ( uint  recordid)
private

Definition at line 3695 of file scheduler.cpp.

Referenced by BuildNewRecordsQueries().

◆ BuildWorkList()

void Scheduler::BuildWorkList ( void  )
private

Definition at line 936 of file scheduler.cpp.

Referenced by FillRecordList().

◆ ClearWorkList()

bool Scheduler::ClearWorkList ( void  )
private

Definition at line 948 of file scheduler.cpp.

Referenced by FillRecordList().

◆ AddNewRecords()

void Scheduler::AddNewRecords ( void  )
private

Definition at line 4330 of file scheduler.cpp.

Referenced by FillRecordList().

◆ AddNotListed()

void Scheduler::AddNotListed ( void  )
private

Definition at line 4771 of file scheduler.cpp.

Referenced by FillRecordList().

◆ BuildNewRecordsQueries()

void Scheduler::BuildNewRecordsQueries ( uint  recordid,
QStringList &  from,
QStringList &  where,
MSqlBindings bindings 
)
private

Definition at line 3826 of file scheduler.cpp.

Referenced by UpdateMatches().

◆ PruneOverlaps()

void Scheduler::PruneOverlaps ( void  )
private

Definition at line 993 of file scheduler.cpp.

Referenced by FillRecordList().

◆ BuildListMaps()

void Scheduler::BuildListMaps ( void  )
private

Definition at line 1017 of file scheduler.cpp.

Referenced by FillRecordList().

◆ ClearListMaps()

void Scheduler::ClearListMaps ( void  )
private

Definition at line 1052 of file scheduler.cpp.

Referenced by FillRecordList().

◆ IsBusyRecording()

bool Scheduler::IsBusyRecording ( const RecordingInfo rcinfo)
private

Definition at line 1909 of file scheduler.cpp.

Referenced by HandleRecording().

◆ IsSameProgram()

bool Scheduler::IsSameProgram ( const RecordingInfo a,
const RecordingInfo b 
) const
private

Definition at line 1061 of file scheduler.cpp.

Referenced by MarkShowingsList(), and TryAnotherShowing().

◆ FindNextConflict()

bool Scheduler::FindNextConflict ( const RecList cardlist,
const RecordingInfo p,
RecConstIter iter,
OpenEndType  openEnd = openEndNever,
uint paffinity = nullptr,
bool  ignoreinput = false 
) const
private

◆ FindConflict()

const RecordingInfo * Scheduler::FindConflict ( const RecordingInfo p,
OpenEndType  openEnd = openEndNever,
uint affinity = nullptr,
bool  checkAll = false 
) const
private

Definition at line 1178 of file scheduler.cpp.

Referenced by SchedNewFirstPass(), and TryAnotherShowing().

◆ MarkOtherShowings()

void Scheduler::MarkOtherShowings ( RecordingInfo p)
private

◆ MarkShowingsList()

void Scheduler::MarkShowingsList ( const RecList showinglist,
RecordingInfo p 
)
private

Definition at line 1217 of file scheduler.cpp.

Referenced by MarkOtherShowings().

◆ BackupRecStatus()

void Scheduler::BackupRecStatus ( void  )
private

Definition at line 1242 of file scheduler.cpp.

Referenced by SchedNewRetryPass().

◆ RestoreRecStatus()

void Scheduler::RestoreRecStatus ( void  )
private

Definition at line 1250 of file scheduler.cpp.

Referenced by SchedNewRetryPass().

◆ TryAnotherShowing()

bool Scheduler::TryAnotherShowing ( RecordingInfo p,
bool  samePriority,
bool  livetv = false 
)
private

Definition at line 1258 of file scheduler.cpp.

Referenced by SchedNewRetryPass().

◆ SchedNewRecords()

void Scheduler::SchedNewRecords ( void  )
private

Definition at line 1366 of file scheduler.cpp.

Referenced by FillRecordList().

◆ SchedNewFirstPass()

void Scheduler::SchedNewFirstPass ( RecIter start,
const RecIter end,
int  recpriority,
int  recpriority2 
)
private

Definition at line 1435 of file scheduler.cpp.

Referenced by SchedNewRecords().

◆ SchedNewRetryPass()

void Scheduler::SchedNewRetryPass ( const RecIter start,
const RecIter end,
bool  samePriority,
bool  livetv = false 
)
private

Definition at line 1513 of file scheduler.cpp.

Referenced by SchedLiveTV(), and SchedNewRecords().

◆ SchedLiveTV()

void Scheduler::SchedLiveTV ( void  )
private

Definition at line 5634 of file scheduler.cpp.

Referenced by FillRecordList().

◆ PruneRedundants()

void Scheduler::PruneRedundants ( void  )
private

Definition at line 1563 of file scheduler.cpp.

Referenced by FillRecordList().

◆ UpdateNextRecord()

void Scheduler::UpdateNextRecord ( void  )
private

Definition at line 1644 of file scheduler.cpp.

Referenced by HandleRecordingStatusChange(), and HandleReschedule().

◆ ChangeRecordingEnd()

bool Scheduler::ChangeRecordingEnd ( RecordingInfo oldp,
RecordingInfo newp 
)
private

Definition at line 754 of file scheduler.cpp.

Referenced by AddNewRecords().

◆ CheckShutdownServer()

bool Scheduler::CheckShutdownServer ( std::chrono::seconds  prerollseconds,
QDateTime &  idleSince,
bool blockShutdown,
uint  logmask 
)
staticprivate

Definition at line 3303 of file scheduler.cpp.

Referenced by HandleIdleShutdown().

◆ ShutdownServer()

void Scheduler::ShutdownServer ( std::chrono::seconds  prerollseconds,
QDateTime &  idleSince 
)
private

Definition at line 3361 of file scheduler.cpp.

Referenced by HandleIdleShutdown().

◆ PutInactiveSlavesToSleep()

void Scheduler::PutInactiveSlavesToSleep ( void  )
private

Definition at line 3474 of file scheduler.cpp.

Referenced by run().

◆ WakeUpSlave()

bool Scheduler::WakeUpSlave ( const QString &  slaveHostname,
bool  setWakingStatus = true 
)
private

Definition at line 3618 of file scheduler.cpp.

Referenced by HandleWakeSlave(), and WakeUpSlaves().

◆ WakeUpSlaves()

void Scheduler::WakeUpSlaves ( void  )
private

Definition at line 3665 of file scheduler.cpp.

Referenced by Scheduler().

◆ FillRecordingDir()

int Scheduler::FillRecordingDir ( const QString &  title,
const QString &  hostname,
const QString &  storagegroup,
const QDateTime &  recstartts,
const QDateTime &  recendts,
uint  cardid,
QString &  recording_dir,
const RecList reclist 
)
private

Definition at line 5117 of file scheduler.cpp.

Referenced by GetNextLiveTVDir(), and HandleRecording().

◆ FillDirectoryInfoCache()

void Scheduler::FillDirectoryInfoCache ( void  )
private

Definition at line 5612 of file scheduler.cpp.

Referenced by FillRecordingDir().

◆ OldRecordedFixups()

void Scheduler::OldRecordedFixups ( void  )
private

Definition at line 1986 of file scheduler.cpp.

Referenced by run().

◆ ResetDuplicates()

void Scheduler::ResetDuplicates ( uint  recordid,
uint  findid,
const QString &  title,
const QString &  subtitle,
const QString &  descrip,
const QString &  programid 
)
private

Definition at line 2246 of file scheduler.cpp.

Referenced by HandleReschedule().

◆ HandleReschedule()

bool Scheduler::HandleReschedule ( void  )
private

Definition at line 2323 of file scheduler.cpp.

Referenced by run().

◆ HandleRunSchedulerStartup()

bool Scheduler::HandleRunSchedulerStartup ( std::chrono::seconds  prerollseconds,
std::chrono::minutes  idleWaitForRecordingTime 
)
private

Definition at line 2493 of file scheduler.cpp.

Referenced by run().

◆ HandleWakeSlave()

void Scheduler::HandleWakeSlave ( RecordingInfo ri,
std::chrono::seconds  prerollseconds 
)
private

Definition at line 2545 of file scheduler.cpp.

Referenced by run().

◆ HandleRecording()

bool Scheduler::HandleRecording ( RecordingInfo ri,
bool statuschanged,
QDateTime &  nextStartTime,
QDateTime &  nextWakeTime,
std::chrono::seconds  prerollseconds 
)
private

Definition at line 2648 of file scheduler.cpp.

Referenced by run().

◆ HandleRecordingStatusChange()

void Scheduler::HandleRecordingStatusChange ( RecordingInfo ri,
RecStatus::Type  recStatus,
const QString &  details 
)
private

Definition at line 2896 of file scheduler.cpp.

Referenced by HandleRecording().

◆ AssignGroupInput()

bool Scheduler::AssignGroupInput ( RecordingInfo ri,
std::chrono::seconds  prerollseconds 
)
private

Definition at line 2934 of file scheduler.cpp.

Referenced by HandleRecording().

◆ HandleIdleShutdown()

void Scheduler::HandleIdleShutdown ( bool blockShutdown,
QDateTime &  idleSince,
std::chrono::seconds  prerollseconds,
std::chrono::seconds  idleTimeoutSecs,
std::chrono::minutes  idleWaitForRecordingTime,
bool  statuschanged 
)
private

Definition at line 3078 of file scheduler.cpp.

Referenced by run().

◆ EnqueueMatch()

void Scheduler::EnqueueMatch ( uint  recordid,
uint  sourceid,
uint  mplexid,
const QDateTime &  maxstarttime,
const QString &  why 
)
inlineprivate

Definition at line 224 of file scheduler.h.

Referenced by AddRecording(), and run().

◆ EnqueueCheck()

void Scheduler::EnqueueCheck ( const RecordingInfo recinfo,
const QString &  why 
)
inlineprivate

Definition at line 228 of file scheduler.h.

Referenced by UpdateRecStatus().

◆ EnqueuePlace()

void Scheduler::EnqueuePlace ( const QString &  why)
inlineprivate

Definition at line 231 of file scheduler.h.

Referenced by HandleRecording(), HandleReschedule(), and HandleWakeSlave().

◆ HaveQueuedRequests()

bool Scheduler::HaveQueuedRequests ( void  )
inlineprivate

Definition at line 234 of file scheduler.h.

Referenced by HandleReschedule(), and run().

◆ ClearRequestQueue()

void Scheduler::ClearRequestQueue ( void  )
inlineprivate

Definition at line 236 of file scheduler.h.

Referenced by run().

◆ CreateConflictLists()

bool Scheduler::CreateConflictLists ( void  )
private

Definition at line 5732 of file scheduler.cpp.

Referenced by InitInputInfoMap().

Member Data Documentation

◆ m_recordTable

QString Scheduler::m_recordTable
private

◆ m_priorityTable

QString Scheduler::m_priorityTable
private

Definition at line 135 of file scheduler.h.

Referenced by AddNewRecords(), and Scheduler().

◆ m_reschedQueue

MythDeque<QStringList> Scheduler::m_reschedQueue
private

◆ m_schedLock

QMutex Scheduler::m_schedLock
mutableprivate

◆ m_recordMatchLock

QMutex Scheduler::m_recordMatchLock
private

Definition at line 243 of file scheduler.h.

Referenced by FillRecordListFromDB(), and HandleReschedule().

◆ m_reschedWait

QWaitCondition Scheduler::m_reschedWait
private

Definition at line 244 of file scheduler.h.

Referenced by AddRecording(), Reschedule(), run(), Scheduler(), Stop(), UpdateRecStatus(), and ~Scheduler().

◆ m_recList

RecList Scheduler::m_recList
private

◆ m_workList

RecList Scheduler::m_workList
private

◆ m_livetvList

RecList Scheduler::m_livetvList
private

Definition at line 247 of file scheduler.h.

Referenced by SchedLiveTV(), and TryAnotherShowing().

◆ m_sinputInfoMap

QMap<uint, SchedInputInfo> Scheduler::m_sinputInfoMap
private

◆ m_conflictLists

std::vector<RecList *> Scheduler::m_conflictLists
private

Definition at line 249 of file scheduler.h.

Referenced by ClearListMaps(), CreateConflictLists(), and ~Scheduler().

◆ m_recordIdListMap

QMap<uint, RecList> Scheduler::m_recordIdListMap
private

Definition at line 250 of file scheduler.h.

Referenced by BuildListMaps(), ClearListMaps(), MarkOtherShowings(), and TryAnotherShowing().

◆ m_titleListMap

QMap<QString, RecList> Scheduler::m_titleListMap
private

Definition at line 251 of file scheduler.h.

Referenced by BuildListMaps(), ClearListMaps(), and MarkOtherShowings().

◆ m_schedTime

QDateTime Scheduler::m_schedTime
private

◆ m_recListChanged

bool Scheduler::m_recListChanged {false}
private

◆ m_specSched

bool Scheduler::m_specSched
private

Definition at line 256 of file scheduler.h.

Referenced by AddNewRecords(), ChangeRecordingEnd(), and UpdateNextRecord().

◆ m_schedulingEnabled

bool Scheduler::m_schedulingEnabled {true}
private

Definition at line 257 of file scheduler.h.

Referenced by DisableScheduling(), EnableScheduling(), HandleRecording(), and QueryScheduling().

◆ m_schedAfterStartMap

QMap<int, bool> Scheduler::m_schedAfterStartMap
private

Definition at line 258 of file scheduler.h.

Referenced by AddNewRecords(), and HandleRecordingStatusChange().

◆ m_tvList

QMap<int, EncoderLink *>* Scheduler::m_tvList {nullptr}
private

◆ m_expirer

AutoExpire* Scheduler::m_expirer {nullptr}
private

◆ m_schedOrderWarned

QSet<uint> Scheduler::m_schedOrderWarned
private

Definition at line 263 of file scheduler.h.

Referenced by AddNewRecords().

◆ m_doRun

bool Scheduler::m_doRun
private

Definition at line 265 of file scheduler.h.

Referenced by AddNewRecords(), run(), Scheduler(), Stop(), and ~Scheduler().

◆ m_mainServer

MainServer* Scheduler::m_mainServer {nullptr}
private

◆ m_resetIdleTimeLock

QMutex Scheduler::m_resetIdleTimeLock
private

Definition at line 269 of file scheduler.h.

Referenced by HandleIdleShutdown(), and ResetIdleTime().

◆ m_resetIdleTime

bool Scheduler::m_resetIdleTime {false}
private

Definition at line 270 of file scheduler.h.

Referenced by HandleIdleShutdown(), and ResetIdleTime().

◆ m_isShuttingDown

bool Scheduler::m_isShuttingDown {false}
private

Definition at line 272 of file scheduler.h.

Referenced by HandleIdleShutdown(), and ShutdownServer().

◆ m_dbConn

MSqlQueryInfo Scheduler::m_dbConn
private

◆ m_fsInfoCache

QMap<QString, FileSystemInfo> Scheduler::m_fsInfoCache
private

Definition at line 275 of file scheduler.h.

Referenced by FillDirectoryInfoCache(), and FillRecordingDir().

◆ m_error

int Scheduler::m_error {0}
private

Definition at line 277 of file scheduler.h.

Referenced by GetError().

◆ m_sysEvents

std::array<QSet<QString>,4> Scheduler::m_sysEvents
private

Definition at line 279 of file scheduler.h.

Referenced by HandleWakeSlave().

◆ m_livetvTime

QDateTime Scheduler::m_livetvTime
private

◆ m_lastPrepareTime

QDateTime Scheduler::m_lastPrepareTime
private

Definition at line 284 of file scheduler.h.

Referenced by HandleRecording().

◆ m_delayShutdownTime

std::chrono::milliseconds Scheduler::m_delayShutdownTime {0ms}
private

Definition at line 286 of file scheduler.h.

Referenced by DelayShutdown(), and HandleIdleShutdown().

◆ m_openEnd

OpenEndType Scheduler::m_openEnd { openEndNever }
private

Definition at line 288 of file scheduler.h.

Referenced by SchedNewFirstPass(), and SchedNewRecords().

◆ m_cacheIsSameProgram

IsSameCacheType Scheduler::m_cacheIsSameProgram
mutableprivate

Definition at line 293 of file scheduler.h.

Referenced by ClearListMaps(), and IsSameProgram().

◆ m_tmLastLog

int Scheduler::m_tmLastLog {0}
private

Definition at line 294 of file scheduler.h.

Referenced by HandleIdleShutdown().


The documentation for this class was generated from the following files: