Ticket #1640: mythtv.jobqueue.diff
File mythtv.jobqueue.diff, 7.2 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/jobqueue.cpp
1274 1274 return false; 1275 1275 } 1276 1276 1277 intJobQueue::GetJobCmd(int jobID)1277 enum JobCmds JobQueue::GetJobCmd(int jobID) 1278 1278 { 1279 1279 MSqlQuery query(MSqlQuery::InitCon()); 1280 1280 … … 1284 1284 1285 1285 query.exec(); 1286 1286 1287 if ( !query.isActive())1287 if (query.isActive()) 1288 1288 { 1289 MythContext::DBError("Error in JobQueue::GetJobCmd()", query);1290 return false;1289 if ((query.size() > 0) && query.next()) 1290 return (enum JobCmds)query.value(0).toInt(); 1291 1291 } 1292 1292 else 1293 1293 { 1294 if ((query.size() > 0) && query.next()) 1295 return query.value(0).toInt(); 1294 MythContext::DBError("Error in JobQueue::GetJobCmd()", query); 1296 1295 } 1297 1296 1298 return JOB_ UNKNOWN;1297 return JOB_RUN; 1299 1298 } 1300 1299 1301 1300 QString JobQueue::GetJobArgs(int jobID) … … 1308 1307 1309 1308 query.exec(); 1310 1309 1311 if ( !query.isActive())1310 if (query.isActive()) 1312 1311 { 1313 MythContext::DBError("Error in JobQueue::GetJobArgs()", query);1314 return false;1312 if ((query.numRowsAffected() > 0) && query.next()) 1313 return query.value(0).toString(); 1315 1314 } 1316 1315 else 1317 1316 { 1318 if ((query.numRowsAffected() > 0) && query.next()) 1319 return query.value(0).toString(); 1317 MythContext::DBError("Error in JobQueue::GetJobArgs()", query); 1320 1318 } 1321 1319 1322 1320 return QString(""); 1323 1321 } 1324 1322 1325 intJobQueue::GetJobFlags(int jobID)1323 enum JobFlags JobQueue::GetJobFlags(int jobID) 1326 1324 { 1327 1325 MSqlQuery query(MSqlQuery::InitCon()); 1328 1326 … … 1332 1330 1333 1331 query.exec(); 1334 1332 1335 if ( !query.isActive())1333 if (query.isActive()) 1336 1334 { 1337 MythContext::DBError("Error in JobQueue::GetJobFlags()", query);1338 return false;1335 if ((query.size() > 0) && query.next()) 1336 return (enum JobFlags)query.value(0).toInt(); 1339 1337 } 1340 1338 else 1341 1339 { 1342 if ((query.size() > 0) && query.next()) 1343 return query.value(0).toInt(); 1340 MythContext::DBError("Error in JobQueue::GetJobFlags()", query); 1344 1341 } 1345 1342 1346 return JOB_ UNKNOWN;1343 return JOB_NO_FLAGS; 1347 1344 } 1348 1345 1349 intJobQueue::GetJobStatus(int jobID)1346 enum JobStatus JobQueue::GetJobStatus(int jobID) 1350 1347 { 1351 1348 MSqlQuery query(MSqlQuery::InitCon()); 1352 1349 … … 1356 1353 1357 1354 query.exec(); 1358 1355 1359 if ( !query.isActive())1356 if (query.isActive()) 1360 1357 { 1361 MythContext::DBError("Error in JobQueue::GetJobStatus()", query);1362 return false;1358 if ((query.size() > 0) && query.next()) 1359 return (enum JobStatus)query.value(0).toInt(); 1363 1360 } 1364 1361 else 1365 1362 { 1366 if ((query.size() > 0) && query.next()) 1367 return query.value(0).toInt(); 1363 MythContext::DBError("Error in JobQueue::GetJobStatus()", query); 1368 1364 } 1369 1370 1365 return JOB_UNKNOWN; 1371 1366 } 1372 1367 1373 int JobQueue::GetJobStatus(int jobType, QString chanid, QDateTime startts) 1368 enum JobStatus JobQueue::GetJobStatus(int jobType, QString chanid, 1369 QDateTime startts) 1374 1370 { 1375 1371 MSqlQuery query(MSqlQuery::InitCon()); 1376 1372 … … 1383 1379 1384 1380 query.exec(); 1385 1381 1386 if ( !query.isActive())1382 if (query.isActive()) 1387 1383 { 1388 MythContext::DBError("Error in JobQueue::GetJobStatus()", query);1389 return false;1384 if (query.size() > 0 && query.next()) 1385 return (enum JobStatus)query.value(0).toInt(); 1390 1386 } 1391 if (query.size() > 0 && query.next())1387 else 1392 1388 { 1393 int tmpStatus; 1394 tmpStatus = query.value(0).toInt(); 1395 return tmpStatus; 1389 MythContext::DBError("Error in JobQueue::GetJobStatus()", query); 1396 1390 } 1397 1391 return JOB_UNKNOWN; 1398 1392 } … … 1839 1833 { 1840 1834 msg = QString("Transcode %1") 1841 1835 .arg(StatusText(GetJobStatus(jobID))); 1842 gContext->LogEntry("transcode", LP_NOTICE, msg, details);1843 1836 1837 details = QString("%1%2: (%3)") 1838 .arg(program_info->title).arg(subtitle) 1839 .arg(transcoderName); 1840 1844 1841 if (status == JOB_FINISHED) 1845 1842 { 1846 1843 retry = false; … … 1851 1848 filename = program_info->GetRecordFilename(fileprefix); 1852 1849 1853 1850 if (stat(filename.ascii(), &st) == 0) 1851 { 1854 1852 filesize = st.st_size; 1855 1853 1856 if (filesize != origfilesize)1857 {1858 1854 QString comment = QString("%1: %2 => %3") 1859 1855 .arg(transcoderName) 1860 1856 .arg(PrettyPrint(origfilesize)) 1861 1857 .arg(PrettyPrint(filesize)); 1862 1858 ChangeJobStatus(jobID, JOB_FINISHED, comment); 1863 1859 1864 details = QString("%1%2")1865 .arg(program_info->title).arg(subtitle);1866 1867 1860 if (filesize > 0) 1868 {1869 1861 program_info->SetFilesize(filesize); 1870 1862 1871 details += QString(": %1 (%2)") 1872 .arg(PrettyPrint(filesize)) 1873 .arg(transcoderName); 1874 } 1875 1876 VERBOSE(VB_GENERAL, LOC + 1877 QString("%1 for %2%3: %4 => %5 (%6)") 1878 .arg(msg).arg(program_info->title).arg(subtitle) 1879 .arg(PrettyPrint(origfilesize)) 1880 .arg(PrettyPrint(filesize)).arg(transcoderName)); 1863 details = QString("%1%2: %3 (%4)") 1864 .arg(program_info->title) 1865 .arg(subtitle) 1866 .arg(PrettyPrint(filesize)) 1867 .arg(transcoderName); 1881 1868 } 1882 1869 1870 VERBOSE(VB_GENERAL, LOC + 1871 QString("%1 for %2%3: %4 => %5 (%6)") 1872 .arg(msg).arg(program_info->title).arg(subtitle) 1873 .arg(PrettyPrint(origfilesize)) 1874 .arg(PrettyPrint(filesize)).arg(transcoderName)); 1875 1883 1876 MythEvent me("RECORDING_LIST_CHANGE"); 1884 1877 gContext->dispatch(me); 1885 1878 1886 1879 program_info->SetTranscoded(TRANSCODING_COMPLETE); 1887 1880 } 1881 1882 gContext->LogEntry("transcode", LP_NOTICE, msg, details); 1888 1883 } 1889 1884 } 1890 1885 -
libs/libmythtv/jobqueue.h
140 140 static bool StopJob(int jobID); 141 141 static bool DeleteJob(int jobID); 142 142 143 static int GetJobCmd(int jobID); 144 static int GetJobFlags(int jobID); 145 static int GetJobStatus(int jobID); 146 static int GetJobStatus(int jobType, QString chanid, QDateTime starttime); 143 static enum JobCmds GetJobCmd(int jobID); 144 static enum JobFlags GetJobFlags(int jobID); 145 static enum JobStatus GetJobStatus(int jobID); 146 static enum JobStatus GetJobStatus(int jobType, QString chanid, 147 QDateTime starttime); 147 148 static QString GetJobArgs(int jobID); 148 149 static int UserJobTypeToIndex(int JobType); 149 150