Ticket #3497: fix-autostart-detection.diff
File fix-autostart-detection.diff, 2.6 KB (added by , 17 years ago) |
---|
-
scheduler.h
103 103 bool &blockShutdown); 104 104 void ShutdownServer(int prerollseconds); 105 105 106 bool WasStartedAutomatically(); 107 106 108 void FillRecordingDir(ProgramInfo *pginfo, RecList& reclist); 107 109 void FillDirectoryInfoCache(bool force = false); 108 110 -
scheduler.cpp
1347 1347 QString startupParam = "user"; 1348 1348 1349 1349 // have we been started automatically? 1350 if ((startIter != reclist.end()) && 1351 ((curtime.secsTo((*startIter)->startts) - prerollseconds) 1352 < (idleWaitForRecordingTime * 60))) 1350 if (WasStartedAutomatically() || 1351 ((startIter != reclist.end()) && 1352 ((curtime.secsTo((*startIter)->startts) - prerollseconds) 1353 < (idleWaitForRecordingTime * 60)))) 1353 1354 { 1354 VERBOSE(VB_IMPORTANT, 1355 "Recording starts soon, AUTO-Startup assumed"); 1355 VERBOSE(VB_IMPORTANT, "AUTO-Startup assumed"); 1356 1356 startupParam = "auto"; 1357 1357 1358 1358 // Since we've started automatically, don't wait for … … 3142 3142 fsInfoCacheFillTime = QDateTime::currentDateTime(); 3143 3143 } 3144 3144 3145 bool Scheduler::WasStartedAutomatically() { 3146 /* Determines if the system was started automatically by the auto-wakeup process */ 3147 3148 bool autoStart = false; 3149 3150 QDateTime startupTime = QDateTime(); 3151 QString s = gContext->GetSetting("MythShutdownWakeupTime", ""); 3152 if (s != "") 3153 startupTime = QDateTime::fromString(s, Qt::ISODate); 3154 3155 // if we don't have a valid startup time assume we were started manually 3156 if (startupTime.isValid()) 3157 { 3158 // if we started within 15mins of the saved wakeup time assume we started 3159 // automatically to record or for a daily wakeup/shutdown period 3160 3161 int delta = startupTime.secsTo(QDateTime::currentDateTime()); 3162 if (delta < 0) 3163 delta = -delta; 3164 3165 if (delta < 15 * 60) 3166 { 3167 VERBOSE(VB_SCHEDULE, "Close to auto-start time, AUTO-Startup assumed"); 3168 autoStart = true; 3169 } 3170 } 3171 3172 return autoStart; 3173 } 3174 3145 3175 /* vim: set expandtab tabstop=4 shiftwidth=4: */