[mythtv] FIX "do not autoexpire" Flag made persistent

Marcel Meier linux at meiersos.ch
Mon Oct 4 17:57:18 UTC 2004


for the ones who need it I have made this Patch to prevent recordings with the Flag "do not autoexpire" 
to also not being deleted when they are the oldest recording in a "don't record if this would exceed the max episode" task.
The recordings which have the "do not expire" Flag are also not counted as one of the episodes.

For example:
Max episodes set to 5
2 flagged as "do not expire"
Maximal 7 episodes in this group

Now I need a little help for the other way around "don't record when max":
I think I found the checking routine but my changes seems not to work, maybe someone could help
me or lead me to find the right place.

Thanks in advance for all your help.


I made changes to the following function:  "ProgramInfo::AllowRecordingNewEpisodes" in the "libmythtv" directory
1) read not count but autoexpire flag for the recorded episodes
    /*query.prepare("SELECT count(*) FROM recorded WHERE title = :TITLE;");      original line*/
    query.prepare("SELECT autoexpire FROM recorded WHERE title = :TITLE;");

2) counting all recordings which have a value greater 0 in the autoexpire field (0 means "not autoexipre" to my knowledge)
/* my modification  */
        int found = 0;
        while(query.next()) {
            if (query.value(0).toInt() > 0)
            if (found >= maxEpisodes)
                return false;
/* original lines */

        if (query.value(0).toInt() >= maxEpisodes)
            return false;

here the Diff for the "don't record if this would exceed the max episode" part :

Index: programs/mythbackend/autoexpire.cpp
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/autoexpire.cpp,v
retrieving revision 1.15
diff -u -d -r1.15 autoexpire.cpp
--- programs/mythbackend/autoexpire.cpp 2 Sep 2004 06:07:22 -0000 1.15
+++ programs/mythbackend/autoexpire.cpp 4 Oct 2004 12:24:30 -0000
@@ -160,9 +160,9 @@
         sqltitle.replace(QRegExp("\'"), "\\'");
         sqltitle.replace(QRegExp("\""), "\\\"");
-        querystr = QString( "SELECT chanid, starttime FROM recorded "
+        querystr = QString( "SELECT chanid, starttime, autoexpire FROM recorded "
                             "WHERE title = \"%1\" "
-                            "ORDER BY starttime DESC;")
+                            "ORDER BY autoexpire ASC, starttime DESC")
         query = db->exec(querystr);
@@ -171,7 +171,8 @@
             int found = 0;
             while (query.next()) {
-                found++;
+                if (query.value(2).toInt() > 0)
+                    found++;
                 if (found > maxIter.data())

More information about the mythtv-dev mailing list