Ticket #171: mythtv.autoexpire.priority.2.diff
File mythtv.autoexpire.priority.2.diff, 7.6 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/scheduledrecording.h
84 84 85 85 void setStart(const QDateTime& start); 86 86 void setEnd(const QDateTime& end); 87 int getRecPriority(void) const; 87 88 void setRecPriority(int recpriority); 88 89 void setRecGroup(const QString& recgroup); 89 90 -
libs/libmythtv/dbcheck.cpp
10 10 #include "mythdbcon.h" 11 11 12 12 /// This is the DB schema version expected by the running MythTV instance. 13 const QString currentDatabaseVersion = "10 89";13 const QString currentDatabaseVersion = "1090"; 14 14 15 15 static bool UpdateDBVersionNumber(const QString &newnumber); 16 16 static bool performActualUpdate(const QString updates[], QString version, … … 1977 1977 return false; 1978 1978 } 1979 1979 1980 if (dbver == "1089") 1981 { 1982 const QString updates[] = { 1983 "ALTER TABLE recorded ADD COLUMN recpriority INT NOT NULL DEFAULT 0;", 1984 "" 1985 }; 1986 1987 if (!performActualUpdate(updates, "1090", dbver)) 1988 return false; 1989 1990 MSqlQuery recordids(MSqlQuery::InitCon()); 1991 recordids.prepare("SELECT recordid,recpriority FROM record;"); 1992 if (recordids.exec() && recordids.isActive() && recordids.size() > 0) 1993 { 1994 MSqlQuery update(MSqlQuery::InitCon()); 1995 while (recordids.next()) 1996 { 1997 update.prepare(QString( 1998 "UPDATE recorded SET recpriority = %1 WHERE recordid = %2;") 1999 .arg(recordids.value(1).toInt()) 2000 .arg(recordids.value(0).toInt())); 2001 update.exec(); 2002 } 2003 } 2004 } 2005 1980 2006 // Drop xvmc_buffer_settings at some point 1981 2007 // Drop dead DVB tables eventually, too 1982 2008 … … 2466 2492 return true; 2467 2493 } 2468 2494 2495 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmythtv/programinfo.cpp
704 704 "channel.callsign,channel.name,channel.commfree, " 705 705 "channel.outputfilters,seriesid,programid,filesize, " 706 706 "lastmodified,stars,previouslyshown,originalairdate, " 707 "hostname,recordid,transcoder,timestretch " 707 "hostname,recordid,transcoder,timestretch, " 708 "recorded.recpriority " 708 709 "FROM recorded " 709 710 "LEFT JOIN channel " 710 711 "ON recorded.chanid = channel.chanid " … … 765 766 proginfo->programflags = proginfo->getProgramFlags(); 766 767 767 768 proginfo->timestretch = query.value(21).toString().toFloat(); 769 proginfo->recpriority = query.value(22).toInt(); 768 770 769 771 return proginfo; 770 772 } … … 1228 1230 " subtitle,description,hostname,category,recgroup," 1229 1231 " autoexpire,recordid,seriesid,programid,stars," 1230 1232 " previouslyshown,originalairdate,findid,transcoder," 1231 " timestretch )"1233 " timestretch,recpriority)" 1232 1234 " VALUES(:CHANID,:STARTS,:ENDS,:TITLE,:SUBTITLE,:DESC," 1233 1235 " :HOSTNAME,:CATEGORY,:RECGROUP,:AUTOEXP,:RECORDID," 1234 1236 " :SERIESID,:PROGRAMID,:STARS,:REPEAT,:ORIGAIRDATE," 1235 " :FINDID,:TRANSCODER,:TIMESTRETCH );");1237 " :FINDID,:TRANSCODER,:TIMESTRETCH,:RECPRIORITY);"); 1236 1238 query.bindValue(":CHANID", chanid); 1237 1239 query.bindValue(":STARTS", starts); 1238 1240 query.bindValue(":ENDS", ends); … … 1252 1254 query.bindValue(":ORIGAIRDATE", originalAirDate); 1253 1255 query.bindValue(":TRANSCODER", record->GetTranscoder()); 1254 1256 query.bindValue(":TIMESTRETCH", timestretch); 1257 query.bindValue(":RECPRIORITY", record->getRecPriority()); 1255 1258 1256 1259 if (!query.exec() || !query.isActive()) 1257 1260 MythContext::DBError("WriteRecordedToDB", query); … … 3525 3528 else 3526 3529 return 0; 3527 3530 } 3531 3532 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmythtv/scheduledrecording.cpp
608 609 endDate->setValue(end.date()); 609 610 } 610 611 612 int ScheduledRecording::getRecPriority(void) const { 613 return recpriority->getValue().toInt(); 614 } 615 611 616 void ScheduledRecording::setRecPriority(int newrecpriority) { 612 617 recpriority->setValue(newrecpriority); 613 618 } … … 774 779 recgroup->setChanged(); 775 780 } 776 781 777 778 779 782 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
programs/mythfrontend/globalsettings.cpp
514 514 bc->setLabel(QObject::tr("Auto Expire Method")); 515 515 bc->addSelection(QObject::tr("None"), "0"); 516 516 bc->addSelection(QObject::tr("Oldest Show First"), "1"); 517 bc->addSelection(QObject::tr("Lowest Priority First"), "2"); 517 518 bc->setHelpText(QObject::tr("Method used to determine which recorded " 518 519 "shows to delete first. Set to 'None' to " 519 520 "disable Auto Expire (not recommended).")); -
programs/mythbackend/autoexpire.cpp
467 467 468 468 switch(expMethod) 469 469 { 470 case 1: FillOldestFirst(); break; 470 case 1: 471 case 2: 472 FillOldestFirst(expMethod); 473 break; 471 474 472 475 // default falls through so list is empty so no AutoExpire 473 476 } … … 512 515 /** \fn AutoExpire::FillOldestFirst() 513 516 * \brief Creates a list of programs to delete, with the oldest file listed first. 514 517 */ 515 void AutoExpire::FillOldestFirst( void)518 void AutoExpire::FillOldestFirst(int expMethod) 516 519 { 517 520 QString fileprefix = gContext->GetFilePrefix(); 518 521 522 QString orderby; 523 524 switch (expMethod) 525 { 526 default: 527 case 1: // Oldest first 528 orderby = "starttime ASC"; 529 break; 530 531 case 2: // Lowest priority first 532 orderby = "recorded.recpriority ASC, starttime ASC"; 533 break; 534 } 535 519 536 MSqlQuery query(MSqlQuery::InitCon()); 520 537 QString querystr = QString( 521 538 "SELECT recorded.chanid,starttime,endtime,title,subtitle, " … … 523 540 "FROM recorded " 524 541 "LEFT JOIN channel ON recorded.chanid = channel.chanid " 525 542 "WHERE autoexpire > 0 " 526 "ORDER BY autoexpire DESC, starttime ASC"); 527 543 "ORDER BY autoexpire DESC, %1") 544 .arg(orderby); 545 528 546 query.prepare(querystr); 529 547 530 548 if (!query.exec() || !query.isActive() || !query.size()) -
programs/mythbackend/autoexpire.h
34 34 private: 35 35 void ExpireEpisodesOverMax(void); 36 36 37 void FillOldestFirst( void);37 void FillOldestFirst(int expMethod); 38 38 void SendDeleteMessages(size_t, size_t); 39 39 void ClearExpireList(void); 40 40 void Sleep();