[mythtv] [PATCH] delete old recordings after transcode

Geoffrey Hausheer ou401cru02 at sneakemail.com
Sat Sep 20 09:44:30 EDT 2003


Here's a patch to enable deleting old programs after transcoding.  It
adds a switch in 'setup' that lets you override the default behaviour and
keep the old programs (useful if you want to save both the mpeg2 and
mpeg4 versions)

.Geoff

Index: programs/mythbackend/transcoder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/transcoder.cpp,v
retrieving revision 1.11
diff -u -r1.11 transcoder.cpp
--- programs/mythbackend/transcoder.cpp 17 Sep 2003 18:50:38 -0000     
1.11
+++ programs/mythbackend/transcoder.cpp 20 Sep 2003 13:33:56 -0000
@@ -276,8 +276,9 @@
                     QString oldfile = filename;
                     oldfile += ".old";
                     rename (filename, oldfile);
-                    // unlink(filename);
                     rename (tmpfile, filename);
+                    if (! gContext->GetNumSetting("SaveTranscoding", 0))
+                        unlink(filename);
                     DeleteTranscode(pinfo);
                     if (flags & TRANSCODE_USE_CUTLIST)
                     {
Index: setup/backendsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/setup/backendsettings.cpp,v
retrieving revision 1.22
diff -u -r1.22 backendsettings.cpp
--- setup/backendsettings.cpp   18 Sep 2003 21:34:24 -0000      1.22
+++ setup/backendsettings.cpp   20 Sep 2003 13:33:57 -0000
@@ -200,6 +200,19 @@
     };
 };

+class SaveTranscoding: public CheckBoxSetting, public BackendSetting {
+public:
+    SaveTranscoding():
+         BackendSetting("SaveTranscoding") {
+         setLabel("Save original files after transcoding");
+         setValue(0);
+         setHelpText("When set and the transcoder is active, the
original "
+                     "nuv files will be renamed to nuv.old once the "
+                     "transcoding is complete."
+                 );
+         };
+};
 class TimeOffset: public ComboBoxSetting, public BackendSetting {
 public:
     TimeOffset():
@@ -290,6 +303,7 @@
     group1->addChild(new LiveBufferPrefix());
     group1->addChild(new BufferSize());
     group1->addChild(new MaxBufferFill());
+    group1->addChild(new SaveTranscoding());
     addChild(group1);

     VerticalConfigurationGroup* group2 = new
     VerticalConfigurationGroup(false);


More information about the mythtv-dev mailing list