Ticket #2282: 2282.patch
File 2282.patch, 23.9 KB (added by , 18 years ago) |
---|
-
programs/mythfrontend/playbackbox.cpp
1405 1405 1406 1406 void PlaybackBox::listChanged(void) 1407 1407 { 1408 VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- begin"); 1408 1409 if (playingSomething) 1409 1410 return; 1410 1411 … … 1413 1414 update(drawTotalBounds); 1414 1415 if (type == Delete) 1415 1416 UpdateProgressBar(); 1417 VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- end"); 1416 1418 } 1417 1419 1418 1420 bool PlaybackBox::FillList() 1419 1421 { 1422 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- begin"); 1420 1423 ProgramInfo *p; 1421 1424 1422 1425 // Save some information so we can find our place again. … … 1537 1540 titleIndex = 0; 1538 1541 playList.clear(); 1539 1542 1543 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 1"); 1540 1544 return 0; 1541 1545 } 1542 1546 … … 1656 1660 } 1657 1661 } 1658 1662 1663 VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 2"); 1659 1664 return (infoList != NULL); 1660 1665 } 1661 1666 … … 2195 2200 2196 2201 void PlaybackBox::showDeletePopup(ProgramInfo *program, deletePopupType types) 2197 2202 { 2203 VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- begin"); 2204 2198 2205 freeSpaceNeedsUpdate = true; 2199 2206 2200 2207 popup = new MythPopupBox(gContext->GetMainWindow(), drawPopupSolid, … … 2297 2304 popup->ShowPopup(this, SLOT(doCancel())); 2298 2305 2299 2306 expectingPopup = true; 2307 2308 VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- end"); 2300 2309 } 2301 2310 2302 2311 void PlaybackBox::showAvailablePopup(ProgramInfo *rec) … … 3165 3174 3166 3175 void PlaybackBox::doDelete(void) 3167 3176 { 3177 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- begin"); 3178 3168 3179 if (!expectingPopup) 3169 3180 { 3170 3181 previewSuspend = false; 3182 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 1"); 3171 3183 return; 3172 3184 } 3173 3185 … … 3178 3190 { 3179 3191 showAvailablePopup(delitem); 3180 3192 previewSuspend = false; 3193 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 2"); 3181 3194 return; 3182 3195 } 3183 3196 … … 3196 3209 } 3197 3210 else 3198 3211 showDeletePopup(delitem, ForceDeleteRecording); 3212 3213 VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 3"); 3199 3214 } 3200 3215 3201 3216 void PlaybackBox::doForceDelete(void) -
programs/mythbackend/mainserver.cpp
968 968 969 969 void MainServer::HandleQueryRecordings(QString type, PlaybackSock *pbs) 970 970 { 971 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- begin"); 972 971 973 MythSocket *pbssock = pbs->getSocket(); 974 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- A"); 972 975 bool islocal = pbs->isLocal(); 976 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- B"); 973 977 QString playbackhost = pbs->getHostname(); 978 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- C"); 974 979 975 980 QString fs_db_name = ""; 976 981 … … 979 984 RecIter ri; 980 985 RecList schedList; 981 986 if (m_sched) 987 { 988 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- D"); 982 989 m_sched->getAllPending(&schedList); 990 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- E"); 991 } 983 992 984 993 QString ip = gContext->GetSetting("BackendServerIP"); 985 994 QString port = gContext->GetSetting("BackendServerPort"); … … 989 998 QString inUseForWhat; 990 999 QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60); 991 1000 1001 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- F"); 992 1002 MSqlQuery query(MSqlQuery::InitCon()); 1003 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- G"); 993 1004 994 1005 query.prepare("SELECT DISTINCT chanid, starttime, recusage " 995 1006 " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;"); 996 1007 query.bindValue(":ONEHOURAGO", oneHourAgo); 997 1008 1009 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 0"); 1010 998 1011 if (query.exec() && query.isActive() && query.size() > 0) 999 1012 while (query.next()) 1000 1013 { … … 1013 1026 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING; 1014 1027 } 1015 1028 1029 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 1"); 1016 1030 1017 1031 QString thequery = 1018 1032 "SELECT recorded.chanid,recorded.starttime,recorded.endtime," … … 1056 1070 1057 1071 query.prepare(thequery); 1058 1072 1073 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.0"); 1074 1059 1075 if (!query.exec() || !query.isActive()) 1060 1076 { 1061 1077 MythContext::DBError("ProgramList::FromRecorded", query); … … 1065 1081 { 1066 1082 outputlist << QString::number(query.size()); 1067 1083 1084 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.1"); 1085 1068 1086 while (query.next()) 1069 1087 { 1070 1088 ProgramInfo *proginfo = new ProgramInfo; … … 1253 1271 1254 1272 delete proginfo; 1255 1273 } 1274 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.2"); 1256 1275 } 1257 1276 1277 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 3"); 1278 1258 1279 for (ri = schedList.begin(); ri != schedList.end(); ri++) 1259 1280 delete (*ri); 1260 1281 1282 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- sending"); 1261 1283 SendResponse(pbssock, outputlist); 1284 VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- end"); 1262 1285 } 1263 1286 1264 1287 void MainServer::HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs) -
programs/mythbackend/scheduler.cpp
75 75 } 76 76 } 77 77 78 Scheduler::~Scheduler()78 static void delete_reclist(RecList &reclist) 79 79 { 80 80 while (reclist.size() > 0) 81 81 { … … 85 85 } 86 86 } 87 87 88 static void copy_reclist(RecList ©, const RecList &orig) 89 { 90 delete_reclist(copy); 91 92 RecList::const_iterator it = orig.begin(); 93 for (; it != orig.end(); it++) 94 copy.push_back(new ProgramInfo(*(*it))); 95 } 96 97 Scheduler::~Scheduler() 98 { 99 delete_reclist(reclist); 100 101 if (reclist_lock) 102 { 103 delete reclist_lock; 104 reclist_lock = NULL; 105 } 106 107 if (schedlist_lock) 108 { 109 delete schedlist_lock; 110 schedlist_lock = NULL; 111 } 112 } 113 88 114 void Scheduler::SetMainServer(MainServer *ms) 89 115 { 90 116 m_mainServer = ms; … … 262 288 263 289 bool Scheduler::FillRecordList(void) 264 290 { 265 QMutexLocker lockit(reclist_lock);266 267 291 schedMoveHigher = (bool)gContext->GetNumSetting("SchedMoveHigher"); 268 292 schedTime = QDateTime::currentDateTime(); 269 293 270 VERBOSE(VB_SCHEDULE, "PruneOldRecords..."); 271 PruneOldRecords(); 272 VERBOSE(VB_SCHEDULE, "AddNewRecords..."); 273 AddNewRecords(); 274 VERBOSE(VB_SCHEDULE, "AddNotListed..."); 275 AddNotListed(); 294 RecList newlist; 276 295 277 VERBOSE(VB_SCHEDULE, "Sort by time..."); 278 reclist.sort(comp_overlap); 279 VERBOSE(VB_SCHEDULE, "PruneOverlaps..."); 280 PruneOverlaps(); 296 VERBOSE(VB_IMPORTANT, "PruneOldRecords..."); 297 PruneOldRecords(newlist); 298 VERBOSE(VB_IMPORTANT, "AddNewRecords..."); 299 AddNewRecords(dbConn, recordTable, specsched, threadrunning, 300 *m_tvList, newlist); 301 VERBOSE(VB_IMPORTANT, "AddNotListed..."); 302 AddNotListed(dbConn, recordTable, newlist); 281 303 282 VERBOSE(VB_SCHEDULE, "Sort by priority..."); 283 reclist.sort(comp_priority); 284 VERBOSE(VB_SCHEDULE, "BuildListMaps..."); 285 BuildListMaps(); 286 VERBOSE(VB_SCHEDULE, "SchedNewRecords..."); 287 SchedNewRecords(); 288 VERBOSE(VB_SCHEDULE, "ClearListMaps..."); 289 ClearListMaps(); 304 VERBOSE(VB_IMPORTANT, "Sort by time..."); 305 newlist.sort(comp_overlap); 306 VERBOSE(VB_IMPORTANT, "PruneOverlaps..."); 307 PruneOverlaps(newlist); 290 308 291 VERBOSE(VB_SCHEDULE, "Sort by time..."); 292 reclist.sort(comp_redundant); 293 VERBOSE(VB_SCHEDULE, "PruneRedundants..."); 294 PruneRedundants(); 309 VERBOSE(VB_IMPORTANT, "Sort by priority..."); 310 newlist.sort(comp_priority); 311 VERBOSE(VB_IMPORTANT, "BuildListMaps..."); 295 312 296 VERBOSE(VB_SCHEDULE, "Sort by time..."); 297 reclist.sort(comp_recstart); 313 RecList retrylist; 314 QMap<int, RecList> cardlistmap; 315 QMap<int, RecList> recordidlistmap; 316 QMap<QString, RecList> titlelistmap; 298 317 318 BuildListMaps(newlist, cardlistmap, recordidlistmap, titlelistmap); 319 320 VERBOSE(VB_IMPORTANT, "SchedNewRecords..."); 321 SchedNewRecords(schedMoveHigher, newlist, retrylist, 322 cardlistmap, recordidlistmap, titlelistmap); 323 VERBOSE(VB_IMPORTANT, "ClearListMaps..."); 324 ClearListMaps(cardlistmap, recordidlistmap, titlelistmap); 325 326 VERBOSE(VB_IMPORTANT, "Sort by time..."); 327 newlist.sort(comp_redundant); 328 VERBOSE(VB_IMPORTANT, "PruneRedundants..."); 329 bool newhasconflicts = PruneRedundants(newlist); 330 331 VERBOSE(VB_IMPORTANT, "Sort by time..."); 332 newlist.sort(comp_recstart); 333 334 { 335 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locking"); 336 QMutexLocker lockit(reclist_lock); 337 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locked"); 338 copy_reclist(reclist, newlist); 339 hasconflicts = newhasconflicts; 340 } 341 VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- unlocked"); 342 delete_reclist(newlist); 343 299 344 return hasconflicts; 300 345 } 301 346 … … 475 520 } 476 521 } 477 522 478 bool Scheduler::ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp) 523 bool Scheduler::ChangeRecordingEnd(const bool specsched, 524 QMap<int, EncoderLink*> &tvList, 525 ProgramInfo *oldp, 526 ProgramInfo *newp) 479 527 { 480 528 RecordingType oldrectype = oldp->rectype; 481 529 int oldrecordid = oldp->recordid; … … 496 544 else 497 545 return true; 498 546 } 499 EncoderLink *tv = (*m_tvList)[oldp->cardid];547 EncoderLink *tv = tvList[oldp->cardid]; 500 548 RecStatusType rs = tv->StartRecording(oldp); 501 549 if (rs != rsRecording) 502 550 { … … 586 634 } 587 635 } 588 636 589 void Scheduler::PruneOldRecords( void)637 void Scheduler::PruneOldRecords(RecList &reclist) 590 638 { 591 639 RecIter dreciter = reclist.begin(); 592 640 while (dreciter != reclist.end()) … … 606 654 } 607 655 } 608 656 609 void Scheduler::PruneOverlaps( void)657 void Scheduler::PruneOverlaps(RecList &reclist) 610 658 { 611 659 ProgramInfo *lastp = NULL; 612 660 … … 647 695 } 648 696 } 649 697 650 void Scheduler::BuildListMaps(void) 698 void Scheduler::BuildListMaps(RecList &reclist, 699 QMap<int, RecList> &cardlistmap, 700 QMap<int, RecList> &recordidlistmap, 701 QMap<QString, RecList> &titlelistmap) 651 702 { 652 703 RecIter i = reclist.begin(); 653 704 for ( ; i != reclist.end(); i++) … … 664 715 } 665 716 } 666 717 667 void Scheduler::ClearListMaps(void) 718 void Scheduler::ClearListMaps(QMap<int, RecList> &cardlistmap, 719 QMap<int, RecList> &recordidlistmap, 720 QMap<QString, RecList> &titlelistmap) 668 721 { 669 722 cardlistmap.clear(); 670 723 titlelistmap.clear(); … … 694 747 return false; 695 748 } 696 749 697 void Scheduler::MarkOtherShowings(ProgramInfo *p) 750 void Scheduler::MarkOtherShowings(ProgramInfo *p, 751 QMap<int, RecList> &recordidlistmap, 752 QMap<QString, RecList> &titlelistmap) 698 753 { 699 754 RecList *showinglist = &titlelistmap[p->title]; 700 755 … … 742 797 } 743 798 } 744 799 745 void Scheduler::BackupRecStatus( void)800 void Scheduler::BackupRecStatus(RecList &reclist) 746 801 { 747 802 RecIter i = reclist.begin(); 748 803 for ( ; i != reclist.end(); i++) … … 752 807 } 753 808 } 754 809 755 void Scheduler::RestoreRecStatus( void)810 void Scheduler::RestoreRecStatus(RecList &reclist) 756 811 { 757 812 RecIter i = reclist.begin(); 758 813 for ( ; i != reclist.end(); i++) … … 762 817 } 763 818 } 764 819 765 bool Scheduler::TryAnotherShowing(ProgramInfo *p) 820 bool Scheduler::TryAnotherShowing(QMap<int, RecList> &cardlistmap, 821 QMap<QString, RecList> &titlelistmap, 822 QMap<int, RecList> &recordidlistmap, 823 ProgramInfo *p) 766 824 { 767 825 PrintRec(p, " >"); 768 826 … … 811 869 } 812 870 813 871 q->recstatus = rsWillRecord; 814 MarkOtherShowings(q );872 MarkOtherShowings(q, recordidlistmap, titlelistmap); 815 873 PrintRec(p, " -"); 816 874 PrintRec(q, " +"); 817 875 return true; … … 821 879 return false; 822 880 } 823 881 824 void Scheduler::SchedNewRecords(void) 882 void Scheduler::SchedNewRecords(const bool schedMoveHigher, 883 RecList &reclist, 884 RecList &retrylist, 885 QMap<int, RecList> &cardlistmap, 886 QMap<int, RecList> &recordidlistmap, 887 QMap<QString, RecList> &titlelistmap) 825 888 { 826 889 VERBOSE(VB_SCHEDULE, "Scheduling:"); 827 890 … … 830 893 { 831 894 ProgramInfo *p = *i; 832 895 if (p->recstatus == rsRecording) 833 MarkOtherShowings(p );896 MarkOtherShowings(p, recordidlistmap, titlelistmap); 834 897 else if (p->recstatus == rsUnknown) 835 898 { 836 899 RecList &cardlist = cardlistmap[p->cardid]; … … 838 901 if (!FindNextConflict(cardlist, p, k)) 839 902 { 840 903 p->recstatus = rsWillRecord; 841 MarkOtherShowings(p );904 MarkOtherShowings(p, recordidlistmap, titlelistmap); 842 905 PrintRec(p, " +"); 843 906 } 844 907 else … … 853 916 i++; 854 917 if (i == reclist.end() || lastpri != (*i)->recpriority) 855 918 { 856 MoveHigherRecords(); 919 MoveHigherRecords(schedMoveHigher, reclist, retrylist, 920 cardlistmap, recordidlistmap, titlelistmap); 857 921 retrylist.clear(); 858 922 } 859 923 } 860 924 } 861 925 862 void Scheduler::MoveHigherRecords(void) 926 void Scheduler::MoveHigherRecords(const bool schedMoveHigher, 927 RecList &reclist, 928 RecList &retrylist, 929 QMap<int, RecList> &cardlistmap, 930 QMap<int, RecList> &recordidlistmap, 931 QMap<QString, RecList> &titlelistmap) 863 932 { 864 933 RecIter i = retrylist.begin(); 865 934 for ( ; i != retrylist.end(); i++) … … 870 939 871 940 PrintRec(p, " ?"); 872 941 873 if (TryAnotherShowing( p))942 if (TryAnotherShowing(cardlistmap, titlelistmap, recordidlistmap, p)) 874 943 continue; 875 944 876 BackupRecStatus( );945 BackupRecStatus(reclist); 877 946 p->recstatus = rsWillRecord; 878 MarkOtherShowings(p );947 MarkOtherShowings(p, recordidlistmap, titlelistmap); 879 948 880 949 RecList &cardlist = cardlistmap[p->cardid]; 881 950 RecIter k = cardlist.begin(); 882 951 for ( ; FindNextConflict(cardlist, p, k); k++) 883 952 { 884 953 if ((p->recpriority < (*k)->recpriority && !schedMoveHigher) || 885 !TryAnotherShowing(*k)) 954 !TryAnotherShowing(cardlistmap, titlelistmap, 955 recordidlistmap, *k)) 886 956 { 887 RestoreRecStatus( );957 RestoreRecStatus(reclist); 888 958 break; 889 959 } 890 960 } … … 894 964 } 895 965 } 896 966 897 void Scheduler::PruneRedundants(void)967 bool Scheduler::PruneRedundants(RecList &reclist) 898 968 { 899 969 ProgramInfo *lastp = NULL; 900 hasconflicts = false;970 bool hasconflicts = false; 901 971 902 972 RecIter i = reclist.begin(); 903 973 while (i != reclist.end()) … … 947 1017 i = reclist.erase(i); 948 1018 } 949 1019 } 1020 1021 return hasconflicts; 950 1022 } 951 1023 952 1024 void Scheduler::getConflicting(ProgramInfo *pginfo, QStringList &strlist) … … 984 1056 { 985 1057 QMutexLocker lockit(reclist_lock); 986 1058 987 while (retList->size() > 0) 988 { 989 ProgramInfo *pginfo = retList->back(); 990 delete pginfo; 991 retList->pop_back(); 992 } 993 994 RecIter i = reclist.begin(); 995 for (; i != reclist.end(); i++) 996 { 997 ProgramInfo *p = *i; 998 retList->push_back(new ProgramInfo(*p)); 999 } 1059 copy_reclist(*retList, reclist); 1000 1060 retList->sort(comp_timechannel); 1001 1061 } 1002 1062 1003 1063 void Scheduler::getAllPending(QStringList &strList) 1004 1064 { 1005 QMutexLocker lockit(reclist_lock); 1065 RecList retList; 1066 getAllPending(&retList); 1006 1067 1007 1068 strList << QString::number(hasconflicts); 1008 strList << QString::number(re clist.size());1069 strList << QString::number(retList.size()); 1009 1070 1010 RecList *retList = new RecList; 1071 for (RecIter it = retList.begin(); it != retList.end(); ++it) 1072 (*it)->ToStringList(strList); 1011 1073 1012 RecIter i = reclist.begin(); 1013 for (; i != reclist.end(); i++) 1014 { 1015 ProgramInfo *p = *i; 1016 retList->push_back(new ProgramInfo(*p)); 1017 } 1018 retList->sort(comp_timechannel); 1019 1020 for (i = retList->begin(); i != retList->end(); i++) 1021 { 1022 ProgramInfo *p = *i; 1023 p->ToStringList(strList); 1024 delete p; 1025 } 1026 1027 delete retList; 1074 delete_reclist(retList); 1028 1075 } 1029 1076 1030 1077 RecList *Scheduler::getAllScheduled(void) 1031 1078 { 1032 while (schedlist.size() > 0) 1033 { 1034 ProgramInfo *pginfo = schedlist.back(); 1035 delete pginfo; 1036 schedlist.pop_back(); 1037 } 1079 delete_reclist(schedlist); 1038 1080 1039 1081 findAllScheduledPrograms(schedlist); 1040 1082 … … 1930 1972 VERBOSE(VB_SCHEDULE, " +-- Done."); 1931 1973 } 1932 1974 1933 void Scheduler::AddNewRecords(void) 1975 void Scheduler::AddNewRecords(MSqlQueryInfo &dbConn, 1976 const QString &recordTable, 1977 const bool specsched, 1978 const bool threadrunning, 1979 QMap<int, EncoderLink*> &tvList, 1980 RecList &reclist) 1934 1981 { 1935 1982 struct timeval dbstart, dbend; 1936 1983 … … 1944 1991 int ccpriority = gContext->GetNumSetting("CCRecPriority", 0); 1945 1992 1946 1993 QMap<int, bool> cardMap; 1947 QMap<int, EncoderLink *>::Iterator enciter = m_tvList->begin();1948 for (; enciter != m_tvList->end(); ++enciter)1994 QMap<int, EncoderLink *>::Iterator enciter = tvList.begin(); 1995 for (; enciter != tvList.end(); ++enciter) 1949 1996 { 1950 1997 EncoderLink *enc = enciter.data(); 1951 1998 if (enc->IsConnected()) … … 2255 2302 r->recendts != p->recendts && 2256 2303 (r->recordid == p->recordid || 2257 2304 p->rectype == kOverrideRecord)) 2258 ChangeRecordingEnd(r, p); 2305 { 2306 ChangeRecordingEnd(specsched, tvList, r, p); 2307 } 2259 2308 delete p; 2260 2309 p = NULL; 2261 2310 break; … … 2312 2361 reclist.push_back(*tmp); 2313 2362 } 2314 2363 2315 void Scheduler::AddNotListed(void) { 2316 2364 void Scheduler::AddNotListed(MSqlQueryInfo &dbConn, 2365 const QString &recordTable, 2366 RecList &reclist) 2367 { 2317 2368 struct timeval dbstart, dbend; 2318 2369 RecList tmpList; 2319 2370 -
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 … … 70 70 bool FillRecordList(void); 71 71 void UpdateMatches(int recordid); 72 72 void UpdateManuals(int recordid); 73 void PruneOldRecords(void); 74 void AddNewRecords(void); 75 void AddNotListed(void); 73 static void PruneOldRecords(RecList&); 74 static void AddNewRecords(MSqlQueryInfo &dbConn, 75 const QString &recordTable, 76 bool specsched, 77 bool threadrunning, 78 QMap<int, EncoderLink*> &tvList, 79 RecList &reclist); 80 static void AddNotListed(MSqlQueryInfo &dbConn, 81 const QString &recordTable, RecList&); 76 82 void BuildNewRecordsQueries(int recordid, QStringList &from, QStringList &where, 77 83 MSqlBindings &bindings); 78 void PruneOverlaps(void); 79 void BuildListMaps(void); 80 void ClearListMaps(void); 81 bool FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &iter); 82 void MarkOtherShowings(ProgramInfo *p); 83 void MarkShowingsList(RecList &showinglist, ProgramInfo *p); 84 void BackupRecStatus(void); 85 void RestoreRecStatus(void); 86 bool TryAnotherShowing(ProgramInfo *p); 87 void SchedNewRecords(void); 88 void MoveHigherRecords(void); 89 void PruneRedundants(void); 84 static void PruneOverlaps(RecList&); 85 static void BuildListMaps(RecList &reclist, 86 QMap<int, RecList> &cardlistmap, 87 QMap<int, RecList> &recordidlistmap, 88 QMap<QString, RecList> &titlelistmap); 89 static void ClearListMaps(QMap<int, RecList> &cardlistmap, 90 QMap<int, RecList> &recordidlistmap, 91 QMap<QString, RecList> &titlelistmap); 92 static bool FindNextConflict(RecList &cardlist, 93 ProgramInfo *p, RecIter &iter); 94 static void MarkOtherShowings(ProgramInfo *p, 95 QMap<int, RecList> &recordidlistmap, 96 QMap<QString, RecList> &titlelistmap); 97 static void MarkShowingsList(RecList &showinglist, ProgramInfo *p); 98 static void BackupRecStatus(RecList &reclist); 99 static void RestoreRecStatus(RecList &reclist); 100 static bool TryAnotherShowing(QMap<int, RecList> &cardlistmap, 101 QMap<QString, RecList> &titlelistmap, 102 QMap<int, RecList> &recordidlistmap, 103 ProgramInfo *p); 104 static void SchedNewRecords(const bool schedMoveHigher, 105 RecList &reclist, 106 RecList &retrylist, 107 QMap<int, RecList> &cardlistmap, 108 QMap<int, RecList> &recordidlistmap, 109 QMap<QString, RecList> &titlelistmap); 110 static void MoveHigherRecords(const bool schedMoveHigher, 111 RecList &reclist, 112 RecList &retrylist, 113 QMap<int, RecList> &cardlistmap, 114 QMap<int, RecList> &recordidlistmap, 115 QMap<QString, RecList> &titlelistmap); 116 static bool PruneRedundants(RecList&); 117 static bool ChangeRecordingEnd(bool specsched, 118 QMap<int, EncoderLink*> &tvList, 119 ProgramInfo *oldp, ProgramInfo *newp); 90 120 91 bool ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp);92 93 121 void findAllScheduledPrograms(list<ProgramInfo *> &proglist); 94 122 bool CheckShutdownServer(int prerollseconds, QDateTime &idleSince, 95 123 bool &blockShutdown); … … 101 129 QMutex recordmatchLock; 102 130 QWaitCondition reschedWait; 103 131 RecList reclist; 104 RecList retrylist;105 132 RecList schedlist; 106 QMap<int, RecList> cardlistmap;107 QMap<int, RecList> recordidlistmap;108 QMap<QString, RecList> titlelistmap;109 133 110 134 QMutex *reclist_lock; 111 135 QMutex *schedlist_lock;