Ticket #2282: 2282-v2.patch
| File 2282-v2.patch, 25.2 KB (added by , 20 years ago) |
|---|
-
programs/mythfrontend/playbackbox.cpp
1442 1442 1443 1443 void PlaybackBox::listChanged(void) 1444 1444 { 1445 VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- begin"); 1445 1446 if (playingSomething) 1446 1447 return; 1447 1448 … … 1450 1451 update(drawTotalBounds); 1451 1452 if (type == Delete) 1452 1453 UpdateProgressBar(); 1454 VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- end"); 1453 1455 } 1454 1456 1455 1457 bool PlaybackBox::FillList(bool useCachedData) 1456 1458 { 1459 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- begin"); 1457 1460 ProgramInfo *p; 1458 1461 1459 1462 // Save some information so we can find our place again. … … 1607 1610 titleIndex = 0; 1608 1611 playList.clear(); 1609 1612 1613 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 1"); 1610 1614 return 0; 1611 1615 } 1612 1616 … … 1888 1892 } 1889 1893 } 1890 1894 1895 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 2"); 1891 1896 return (progCache != NULL); 1892 1897 } 1893 1898 … … 2415 2420 2416 2421 void PlaybackBox::showDeletePopup(ProgramInfo *program, deletePopupType types) 2417 2422 { 2423 VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- begin"); 2424 2418 2425 freeSpaceNeedsUpdate = true; 2419 2426 2420 2427 popup = new MythPopupBox(gContext->GetMainWindow(), drawPopupSolid, … … 2507 2514 popup->ShowPopup(this, SLOT(doCancel())); 2508 2515 2509 2516 expectingPopup = true; 2517 2518 VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- end"); 2510 2519 } 2511 2520 2512 2521 void PlaybackBox::showAvailablePopup(ProgramInfo *rec) … … 3365 3374 3366 3375 void PlaybackBox::doDelete(void) 3367 3376 { 3377 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- begin"); 3378 3368 3379 if (!expectingPopup) 3369 3380 { 3370 3381 previewSuspend = false; 3382 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 1"); 3371 3383 return; 3372 3384 } 3373 3385 … … 3378 3390 { 3379 3391 showAvailablePopup(delitem); 3380 3392 previewSuspend = false; 3393 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 2"); 3381 3394 return; 3382 3395 } 3383 3396 … … 3396 3409 } 3397 3410 else 3398 3411 showDeletePopup(delitem, ForceDeleteRecording); 3412 3413 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 3"); 3399 3414 } 3400 3415 3401 3416 void PlaybackBox::doForceDelete(void) -
programs/mythbackend/mainserver.cpp
1004 1004 1005 1005 void MainServer::HandleQueryRecordings(QString type, PlaybackSock *pbs) 1006 1006 { 1007 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- begin"); 1008 1007 1009 MythSocket *pbssock = pbs->getSocket(); 1010 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- A"); 1008 1011 bool islocal = pbs->isLocal(); 1012 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- B"); 1009 1013 QString playbackhost = pbs->getHostname(); 1014 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- C"); 1010 1015 1011 1016 QString fs_db_name = ""; 1012 1017 … … 1015 1020 RecIter ri; 1016 1021 RecList schedList; 1017 1022 if (m_sched) 1023 { 1024 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- D"); 1018 1025 m_sched->getAllPending(&schedList); 1026 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- E"); 1027 } 1019 1028 1020 1029 QString ip = gContext->GetSetting("BackendServerIP"); 1021 1030 QString port = gContext->GetSetting("BackendServerPort"); … … 1025 1034 QString inUseForWhat; 1026 1035 QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60); 1027 1036 1037 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- F"); 1028 1038 MSqlQuery query(MSqlQuery::InitCon()); 1039 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- G"); 1029 1040 1030 1041 query.prepare("SELECT DISTINCT chanid, starttime, recusage " 1031 1042 " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;"); 1032 1043 query.bindValue(":ONEHOURAGO", oneHourAgo); 1033 1044 1045 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 0"); 1046 1034 1047 if (query.exec() && query.isActive() && query.size() > 0) 1035 1048 while (query.next()) 1036 1049 { … … 1049 1062 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING; 1050 1063 } 1051 1064 1065 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 1"); 1052 1066 1053 1067 QString thequery = 1054 1068 "SELECT recorded.chanid,recorded.starttime,recorded.endtime," … … 1092 1106 1093 1107 query.prepare(thequery); 1094 1108 1109 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.0"); 1110 1095 1111 if (!query.exec() || !query.isActive()) 1096 1112 { 1097 1113 MythContext::DBError("ProgramList::FromRecorded", query); … … 1101 1117 { 1102 1118 outputlist << QString::number(query.size()); 1103 1119 1120 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.1"); 1121 1104 1122 while (query.next()) 1105 1123 { 1106 1124 ProgramInfo *proginfo = new ProgramInfo; … … 1290 1308 1291 1309 delete proginfo; 1292 1310 } 1311 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.2"); 1293 1312 } 1294 1313 1314 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 3"); 1315 1295 1316 for (ri = schedList.begin(); ri != schedList.end(); ri++) 1296 1317 delete (*ri); 1297 1318 1319 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- sending"); 1298 1320 SendResponse(pbssock, outputlist); 1321 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- end"); 1299 1322 } 1300 1323 1301 1324 void MainServer::HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs) -
programs/mythbackend/scheduler.cpp
76 76 } 77 77 } 78 78 79 Scheduler::~Scheduler()79 static void delete_reclist(RecList &reclist) 80 80 { 81 81 while (reclist.size() > 0) 82 82 { … … 86 86 } 87 87 } 88 88 89 static void copy_reclist(RecList ©, const RecList &orig) 90 { 91 delete_reclist(copy); 92 93 RecList::const_iterator it = orig.begin(); 94 for (; it != orig.end(); it++) 95 copy.push_back(new ProgramInfo(*(*it))); 96 } 97 98 Scheduler::~Scheduler() 99 { 100 delete_reclist(reclist); 101 102 if (reclist_lock) 103 { 104 delete reclist_lock; 105 reclist_lock = NULL; 106 } 107 108 if (schedlist_lock) 109 { 110 delete schedlist_lock; 111 schedlist_lock = NULL; 112 } 113 } 114 89 115 void Scheduler::SetMainServer(MainServer *ms) 90 116 { 91 117 m_mainServer = ms; … … 263 289 264 290 bool Scheduler::FillRecordList(void) 265 291 { 266 QMutexLocker lockit(reclist_lock);267 268 292 schedMoveHigher = (bool)gContext->GetNumSetting("SchedMoveHigher"); 269 293 schedTime = QDateTime::currentDateTime(); 270 294 271 VERBOSE(VB_SCHEDULE, "PruneOldRecords..."); 272 PruneOldRecords(); 273 VERBOSE(VB_SCHEDULE, "AddNewRecords..."); 274 AddNewRecords(); 275 VERBOSE(VB_SCHEDULE, "AddNotListed..."); 276 AddNotListed(); 295 RecList newlist; 296 297 VERBOSE(VB_IMPORTANT, "PruneOldRecords..."); 298 PruneOldRecords(newlist); 299 VERBOSE(VB_IMPORTANT, "AddNewRecords..."); 300 AddNewRecords(dbConn, recordTable, specsched, threadrunning, 301 *m_tvList, newlist); 302 VERBOSE(VB_IMPORTANT, "AddNotListed..."); 303 AddNotListed(dbConn, recordTable, newlist); 304 305 VERBOSE(VB_IMPORTANT, "Sort by time..."); 306 newlist.sort(comp_overlap); 307 VERBOSE(VB_IMPORTANT, "PruneOverlaps..."); 308 PruneOverlaps(newlist); 309 310 VERBOSE(VB_IMPORTANT, "Sort by priority..."); 311 newlist.sort(comp_priority); 312 VERBOSE(VB_IMPORTANT, "BuildListMaps..."); 313 314 RecList retrylist; 315 QMap<int, RecList> cardlistmap; 316 QMap<int, RecList> recordidlistmap; 317 QMap<QString, RecList> titlelistmap; 318 319 BuildListMaps(newlist, cardlistmap, recordidlistmap, titlelistmap); 277 320 278 VERBOSE(VB_SCHEDULE, "Sort by time..."); 279 reclist.sort(comp_overlap); 280 VERBOSE(VB_SCHEDULE, "PruneOverlaps..."); 281 PruneOverlaps(); 321 VERBOSE(VB_IMPORTANT, "SchedNewRecords..."); 322 SchedNewRecords(schedMoveHigher, newlist, retrylist, 323 cardlistmap, recordidlistmap, titlelistmap); 324 VERBOSE(VB_IMPORTANT, "ClearListMaps..."); 325 ClearListMaps(cardlistmap, recordidlistmap, titlelistmap); 282 326 283 VERBOSE(VB_SCHEDULE, "Sort by priority..."); 284 reclist.sort(comp_priority); 285 VERBOSE(VB_SCHEDULE, "BuildListMaps..."); 286 BuildListMaps(); 287 VERBOSE(VB_SCHEDULE, "SchedNewRecords..."); 288 SchedNewRecords(); 289 VERBOSE(VB_SCHEDULE, "ClearListMaps..."); 290 ClearListMaps(); 327 VERBOSE(VB_IMPORTANT, "Sort by time..."); 328 newlist.sort(comp_redundant); 329 VERBOSE(VB_IMPORTANT, "PruneRedundants..."); 330 bool will_have_conflicts = PruneRedundants(newlist); 291 331 292 VERBOSE(VB_SCHEDULE, "Sort by time..."); 293 reclist.sort(comp_redundant); 294 VERBOSE(VB_SCHEDULE, "PruneRedundants..."); 295 PruneRedundants(); 332 VERBOSE(VB_IMPORTANT, "Sort by time..."); 333 newlist.sort(comp_recstart); 296 334 297 VERBOSE(VB_ SCHEDULE, "Sort by time...");298 reclist.sort(comp_recstart);335 VERBOSE(VB_IMPORTANT, "UpdateNextRecord..."); 336 UpdateNextRecord(dbConn, newlist); 299 337 300 VERBOSE(VB_SCHEDULE, "UpdateNextRecord..."); 301 UpdateNextRecord(); 338 { 339 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locking"); 340 QMutexLocker lockit(reclist_lock); 341 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locked"); 342 copy_reclist(reclist, newlist); 343 hasconflicts = will_have_conflicts; 344 } 345 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- unlocked"); 346 delete_reclist(newlist); 302 347 303 348 return hasconflicts; 304 349 } … … 479 524 } 480 525 } 481 526 482 bool Scheduler::ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp) 527 bool Scheduler::ChangeRecordingEnd(const bool specsched, 528 QMap<int, EncoderLink*> &tvList, 529 ProgramInfo *oldp, 530 ProgramInfo *newp) 483 531 { 484 532 RecordingType oldrectype = oldp->rectype; 485 533 int oldrecordid = oldp->recordid; … … 500 548 else 501 549 return true; 502 550 } 503 EncoderLink *tv = (*m_tvList)[oldp->cardid];551 EncoderLink *tv = tvList[oldp->cardid]; 504 552 RecStatusType rs = tv->StartRecording(oldp); 505 553 if (rs != rsRecording) 506 554 { … … 590 638 } 591 639 } 592 640 593 void Scheduler::PruneOldRecords( void)641 void Scheduler::PruneOldRecords(RecList &reclist) 594 642 { 595 643 RecIter dreciter = reclist.begin(); 596 644 while (dreciter != reclist.end()) … … 610 658 } 611 659 } 612 660 613 void Scheduler::PruneOverlaps( void)661 void Scheduler::PruneOverlaps(RecList &reclist) 614 662 { 615 663 ProgramInfo *lastp = NULL; 616 664 … … 651 699 } 652 700 } 653 701 654 void Scheduler::BuildListMaps(void) 702 void Scheduler::BuildListMaps(RecList &reclist, 703 QMap<int, RecList> &cardlistmap, 704 QMap<int, RecList> &recordidlistmap, 705 QMap<QString, RecList> &titlelistmap) 655 706 { 656 707 RecIter i = reclist.begin(); 657 708 for ( ; i != reclist.end(); i++) … … 668 719 } 669 720 } 670 721 671 void Scheduler::ClearListMaps(void) 722 void Scheduler::ClearListMaps(QMap<int, RecList> &cardlistmap, 723 QMap<int, RecList> &recordidlistmap, 724 QMap<QString, RecList> &titlelistmap) 672 725 { 673 726 cardlistmap.clear(); 674 727 titlelistmap.clear(); … … 698 751 return false; 699 752 } 700 753 701 void Scheduler::MarkOtherShowings(ProgramInfo *p) 754 void Scheduler::MarkOtherShowings(ProgramInfo *p, 755 QMap<int, RecList> &recordidlistmap, 756 QMap<QString, RecList> &titlelistmap) 702 757 { 703 758 RecList *showinglist = &titlelistmap[p->title]; 704 759 … … 746 801 } 747 802 } 748 803 749 void Scheduler::BackupRecStatus( void)804 void Scheduler::BackupRecStatus(RecList &reclist) 750 805 { 751 806 RecIter i = reclist.begin(); 752 807 for ( ; i != reclist.end(); i++) … … 756 811 } 757 812 } 758 813 759 void Scheduler::RestoreRecStatus( void)814 void Scheduler::RestoreRecStatus(RecList &reclist) 760 815 { 761 816 RecIter i = reclist.begin(); 762 817 for ( ; i != reclist.end(); i++) … … 766 821 } 767 822 } 768 823 769 bool Scheduler::TryAnotherShowing(ProgramInfo *p) 824 bool Scheduler::TryAnotherShowing(QMap<int, RecList> &cardlistmap, 825 QMap<QString, RecList> &titlelistmap, 826 QMap<int, RecList> &recordidlistmap, 827 ProgramInfo *p) 770 828 { 771 829 PrintRec(p, " >"); 772 830 … … 815 873 } 816 874 817 875 q->recstatus = rsWillRecord; 818 MarkOtherShowings(q );876 MarkOtherShowings(q, recordidlistmap, titlelistmap); 819 877 PrintRec(p, " -"); 820 878 PrintRec(q, " +"); 821 879 return true; … … 825 883 return false; 826 884 } 827 885 828 void Scheduler::SchedNewRecords(void) 886 void Scheduler::SchedNewRecords(const bool schedMoveHigher, 887 RecList &reclist, 888 RecList &retrylist, 889 QMap<int, RecList> &cardlistmap, 890 QMap<int, RecList> &recordidlistmap, 891 QMap<QString, RecList> &titlelistmap) 829 892 { 830 893 VERBOSE(VB_SCHEDULE, "Scheduling:"); 831 894 … … 834 897 { 835 898 ProgramInfo *p = *i; 836 899 if (p->recstatus == rsRecording) 837 MarkOtherShowings(p );900 MarkOtherShowings(p, recordidlistmap, titlelistmap); 838 901 else if (p->recstatus == rsUnknown) 839 902 { 840 903 RecList &cardlist = cardlistmap[p->cardid]; … … 842 905 if (!FindNextConflict(cardlist, p, k)) 843 906 { 844 907 p->recstatus = rsWillRecord; 845 MarkOtherShowings(p );908 MarkOtherShowings(p, recordidlistmap, titlelistmap); 846 909 PrintRec(p, " +"); 847 910 } 848 911 else … … 857 920 i++; 858 921 if (i == reclist.end() || lastpri != (*i)->recpriority) 859 922 { 860 MoveHigherRecords(); 923 MoveHigherRecords(schedMoveHigher, reclist, retrylist, 924 cardlistmap, recordidlistmap, titlelistmap); 861 925 retrylist.clear(); 862 926 } 863 927 } 864 928 } 865 929 866 void Scheduler::MoveHigherRecords(void) 930 void Scheduler::MoveHigherRecords(const bool schedMoveHigher, 931 RecList &reclist, 932 RecList &retrylist, 933 QMap<int, RecList> &cardlistmap, 934 QMap<int, RecList> &recordidlistmap, 935 QMap<QString, RecList> &titlelistmap) 867 936 { 868 937 RecIter i = retrylist.begin(); 869 938 for ( ; i != retrylist.end(); i++) … … 874 943 875 944 PrintRec(p, " ?"); 876 945 877 if (TryAnotherShowing( p))946 if (TryAnotherShowing(cardlistmap, titlelistmap, recordidlistmap, p)) 878 947 continue; 879 948 880 BackupRecStatus( );949 BackupRecStatus(reclist); 881 950 p->recstatus = rsWillRecord; 882 MarkOtherShowings(p );951 MarkOtherShowings(p, recordidlistmap, titlelistmap); 883 952 884 953 RecList &cardlist = cardlistmap[p->cardid]; 885 954 RecIter k = cardlist.begin(); 886 955 for ( ; FindNextConflict(cardlist, p, k); k++) 887 956 { 888 957 if ((p->recpriority < (*k)->recpriority && !schedMoveHigher) || 889 !TryAnotherShowing(*k)) 958 !TryAnotherShowing(cardlistmap, titlelistmap, 959 recordidlistmap, *k)) 890 960 { 891 RestoreRecStatus( );961 RestoreRecStatus(reclist); 892 962 break; 893 963 } 894 964 } … … 898 968 } 899 969 } 900 970 901 void Scheduler::PruneRedundants(void)971 bool Scheduler::PruneRedundants(RecList &reclist) 902 972 { 903 973 ProgramInfo *lastp = NULL; 904 hasconflicts = false;974 bool hasconflicts = false; 905 975 906 976 RecIter i = reclist.begin(); 907 977 while (i != reclist.end()) … … 951 1021 i = reclist.erase(i); 952 1022 } 953 1023 } 1024 1025 return hasconflicts; 954 1026 } 955 1027 956 void Scheduler::UpdateNextRecord(void) 1028 void Scheduler::UpdateNextRecord(MSqlQueryInfo &dbConn, 1029 RecList &reclist) 957 1030 { 958 1031 QMap<int, QDateTime> nextRecMap; 959 1032 QDateTime now = QDateTime::currentDateTime(); … … 1043 1116 { 1044 1117 QMutexLocker lockit(reclist_lock); 1045 1118 1046 while (retList->size() > 0) 1047 { 1048 ProgramInfo *pginfo = retList->back(); 1049 delete pginfo; 1050 retList->pop_back(); 1051 } 1052 1053 RecIter i = reclist.begin(); 1054 for (; i != reclist.end(); i++) 1055 { 1056 ProgramInfo *p = *i; 1057 retList->push_back(new ProgramInfo(*p)); 1058 } 1119 copy_reclist(*retList, reclist); 1059 1120 retList->sort(comp_timechannel); 1060 1121 } 1061 1122 1062 1123 void Scheduler::getAllPending(QStringList &strList) 1063 1124 { 1064 QMutexLocker lockit(reclist_lock); 1125 RecList retList; 1126 getAllPending(&retList); 1065 1127 1066 1128 strList << QString::number(hasconflicts); 1067 strList << QString::number(re clist.size());1129 strList << QString::number(retList.size()); 1068 1130 1069 RecList *retList = new RecList; 1131 for (RecIter it = retList.begin(); it != retList.end(); ++it) 1132 (*it)->ToStringList(strList); 1070 1133 1071 RecIter i = reclist.begin(); 1072 for (; i != reclist.end(); i++) 1073 { 1074 ProgramInfo *p = *i; 1075 retList->push_back(new ProgramInfo(*p)); 1076 } 1077 retList->sort(comp_timechannel); 1078 1079 for (i = retList->begin(); i != retList->end(); i++) 1080 { 1081 ProgramInfo *p = *i; 1082 p->ToStringList(strList); 1083 delete p; 1084 } 1085 1086 delete retList; 1134 delete_reclist(retList); 1087 1135 } 1088 1136 1089 1137 RecList *Scheduler::getAllScheduled(void) 1090 1138 { 1091 while (schedlist.size() > 0) 1092 { 1093 ProgramInfo *pginfo = schedlist.back(); 1094 delete pginfo; 1095 schedlist.pop_back(); 1096 } 1139 delete_reclist(schedlist); 1097 1140 1098 1141 findAllScheduledPrograms(schedlist); 1099 1142 … … 2008 2051 VERBOSE(VB_SCHEDULE, " +-- Done."); 2009 2052 } 2010 2053 2011 void Scheduler::AddNewRecords(void) 2054 void Scheduler::AddNewRecords(MSqlQueryInfo &dbConn, 2055 const QString &recordTable, 2056 const bool specsched, 2057 const bool threadrunning, 2058 QMap<int, EncoderLink*> &tvList, 2059 RecList &reclist) 2012 2060 { 2013 2061 struct timeval dbstart, dbend; 2014 2062 … … 2022 2070 int ccpriority = gContext->GetNumSetting("CCRecPriority", 0); 2023 2071 2024 2072 QMap<int, bool> cardMap; 2025 QMap<int, EncoderLink *>::Iterator enciter = m_tvList->begin();2026 for (; enciter != m_tvList->end(); ++enciter)2073 QMap<int, EncoderLink *>::Iterator enciter = tvList.begin(); 2074 for (; enciter != tvList.end(); ++enciter) 2027 2075 { 2028 2076 EncoderLink *enc = enciter.data(); 2029 2077 if (enc->IsConnected()) … … 2333 2381 r->recendts != p->recendts && 2334 2382 (r->recordid == p->recordid || 2335 2383 p->rectype == kOverrideRecord)) 2336 ChangeRecordingEnd(r, p); 2384 { 2385 ChangeRecordingEnd(specsched, tvList, r, p); 2386 } 2337 2387 delete p; 2338 2388 p = NULL; 2339 2389 break; … … 2390 2440 reclist.push_back(*tmp); 2391 2441 } 2392 2442 2393 void Scheduler::AddNotListed(void) { 2394 2443 void Scheduler::AddNotListed(MSqlQueryInfo &dbConn, 2444 const QString &recordTable, 2445 RecList &reclist) 2446 { 2395 2447 struct timeval dbstart, dbend; 2396 2448 RecList tmpList; 2397 2449 -
programs/mythbackend/scheduler.h
49 49 RecList *getConflicting(ProgramInfo *pginfo); 50 50 51 51 void PrintList(bool onlyFutureRecordings = false); 52 void PrintRec(ProgramInfo *p, const char *prefix = NULL);52 static void PrintRec(ProgramInfo *p, const char *prefix = NULL); 53 53 54 54 bool HasConflicts(void) { return hasconflicts; } 55 55 … … 66 66 static void *SchedulerThread(void *param); 67 67 68 68 private: 69 QString recordTable;70 71 69 void verifyCards(void); 72 70 73 71 bool FillRecordList(void); 74 72 void UpdateMatches(int recordid); 75 73 void UpdateManuals(int recordid); 76 void PruneOldRecords(void);77 void AddNewRecords(void);78 void AddNotListed(void);79 74 void BuildNewRecordsQueries(int recordid, QStringList &from, QStringList &where, 80 75 MSqlBindings &bindings); 81 void PruneOverlaps(void);82 void BuildListMaps(void);83 void ClearListMaps(void);84 bool FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &iter);85 void MarkOtherShowings(ProgramInfo *p);86 void MarkShowingsList(RecList &showinglist, ProgramInfo *p);87 void BackupRecStatus(void);88 void RestoreRecStatus(void);89 bool TryAnotherShowing(ProgramInfo *p);90 void SchedNewRecords(void);91 void MoveHigherRecords(void);92 void PruneRedundants(void);93 void UpdateNextRecord(void);94 76 95 bool ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp);96 97 77 void findAllScheduledPrograms(list<ProgramInfo *> &proglist); 98 78 bool CheckShutdownServer(int prerollseconds, QDateTime &idleSince, 99 79 bool &blockShutdown); 100 80 void ShutdownServer(int prerollseconds); 101 81 82 // statics 83 static void PruneOldRecords(RecList &reclist); 84 static void AddNewRecords(MSqlQueryInfo &dbConn, 85 const QString &recordTable, 86 bool specsched, 87 bool threadrunning, 88 QMap<int, EncoderLink*> &tvList, 89 RecList &reclist); 90 static void AddNotListed(MSqlQueryInfo &dbConn, 91 const QString &recordTable, 92 RecList &reclist); 93 static void PruneOverlaps(RecList &reclist); 94 static void BuildListMaps(RecList &reclist, 95 QMap<int, RecList> &cardlistmap, 96 QMap<int, RecList> &recordidlistmap, 97 QMap<QString, RecList> &titlelistmap); 98 static void ClearListMaps(QMap<int, RecList> &cardlistmap, 99 QMap<int, RecList> &recordidlistmap, 100 QMap<QString, RecList> &titlelistmap); 101 static bool FindNextConflict(RecList &cardlist, 102 ProgramInfo *p, 103 RecIter &iter); 104 static void MarkOtherShowings(ProgramInfo *p, 105 QMap<int, RecList> &recordidlistmap, 106 QMap<QString, RecList> &titlelistmap); 107 static void MarkShowingsList(RecList &showinglist, 108 ProgramInfo *p); 109 static void BackupRecStatus(RecList &reclist); 110 static void RestoreRecStatus(RecList &reclist); 111 static bool TryAnotherShowing(QMap<int, RecList> &cardlistmap, 112 QMap<QString, RecList> &titlelistmap, 113 QMap<int, RecList> &recordidlistmap, 114 ProgramInfo *p); 115 static void SchedNewRecords(bool schedMoveHigher, 116 RecList &reclist, 117 RecList &retrylist, 118 QMap<int, RecList> &cardlistmap, 119 QMap<int, RecList> &recordidlistmap, 120 QMap<QString, RecList> &titlelistmap); 121 static void MoveHigherRecords(bool schedMoveHigher, 122 RecList &reclist, 123 RecList &retrylist, 124 QMap<int, RecList> &cardlistmap, 125 QMap<int, RecList> &recordidlistmap, 126 QMap<QString, RecList> &titlelistmap); 127 static bool PruneRedundants(RecList &reclist); 128 static void UpdateNextRecord(MSqlQueryInfo &dbConn, 129 RecList &reclist); 130 static bool ChangeRecordingEnd(bool specsched, 131 QMap<int, EncoderLink*> &tvList, 132 ProgramInfo *oldp, 133 ProgramInfo *newp); 102 134 135 private: 136 QString recordTable; 103 137 QValueList<int> reschedQueue; 104 138 QMutex reschedLock; 105 139 QMutex recordmatchLock; 106 140 QWaitCondition reschedWait; 107 141 RecList reclist; 108 RecList retrylist;109 142 RecList schedlist; 110 QMap<int, RecList> cardlistmap;111 QMap<int, RecList> recordidlistmap;112 QMap<QString, RecList> titlelistmap;113 143 114 144 QMutex *reclist_lock; 115 145 QMutex *schedlist_lock;
