Ticket #5251: watch-weight-expire.diff

File watch-weight-expire.diff, 3.8 KB (added by Nick French <naf@…>, 16 years ago)

Patch adding watched status as autoexpire weight

  • programs/mythfrontend/globalsettings.cpp

     
    669669    bc->setLabel(QObject::tr("Auto Expire Method"));
    670670    bc->addSelection(QObject::tr("Oldest Show First"), "1");
    671671    bc->addSelection(QObject::tr("Lowest Priority First"), "2");
    672     bc->addSelection(QObject::tr("Weighted Time/Priority Combination"), "3");
     672    bc->addSelection(QObject::tr("Weighted Time/Priority/Watched Combination"),
     673                     "3");
    673674    bc->setHelpText(QObject::tr("Method used to determine which recorded "
    674675                    "shows to delete first.  LiveTV recordings will always "
    675676                    "expire before normal recordings."));
     
    684685    bc->setValue(false);
    685686    bc->setHelpText(QObject::tr("If set, programs that have been marked as "
    686687                    "watched will be expired before programs that have not "
    687                     "been watched."));
     688                    "been watched. Does not apply to Weighted "
     689                    "Time/Priority/Watched Auto Expire Method "
     690                    "(use Watched Weight instead)."));
    688691    return bc;
    689692}
    690693
     
    694697    bs->setLabel(QObject::tr("Priority Weight"));
    695698    bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
    696699                    "each priority point. This is only used when the Weighted "
    697                     "Time/Priority Auto Expire Method is selected."));
     700                    "Time/Priority/Watched Auto Expire Method is selected."));
    698701    bs->setValue(3);
    699702    return bs;
    700703};
    701704
     705static GlobalSpinBox *AutoExpireWatchedWeight()
     706{
     707    GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireWatchedWeight", 1, 400, 1);
     708    bs->setLabel(QObject::tr("Watched Weight"));
     709    bs->setHelpText(QObject::tr("The number of days fewer a program gets when "
     710                    "it is marked as watched. This is only used when the "
     711                    "Weighted Time/Priority/Watched Auto Expire Method "
     712                    "is selected."));
     713    bs->setValue(14);
     714    return bs;
     715};
     716
     717
    702718static GlobalCheckBox *AutoExpireDefault()
    703719{
    704720    GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     
    47604776        new VerticalConfigurationGroup(false, false, true, true);
    47614777    expgrp1->addChild(AutoExpireLiveTVMaxAge());
    47624778    expgrp1->addChild(AutoExpireDayPriority());
     4779    expgrp1->addChild(AutoExpireWatchedWeight());
    47634780    expgrp1->addChild(AutoExpireExtraSpace());
    47644781
    47654782    HorizontalConfigurationGroup *expgrp =
  • programs/mythbackend/autoexpire.cpp

     
    869869        case emWeightedTimePriority:
    870870            msg = "Adding expirable programs in Weighted Time Priority order";
    871871            where = "autoexpire > 0";
    872             if (gContext->GetNumSetting("AutoExpireWatchedPriority", 0))
    873                 orderby = "recorded.watched DESC, ";
    874             orderby += QString("DATE_ADD(starttime, INTERVAL '%1' * "
    875                                         "recorded.recpriority DAY) ASC")
    876                       .arg(gContext->GetNumSetting("AutoExpireDayPriority", 3));
     872            orderby =
     873                QString("starttime"
     874                        " + INTERVAL '%1' * recorded.recpriority DAY"
     875                        " - INTERVAL '%2' * recorded.watched DAY"
     876                        " ASC")
     877                .arg(gContext->GetNumSetting("AutoExpireDayPriority", 3))
     878                .arg(gContext->GetNumSetting("AutoExpireWatchedWeight", 14));
    877879            break;
    878880        case emShortLiveTVPrograms:
    879881            msg = "Adding Short LiveTV programs in starttime order";