Ticket #2896: mythshutdown-mtd.diff
File mythshutdown-mtd.diff, 2.2 KB (added by , 15 years ago) |
---|
-
programs/mythshutdown/main.cpp
19 19 #include "remoteutil.h" 20 20 #include "compat.h" 21 21 22 #include <QTcpSocket> // MTD status 23 24 22 25 void setGlobalSetting(const QString &key, const QString &value) 23 26 { 24 27 MSqlQuery query(MSqlQuery::InitCon()); … … 244 247 res += 32; 245 248 } 246 249 250 251 if (isRunning(QString("mtd"))) 252 { 253 VERBOSE(VB_GENERAL, "MTD seems to be running. Let's see if it is busy"); 254 int port = gContext->GetNumSetting("MTDPort", 2442); 255 QAbstractSocket *connection = new QTcpSocket(); 256 connection->connectToHost(QString("localhost"), port); 257 if (!connection->waitForConnected(1000)) 258 { 259 VERBOSE(VB_IMPORTANT, "Could not connect to mtd"); 260 } 261 else 262 { 263 connection->write(QByteArray("status\n")); 264 if (connection->waitForBytesWritten(1000) && connection->waitForReadyRead(1000)) 265 { 266 VERBOSE(VB_NETWORK, "MTD status:"); 267 QString status = connection->readLine(); 268 VERBOSE(VB_NETWORK, status); 269 if (status != QString("status dvd summary 0\n")) 270 { 271 res += 512; 272 } 273 } 274 else 275 { 276 VERBOSE(VB_IMPORTANT, "Could not read from MTD socket!"); 277 278 } 279 } 280 } 281 282 247 283 QDateTime dtPeriod1Start = getDailyWakeupTime("DailyWakeupStartPeriod1"); 248 284 QDateTime dtPeriod1End = getDailyWakeupTime("DailyWakeupEndPeriod1"); 249 285 QDateTime dtPeriod2Start = getDailyWakeupTime("DailyWakeupStartPeriod2"); … … 732 768 cout << " 64 - In a daily wakeup/shutdown period\n"; 733 769 cout << " 128 - Less than 15 minutes to next wakeup period\n"; 734 770 cout << " 255 - Setup is running\n"; 771 cout << " 512 - MTD is busy (DVD rip job)\n"; 735 772 cout << "-v/--verbose debug-level (Use '-v help' for level info\n"; 736 773 cout << "-h/--help (shows this usage)\n"; 737 774 }