Ticket #5251: watch-weight-expire_v2.diff

File watch-weight-expire_v2.diff, 4.0 KB (added by naf@…, 14 years ago)
  • mythtv/programs/mythfrontend/globalsettings.cpp

     
    961961    bc->setLabel(QObject::tr("Auto-Expire method"));
    962962    bc->addSelection(QObject::tr("Oldest show first"), "1");
    963963    bc->addSelection(QObject::tr("Lowest priority first"), "2");
    964     bc->addSelection(QObject::tr("Weighted time/priority combination"), "3");
     964    bc->addSelection(QObject::tr("Weighted time/priority/watched combination"),
     965                                 "3");
    965966    bc->setHelpText(QObject::tr("Method used to determine which recorded "
    966967                    "shows to delete first. Live TV recordings will always "
    967968                    "expire before normal recordings."));
     
    976977    bc->setValue(false);
    977978    bc->setHelpText(QObject::tr("If enabled, programs that have been marked as "
    978979                    "watched will be expired before programs that have not "
    979                     "been watched."));
     980                    "been watched. Does not apply to Weighted "
     981                    "time/priority/watched Auto-Expire method "
     982                    "(use watched weight instead)."));
     983
    980984    return bc;
    981985}
    982986
     
    986990    bs->setLabel(QObject::tr("Priority weight"));
    987991    bs->setHelpText(QObject::tr("The number of days bonus a program gets for "
    988992                    "each priority point. This is only used when the Weighted "
    989                     "time/priority Auto-Expire method is selected."));
     993                    "time/priority/watched Auto-Expire method is selected."));
    990994    bs->setValue(3);
    991995    return bs;
    992996};
    993997
     998static GlobalSpinBox *AutoExpireWatchedWeight()
     999{
     1000    GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireWatchedWeight", 1, 400, 1);
     1001    bs->setLabel(QObject::tr("Watched Weight"));
     1002    bs->setHelpText(QObject::tr("The number of days fewer a program gets when "
     1003                    "it is marked as watched. This is only used when the "
     1004                    "Weighted time/priority/watched Auto-Expire method "
     1005                    "is selected."));
     1006    bs->setValue(14);
     1007    return bs;
     1008};
     1009
    9941010static GlobalCheckBox *AutoExpireDefault()
    9951011{
    9961012    GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     
    42994315        new VerticalConfigurationGroup(false, false, true, true);
    43004316    expgrp1->addChild(AutoExpireLiveTVMaxAge());
    43014317    expgrp1->addChild(AutoExpireDayPriority());
     4318    expgrp1->addChild(AutoExpireWatchedWeight());
    43024319    expgrp1->addChild(AutoExpireExtraSpace());
    43034320
    43044321    HorizontalConfigurationGroup *expgrp =
  • mythtv/programs/mythbackend/autoexpire.cpp

     
    902902        case emWeightedTimePriority:
    903903            msg = "Adding programs expirable in Weighted Time Priority order";
    904904            where = "autoexpire > 0";
    905             if (gCoreContext->GetNumSetting("AutoExpireWatchedPriority", 0))
    906                 orderby = "recorded.watched DESC, ";
    907             orderby += QString("DATE_ADD(starttime, INTERVAL '%1' * "
    908                                         "recorded.recpriority DAY) ASC")
    909                       .arg(gCoreContext->GetNumSetting("AutoExpireDayPriority", 3));
     905            orderby =
     906                QString("starttime"
     907                        " + INTERVAL '%1' * recorded.recpriority DAY"
     908                        " - INTERVAL '%2' * recorded.watched DAY"
     909                        " ASC")
     910                .arg(gCoreContext->GetNumSetting("AutoExpireDayPriority", 3))
     911                .arg(gCoreContext->GetNumSetting("AutoExpireWatchedWeight",
     912                                                 14));
    910913            break;
    911914        case emShortLiveTVPrograms:
    912915            msg = "Adding Short LiveTV programs in starttime order";