Ticket #2544: mythtv-cleanup_program_listings_through_housekeeper-post_11619.patch

File mythtv-cleanup_program_listings_through_housekeeper-post_11619.patch, 1.8 KB (added by sphery <mtdean@…>, 15 years ago)
  • programs/mythbackend/housekeeper.h

     
    3535    void CleanupMyOldRecordings(void);
    3636    void CleanupAllOldInUsePrograms(void);
    3737    void CleanupRecordedTables(void);
     38    void CleanupProgramListings(void);
    3839    bool threadrunning;
    3940    bool filldbRunning;
    4041    bool isMaster;
  • programs/mythbackend/housekeeper.cpp

     
    1818#include "libmyth/mythdbcon.h"
    1919#include "libmyth/util.h"
    2020
     21#include "programdata.h"
     22
    2123static bool HouseKeeper_filldb_running = false;
    2224
    2325HouseKeeper::HouseKeeper(bool runthread, bool master)
     
    225227                JobQueue::CleanupOldJobsInQueue();
    226228                CleanupAllOldInUsePrograms();
    227229                CleanupRecordedTables();
     230                CleanupProgramListings();
    228231                updateLastrun("DailyCleanup");
    229232            }
    230233        }
     
    368371    }
    369372}
    370373
     374void HouseKeeper::CleanupProgramListings(void)
     375{
     376    if (!gContext->GetNumSetting("MythFillEnabled", 0))
     377    {
     378        ProgramData *prog_data = new ProgramData;
     379        // Keep 7 days of old listings.  Users wanting listings deleted
     380        // "immediately" may set up mythfilldatabase to run without
     381        // the "--no-delete" argument
     382        prog_data->no_delete = true;
     383        prog_data->clearOldDBEntries();
     384        delete prog_data;
     385    }
     386}
     387
    371388void *HouseKeeper::doHouseKeepingThread(void *param)
    372389{
    373390    HouseKeeper *hkeeper = (HouseKeeper*)param;