[mythtv] Proposed alternate behaviour for show delete
Kai Fritzowsky
mythtv-dev at blackhole.hadinet.de
Wed Mar 9 15:10:17 UTC 2005
On Wed, Mar 09, 2005 at 10:54:51AM +0100, Kristian Kalweit wrote:
> After watching a show the autoexpire counter should be incremented. So
> shows, which I already watched, have a higher chance to auto expire.
I like that one and I already have coded it for testing its usability.
To activate the attached code, one has to
INSERT INTO settings (value,data) VALUES('AutoAgeRecordings','1');
since it's not configurable in the frontend so far.
/Kai
-------------- next part --------------
diff -ru mythtv-0.17-orig/libs/libmythtv/NuppelVideoPlayer.cpp mythtv-0.17/libs/libmythtv/NuppelVideoPlayer.cpp
--- mythtv-0.17-orig/libs/libmythtv/NuppelVideoPlayer.cpp 2005-02-11 05:21:24.000000000 +0100
+++ mythtv-0.17/libs/libmythtv/NuppelVideoPlayer.cpp 2005-03-09 14:07:19.000000000 +0100
@@ -2226,6 +2226,17 @@
osd->SetSettingsText(QObject::tr("Position Saved"), 1);
}
+void NuppelVideoPlayer::AgeRecording() {
+ if (livetv)
+ return;
+ if (!m_db || !m_playbackinfo || !osd)
+ return;
+
+ QMutexLocker lockit(m_db->mutex());
+
+ m_playbackinfo->AgeRecording(m_db->db());
+}
+
void NuppelVideoPlayer::ClearBookmark(void)
{
if (livetv)
diff -ru mythtv-0.17-orig/libs/libmythtv/NuppelVideoPlayer.h mythtv-0.17/libs/libmythtv/NuppelVideoPlayer.h
--- mythtv-0.17-orig/libs/libmythtv/NuppelVideoPlayer.h 2005-02-04 01:44:37.000000000 +0100
+++ mythtv-0.17/libs/libmythtv/NuppelVideoPlayer.h 2005-03-09 14:02:16.979720752 +0100
@@ -137,6 +137,7 @@
void SetVideoFilters(QString &filters) { videoFilterList = filters; }
void SetWatchingRecording(bool mode);
+ void AgeRecording(void);
void SetBookmark(void);
void ClearBookmark(void);
long long GetBookmark(void);
diff -ru mythtv-0.17-orig/libs/libmythtv/programinfo.cpp mythtv-0.17/libs/libmythtv/programinfo.cpp
--- mythtv-0.17-orig/libs/libmythtv/programinfo.cpp 2005-02-09 22:35:13.000000000 +0100
+++ mythtv-0.17/libs/libmythtv/programinfo.cpp 2005-03-09 13:57:37.000000000 +0100
@@ -1074,6 +1074,23 @@
return filesize;
}
+void ProgramInfo::AgeRecording(QSqlDatabase *db) {
+ MythContext::KickDatabase(db);
+ MSqlQuery query(QString::null, db);
+
+ query.prepare("UPDATE recorded"
+ " SET autoexpire = autoexpire + 1"
+ " WHERE autoexpire > 0"
+ " AND chanid = :CHANID"
+ " AND starttime = :STARTTIME ;");
+ query.bindValue(":CHANID", chanid);
+ query.bindValue(":STARTTIME", recstartts.toString("yyyyMMddhhmm00"));
+
+ if (!query.exec() || !query.isActive())
+ MythContext::DBError("age recording",
+ query);
+}
+
void ProgramInfo::SetBookmark(long long pos, QSqlDatabase *db)
{
MythContext::KickDatabase(db);
diff -ru mythtv-0.17-orig/libs/libmythtv/programinfo.h mythtv-0.17/libs/libmythtv/programinfo.h
--- mythtv-0.17-orig/libs/libmythtv/programinfo.h 2005-02-07 00:14:54.000000000 +0100
+++ mythtv-0.17/libs/libmythtv/programinfo.h 2005-03-09 13:57:11.223202808 +0100
@@ -146,6 +146,7 @@
void SetFilesize(long long fsize, QSqlDatabase *db);
long long GetFilesize(QSqlDatabase *db);
+ void AgeRecording(QSqlDatabase *db);
void SetBookmark(long long pos, QSqlDatabase *db);
long long GetBookmark(QSqlDatabase *db);
bool IsEditing(QSqlDatabase *db);
diff -ru mythtv-0.17-orig/libs/libmythtv/tv_play.cpp mythtv-0.17/libs/libmythtv/tv_play.cpp
--- mythtv-0.17-orig/libs/libmythtv/tv_play.cpp 2005-02-09 21:27:48.000000000 +0100
+++ mythtv-0.17/libs/libmythtv/tv_play.cpp 2005-03-09 14:22:19.000000000 +0100
@@ -1445,6 +1445,8 @@
{
case 1:
nvp->SetBookmark();
+ if (gContext->GetNumSetting("AutoAgeRecordings") == 1)
+ nvp->AgeRecording();
wantsToQuit = true;
exitPlayer = true;
break;
@@ -1458,6 +1460,8 @@
requestDelete = true;
break;
default:
+ if (gContext->GetNumSetting("AutoAgeRecordings") == 1)
+ nvp->AgeRecording();
wantsToQuit = true;
exitPlayer = true;
break;
@@ -1744,6 +1748,8 @@
{
if (gContext->GetNumSetting("PlaybackExitPrompt") == 2)
nvp->SetBookmark();
+ if (gContext->GetNumSetting("AutoAgeRecordings") == 1)
+ nvp->AgeRecording();
exitPlayer = true;
wantsToQuit = true;
}
More information about the mythtv-dev
mailing list