Ticket #1008: time-pri-expire.diff

File time-pri-expire.diff, 3.7 KB (added by willu.mailingLists@…, 15 years ago)

The patch implementing time/priority autoexpire

  • programs/mythfrontend/globalsettings.cpp

     
    522522    bc->setLabel(QObject::tr("Auto Expire Method"));
    523523    bc->addSelection(QObject::tr("Oldest Show First"), "1");
    524524    bc->addSelection(QObject::tr("Lowest Priority First"), "2");
     525    bc->addSelection(QObject::tr("Time/Priority Tradeoff"), "3");
    525526    bc->setHelpText(QObject::tr("Method used to determine which recorded "
    526527                                "shows to delete first.  LiveTV recordings "
    527528                                "will always expire before normal "
     
    530531    return bc;
    531532}
    532533
     534static GlobalSpinBox *AutoExpireDayPriority()
     535{
     536    GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);
     537    bs->setLabel(QObject::tr("Auto Expire Priority Weight"));
     538    bs->setHelpText(QObject::tr(
     539                        "The number of days bonus a program "
     540                        "gets for each priority point. "
     541                        "This is only used when Time/Priority tradeoff "
     542                        "is selected for the auto expire method."));
     543    bs->setValue(3);
     544    return bs;
     545};
     546
    533547static GlobalCheckBox *AutoExpireDefault()
    534548{
    535549    GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");
     
    31483162    general->addChild(SmartChannelChange());
    31493163    general->addChild(LastFreeCard());
    31503164    general->addChild(AutoExpireMethod());
     3165    general->addChild(AutoExpireDayPriority());
    31513166    general->addChild(AutoExpireDefault());
    31523167    general->addChild(AutoExpireLiveTVMaxAge());
    31533168    addChild(general);
  • programs/mythbackend/autoexpire.cpp

     
    590590    {
    591591        case emOldestFirst:
    592592        case emLowestPriorityFirst:
     593        case emTimePriorityTradeoff:
    593594                FillDBOrdered(expMethod);
    594595                break;
    595596        // default falls through so list is empty so no AutoExpire
     
    677678            where = "autoexpire > 0";
    678679            orderby = "recorded.recpriority ASC, starttime ASC";
    679680            break;
     681        case emTimePriorityTradeoff:
     682            where = "autoexpire > 0";
     683            orderby = QString("DATE_ADD(starttime, INTERVAL '%1' * recorded.recpriority DAY) ASC")
     684                    .arg(gContext->GetNumSetting("AutoExpireDayPriority", 3));
     685            break;
    680686        case emShortLiveTVPrograms:
    681687            where = "recgroup = 'LiveTV' "
    682688                    "AND endtime < DATE_ADD(starttime, INTERVAL '2' MINUTE) "
     
    703709               "       title,           subtitle,    description, "
    704710               "       hostname,        channum,     name,        "
    705711               "       callsign,        seriesid,    programid,   "
    706                "       recorded.        recpriority, progstart, "
     712               "       recorded.recpriority,        progstart, "
    707713               "       progend,         filesize "
    708714               "FROM recorded "
    709715               "LEFT JOIN channel ON recorded.chanid = channel.chanid "
  • programs/mythbackend/autoexpire.h

     
    2121enum ExpireMethodType {
    2222    emOldestFirst          = 1,
    2323    emLowestPriorityFirst  = 2,
     24    emTimePriorityTradeoff = 3,
    2425    emShortLiveTVPrograms  = 10000,
    2526    emNormalLiveTVPrograms = 10001
    2627};