Undelete support for cRecordings
Commit Message
Hi there,
I improved extrec-plugin with undelete functionality.
The origin undelete seem so slow and overfeatured.
@ KLS could implenent this little API enhancement to vdr-core?
Thanks
there is also set default copy constr to private for save.
regards Markus
Gemeinsame Unterverzeichnisse: vdr-1.5.9/libsi und vdr-1.5.9.1/libsi.
Gemeinsame Unterverzeichnisse: vdr-1.5.9/PLUGINS und vdr-1.5.9.1/PLUGINS.
Gemeinsame Unterverzeichnisse: vdr-1.5.9/po und vdr-1.5.9.1/po.
@@ -783,6 +783,34 @@
return true;
}
+bool cRecording::Undelete(void)
+{
+ printf ("\033[0;41m %s \033[0m\n", __PRETTY_FUNCTION__);
+ bool result = true;
+ char *NewName = strdup(FileName());
+ char *ext = strrchr(NewName, '.');
+ if (ext && strcmp(ext, DELEXT) == 0) {
+ strncpy(ext, RECEXT, strlen(ext));
+ printf ("\033[0;44m new FileName [%s] ... \nold FileName [%s] \033[0m\n", NewName, FileName());
+ if (access(NewName, F_OK) == 0) {
+ // the new name already exists, so let's remove that one first:
+ esyslog("undelete recording '%s'", NewName);
+ //Rename(NewName);
+ }
+ else { //
+ isyslog("undeleting recording '%s'", FileName());
+ if (access(FileName(), F_OK) == 0)
+ result = RenameVideoFile(FileName(), NewName);
+ else {
+ isyslog("recording '%s' vanished", FileName());
+ result = false; // well, we were going to delete it, anyway
+ }
+ }
+ }
+ free(NewName);
+ return result;
+}
+
bool cRecording::Delete(void)
{
bool result = true;
@@ -75,6 +75,7 @@
static char *StripEpisodeName(char *s);
char *SortName(void) const;
int GetResume(void) const;
+ cRecording(const cRecording& obj);
public:
time_t start;
int priority;
@@ -100,6 +101,10 @@
bool Remove(void);
// Actually removes the file from the disk
// Returns false in case of error
+ bool Undelete(void);
+ // Changes the file name so that it will be visible in the "Recordings" menu again and
+ // not catched by cRemoveDeletedRecordingsThread.
+ // Returns false in case of error
};
class cRecordings : public cList<cRecording>, public cThread {
Gemeinsame Unterverzeichnisse: vdr-1.5.9/symbols und vdr-1.5.9.1/symbols.