Ticket #2544: mythtv-cleanup_program_listings_through_housekeeper-after_rec_rules.patch
| File mythtv-cleanup_program_listings_through_housekeeper-after_rec_rules.patch, 7.3 KB (added by , 19 years ago) |
|---|
-
programs/mythbackend/housekeeper.h
19 19 20 20 21 21 protected: 22 typedef struct mfdstruct 23 { 24 HouseKeeper *keep; 25 QString mfpath; 26 QString mfarg; 27 QString mflog; 28 } MFDStruct; 29 22 30 void RunHouseKeeping(void); 23 31 static void *doHouseKeepingThread(void *param); 24 32 25 void RunMFD( void);33 void RunMFD(const MFDStruct *mfds); 26 34 static void *runMFDThread(void *param); 27 35 28 36 private: … … 31 39 void updateLastrun(const QString &dbTag); 32 40 QDateTime getLastRun(const QString &dbTag); 33 41 void flushLogs(); 34 void runFillDatabase( );42 void runFillDatabase(MFDStruct *mfds); 35 43 void CleanupMyOldRecordings(void); 36 44 void CleanupAllOldInUsePrograms(void); 37 45 void CleanupRecordedTables(void); 38 46 void CleanupExpiredRecordingRules(void); 39 47 void CleanupOldrecordedTable(void); 48 void CleanupProgramListings(void); 40 49 bool threadrunning; 41 50 bool filldbRunning; 42 51 bool isMaster; -
programs/mythbackend/housekeeper.cpp
215 215 QString msg = "Running mythfilldatabase"; 216 216 gContext->LogEntry("mythbackend", LP_DEBUG, msg, ""); 217 217 VERBOSE(VB_GENERAL, msg); 218 runFillDatabase(); 218 219 MFDStruct *mfds = new MFDStruct; 220 221 mfds->mfpath = gContext->GetSetting( 222 "MythFillDatabasePath", 223 "mythfilldatabase"); 224 mfds->mfarg = gContext->GetSetting( 225 "MythFillDatabaseArgs", ""); 226 mfds->mflog = gContext->GetSetting( 227 "MythFillDatabaseLog", 228 "/var/log/mythfilldatabase.log"); 229 230 runFillDatabase(mfds); 219 231 updateLastrun("MythFillDB"); 220 232 } 221 233 } … … 225 237 JobQueue::CleanupOldJobsInQueue(); 226 238 CleanupAllOldInUsePrograms(); 227 239 CleanupRecordedTables(); 228 240 CleanupExpiredRecordingRules(); 229 241 CleanupOldrecordedTable(); 242 CleanupProgramListings(); 230 243 updateLastrun("DailyCleanup"); 231 244 } 232 245 } … … 266 279 267 280 void *HouseKeeper::runMFDThread(void *param) 268 281 { 269 HouseKeeper *keep = (HouseKeeper *)param; 270 keep->RunMFD(); 282 MFDStruct *mfds = (MFDStruct *)param; 283 284 HouseKeeper *keep = mfds->keep; 285 keep->RunMFD(mfds); 286 287 delete mfds; 288 271 289 return NULL; 272 290 } 273 291 274 void HouseKeeper::RunMFD( void)292 void HouseKeeper::RunMFD(const MFDStruct *mfds) 275 293 { 276 294 QString command; 277 295 278 QString mfpath = gContext->GetSetting("MythFillDatabasePath", 279 "mythfilldatabase"); 280 QString mfarg = gContext->GetSetting("MythFillDatabaseArgs", ""); 281 QString mflog = gContext->GetSetting("MythFillDatabaseLog", 282 "/var/log/mythfilldatabase.log"); 296 QString mfpath = mfds->mfpath; 297 if (mfpath == "mythfilldatabase") 298 mfpath = gContext->GetInstallPrefix() + "/bin/mythfilldatabase"; 283 299 300 QString mfarg = mfds->mfarg; 301 QString mflog = mfds->mflog; 302 284 303 if (mflog == "") 285 304 command = QString("%1 %2").arg(mfpath).arg(mfarg); 286 305 else … … 292 311 HouseKeeper_filldb_running = false; 293 312 } 294 313 295 void HouseKeeper::runFillDatabase( )314 void HouseKeeper::runFillDatabase(MFDStruct *mfds) 296 315 { 297 316 if (HouseKeeper_filldb_running) 298 317 return; … … 300 319 HouseKeeper_filldb_running = true; 301 320 302 321 pthread_t housekeep_thread; 303 pthread_create(&housekeep_thread, NULL, runMFDThread, this);322 pthread_create(&housekeep_thread, NULL, runMFDThread, mfds); 304 323 pthread_detach(housekeep_thread); 305 324 } 306 325 … … 368 387 query.exec(); 369 388 } 370 389 390 void HouseKeeper::CleanupProgramListings(void) 391 { 392 if (!gContext->GetNumSetting("MythFillEnabled", 0)) 393 { 394 MFDStruct *mfds = new MFDStruct; 395 396 mfds->mfpath = "mythfilldatabase"; 397 mfds->mfarg = "--do-cleanup-only --no-delete"; 398 mfds->mflog = gContext->GetSetting("MythFillDatabaseLog", 399 "/var/log/mythfilldatabase.log"); 400 401 runFillDatabase(mfds); 402 } 403 } 404 371 405 void *HouseKeeper::doHouseKeepingThread(void *param) 372 406 { 373 407 HouseKeeper *hkeeper = (HouseKeeper*)param; -
programs/mythfilldatabase/filldata.cpp
62 62 bool dd_grab_all = false; 63 63 bool dddataretrieved = false; 64 64 bool mark_repeats = true; 65 bool do_cleanup_only = false; 65 66 bool channel_updates = false; 66 67 bool channel_update_run = false; 67 68 bool remove_new_channels = false; … … 3591 3592 { 3592 3593 mark_repeats = false; 3593 3594 } 3595 else if (!strcmp(a.argv()[argpos], "--do-cleanup-only")) 3596 { 3597 do_cleanup_only = true; 3598 grab_data = false; 3599 mark_repeats = false; 3600 } 3594 3601 else if (!strcmp(a.argv()[argpos], "--export-icon-map")) 3595 3602 { 3596 3603 export_iconmap = true; … … 3746 3753 cout << "--reset-icon-map [all]\n"; 3747 3754 cout << " Resets your icon map (pass all to reset channel icons as well)\n"; 3748 3755 cout << "\n"; 3756 #if 0 3757 cout << "--do-cleanup-only\n"; 3758 cout << " Cleans old program listings from the database.\n"; 3759 cout << "\n"; 3760 #endif 3749 3761 cout << "--mark-repeats\n"; 3750 3762 cout << " Marks any programs with a OriginalAirDate earlier\n"; 3751 3763 cout << " than their start date as a repeat\n"; … … 3987 3999 QString(" Found %1").arg(query.numRowsAffected())); 3988 4000 } 3989 4001 4002 if (do_cleanup_only) 4003 { 4004 clearOldDBEntries(); 4005 } 4006 3990 4007 if (mark_repeats) 3991 4008 { 3992 4009 VERBOSE(VB_GENERAL, "Marking repeats."); -
programs/mythfrontend/globalsettings.cpp
2919 2919 static GlobalLineEdit *MythFillDatabasePath() 2920 2920 { 2921 2921 GlobalLineEdit *be = new GlobalLineEdit("MythFillDatabasePath"); 2922 be->setLabel(QObject::tr("mythfilldatabase Path")); 2923 be->setValue(gContext->GetInstallPrefix() + "/bin/mythfilldatabase"); 2924 be->setHelpText(QObject::tr("Path (including executable) of the " 2925 "mythfilldatabase program.")); 2922 be->setLabel(QObject::tr("mythfilldatabase Program")); 2923 be->setValue("mythfilldatabase"); 2924 be->setHelpText(QObject::tr("Use 'mythfilldatabase' or the name of a " 2925 "custom script that will populate the program guide info " 2926 "for you.")); 2926 2927 return be; 2927 2928 } 2928 2929
