Ticket #255: smarter-scheduling.2.020rediff.diff
File smarter-scheduling.2.020rediff.diff, 11.1 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/programinfo.cpp
3867 3867 } 3868 3868 message += "\n"; 3869 3869 delete confList; 3870 3871 if (gContext->GetNumSetting("OverTimePriority") == 3 3872 && (gContext->GetNumSetting("RecordOverTime") > 0 || 3873 gContext->GetNumSetting("RecordPreRoll") > 0)) 3874 message += QObject::tr("\nYou may be able to eliminate " 3875 "conflicts by changing your OverTime setting from " 3876 "\"Always\" to something less stringent.\n"); 3870 3877 } 3871 3878 3872 3879 DialogBox diag(gContext->GetMainWindow(), message); -
programs/mythbackend/scheduler.cpp
285 285 BuildListMaps(); 286 286 VERBOSE(VB_SCHEDULE, "SchedNewRecords..."); 287 287 SchedNewRecords(); 288 // If user has a global setting to start recordings early or finish 289 // them late, we'll see if we can better honour this by finding 290 // alternate showings. 291 if(gContext->GetNumSetting("OverTimePriority") > 0 292 && (gContext->GetNumSetting("RecordOverTime") > 0 || 293 gContext->GetNumSetting("RecordPreRoll") > 0)) 294 { 295 VERBOSE(VB_SCHEDULE, "Sort by time..."); 296 reclist.sort(comp_recstart); 297 298 VERBOSE(VB_SCHEDULE, "ShuffleForOverrecord..."); 299 ShuffleForOverrecord(); 300 } 301 288 302 VERBOSE(VB_SCHEDULE, "ClearListMaps..."); 289 303 ClearListMaps(); 290 304 … … 671 685 recordidlistmap.clear(); 672 686 } 673 687 674 bool Scheduler::FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &j )688 bool Scheduler::FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &j, bool findSoftConflicts) 675 689 { 690 691 int prerollseconds; 692 int overrecordseconds; 693 694 // A "soft conflict" is when two programs overlap only when the 695 // global underrecord and overrecord settings are taken into 696 // consideration. 697 // We consider them if either: 698 // (a) the user has specified that he ALWAYS wants the overrecord 699 // buffers honoured; or 700 // (b) the user wants them honoured in some cases, and this is one 701 // of those as indicated by the findSoftConflicts flag 702 if (gContext->GetNumSetting("OverTimePriority") == 3) 703 findSoftConflicts = 1; 704 705 if (findSoftConflicts) 706 { 707 prerollseconds = gContext->GetNumSetting("RecordPreRoll"); 708 overrecordseconds = gContext->GetNumSetting("RecordOverTime"); 709 } 710 676 711 for ( ; j != cardlist.end(); j++) 677 712 { 678 713 ProgramInfo *q = *j; … … 683 718 continue; 684 719 if (p->cardid != 0 && p->cardid != q->cardid) 685 720 continue; 686 if (p->recendts <= q->recstartts || p->recstartts >= q->recendts) 687 continue; 721 if (findSoftConflicts) 722 { 723 if (p->recendts.addSecs(overrecordseconds) <= 724 q->recstartts.addSecs((-1) * prerollseconds) 725 || p->recstartts.addSecs((-1) * prerollseconds) >= 726 q->recendts.addSecs(overrecordseconds)) 727 continue; 728 } 729 else 730 { 731 if (p->recendts <= q->recstartts || p->recstartts >= q->recendts) 732 continue; 733 } 688 734 if (p->inputid == q->inputid && p->shareable) 689 735 continue; 690 736 … … 949 995 } 950 996 } 951 997 998 void Scheduler::ShuffleForOverrecord(void) 999 { 1000 VERBOSE(VB_SCHEDULE, "Trying to accommodate pre-roll / overrecord:"); 1001 1002 RecIter i = reclist.begin(); 1003 1004 for ( ; i != reclist.end(); i++) 1005 { 1006 ProgramInfo *p = *i; 1007 1008 if (p->recstatus != rsRecording && p->recstatus != rsWillRecord) 1009 continue; 1010 1011 // Look for soft conflicts with any other scheduled program 1012 RecIter k = reclist.begin(); 1013 if (FindNextConflict(reclist, p, k, true)) 1014 { 1015 // There's a soft conflict, so let's see if a different 1016 // showing would give us no conflicts at all. 1017 1018 // Get list of alternative showings 1019 RecList &showinglist = titlelistmap[p->title]; 1020 RecIter j = showinglist.begin(); 1021 1022 // Cycle through showings, looking for one that won't conflict 1023 for ( ; j != showinglist.end(); j++) 1024 { 1025 ProgramInfo *q = *j; 1026 1027 // No need to re-check the same showing 1028 if (q == p) 1029 continue; 1030 1031 // Don't consider showings that use a different tuner 1032 // card if the user has specified he doesn't want this. 1033 if (gContext->GetNumSetting("OverTimePriority") < 2 1034 && p->cardid != q->cardid) 1035 continue; 1036 1037 k = reclist.begin(); 1038 if (!FindNextConflict(reclist, q, k, true)) 1039 { 1040 // This showing is completely conflict-free, so 1041 // substitute it. 1042 1043 q->recstatus = rsWillRecord; 1044 MarkOtherShowings(q); 1045 PrintRec(p, " -"); 1046 PrintRec(q, " +"); 1047 break; 1048 } 1049 } 1050 } 1051 } 1052 } 1053 952 1054 void Scheduler::getConflicting(ProgramInfo *pginfo, QStringList &strlist) 953 1055 { 954 1056 QMutexLocker lockit(reclist_lock); -
programs/mythbackend/scheduler.h
78 78 void PruneOverlaps(void); 79 79 void BuildListMaps(void); 80 80 void ClearListMaps(void); 81 bool FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &iter );81 bool FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &iter, bool findSoftConflicts = false); 82 82 void MarkOtherShowings(ProgramInfo *p); 83 83 void MarkShowingsList(RecList &showinglist, ProgramInfo *p); 84 84 void BackupRecStatus(void); … … 87 87 void SchedNewRecords(void); 88 88 void MoveHigherRecords(void); 89 89 void PruneRedundants(void); 90 void ShuffleForOverrecord(void); 90 91 91 92 bool ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp); 92 93 -
programs/mythfrontend/globalsettings.cpp
626 626 bs->setLabel(QObject::tr("Time to record before start of show " 627 627 "(in seconds)")); 628 628 bs->setHelpText(QObject::tr("This global setting allows the recorder " 629 "to start before the scheduled start time. It does " 630 "not affect the scheduler. It is ignored when two shows " 631 "have been scheduled without enough time in between.")); 629 "to start before the scheduled start time.")); 632 630 bs->setValue(0); 633 631 return bs; 634 632 } … … 639 637 bs->setLabel(QObject::tr("Time to record past end of show (in seconds)")); 640 638 bs->setValue(0); 641 639 bs->setHelpText(QObject::tr("This global setting allows the recorder " 642 "to record beyond the scheduled end time. It does " 643 "not affect the scheduler. It is ignored when two shows " 644 "have been scheduled without enough time in between.")); 640 "to record beyond the scheduled end time.")); 645 641 return bs; 646 642 } 647 643 … … 652 648 ge->setValue(QObject::tr("category name")); 653 649 ge->setHelpText(QObject::tr("For a specific category (e.g. " 654 650 "\"Sports event\"), request that shows " 655 "be autoextended. Only works if a"651 "be autoextended. Requires that the " 656 652 "show's category can be determined.")); 657 653 return ge; 658 654 } … … 663 659 0, 180, 60, true); 664 660 bs->setLabel(QObject::tr("Record past end of show (in minutes)")); 665 661 bs->setValue(30); 666 bs->setHelpText(QObject::tr("For the specified category, an attempt " 667 "will be made to extend the recording " 668 "by the specified time. It is ignored " 669 "when two shows have been scheduled " 670 "without enough time in between.")); 662 bs->setHelpText(QObject::tr("For the specified category, attempt " 663 "to extend the recording " 664 "by the specified time.")); 671 665 return bs; 672 666 } 673 667 … … 676 670 VerticalConfigurationGroup *vcg = 677 671 new VerticalConfigurationGroup(false, false); 678 672 679 vcg->setLabel(QObject::tr("Category record over-time"));673 vcg->setLabel(QObject::tr("Category record OverTime")); 680 674 vcg->setUseLabel(true); 681 675 vcg->addChild(OverTimeCategory()); 682 676 vcg->addChild(CategoryOverTime()); 683 677 return vcg; 684 678 } 685 679 680 681 static HostComboBox *OverTimePriority() 682 { 683 HostComboBox *gc = new HostComboBox("OverTimePriority"); 684 gc->setLabel(QObject::tr("Apply OverTime buffers")); 685 gc->addSelection(QObject::tr("Unless conflict, tuner, or reschedule req'd"), "0"); 686 gc->addSelection(QObject::tr("Unless conflict or extra tuner req'd"), "1"); 687 gc->addSelection(QObject::tr("Unless conflict"), "2"); 688 gc->addSelection(QObject::tr("Always (may create conflicts)"), "3"); 689 gc->setHelpText(QObject::tr("When to record the OverTime buffer " 690 "specified above. If desired, " 691 "MythTV can assign recordings to an idle " 692 "tuner card, record an earlier/later showing, " 693 "or even cause a conflict " 694 "when necessary to honor the OverTime " 695 "settings.")); 696 return gc; 697 } 698 686 699 static HostCheckBox *PlayBoxOrdering() 687 700 { 688 701 HostCheckBox *gc = new HostCheckBox("PlayBoxOrdering"); … … 3557 3570 jobs->addChild(AutoRunUserJob(i)); 3558 3571 addChild(jobs); 3559 3572 3573 VerticalConfigurationGroup* overtime = new VerticalConfigurationGroup(false); 3574 overtime->setLabel(QObject::tr("General (OverTime Buffer)")); 3575 overtime->addChild(RecordPreRoll()); 3576 overtime->addChild(RecordOverTime()); 3577 overtime->addChild(OverTimePriority()); 3578 overtime->addChild(CategoryOverTimeSettings()); 3579 addChild(overtime); 3580 3560 3581 VerticalConfigurationGroup* general2 = new VerticalConfigurationGroup(false); 3561 3582 general2->setLabel(QObject::tr("General (Advanced)")); 3562 general2->addChild(RecordPreRoll());3563 general2->addChild(RecordOverTime());3564 general2->addChild(CategoryOverTimeSettings());3565 3583 general2->addChild(ATSCCheckSignalThreshold()); 3566 3584 general2->addChild(ATSCCheckSignalWait()); 3567 3585 general2->addChild(HDRingbufferSize()); -
programs/mythfrontend/main.cpp
392 392 { 393 393 GeneralSettings settings; 394 394 settings.exec(); 395 396 // Required if user altered OverTime settings 397 ScheduledRecording::signalChange(0); 395 398 } 396 399 else if (sel == "settings maingeneral") 397 400 {