mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added cRecording::Undelete()
This commit is contained in:
parent
c6ef96a6ae
commit
7780e3664a
@ -1966,6 +1966,7 @@ Markus Hahn <mhahn@reel-multimedia.com>
|
|||||||
while editing a string item
|
while editing a string item
|
||||||
for fixing detection of Premiere NVOD channel links
|
for fixing detection of Premiere NVOD channel links
|
||||||
for making the default copy ctor of cRecording private
|
for making the default copy ctor of cRecording private
|
||||||
|
for a patch that was used to implement cRecording::Undelete()
|
||||||
|
|
||||||
Jaroslaw Swierczynski <swiergot@gmail.com>
|
Jaroslaw Swierczynski <swiergot@gmail.com>
|
||||||
for updating the Polish OSD texts and the fontosd-iso8859-2.c file
|
for updating the Polish OSD texts and the fontosd-iso8859-2.c file
|
||||||
|
1
HISTORY
1
HISTORY
@ -5483,3 +5483,4 @@ Video Disk Recorder Revision History
|
|||||||
(suggested by Thomas Günther).
|
(suggested by Thomas Günther).
|
||||||
- Made the default copy ctor of cRecording private (thanks to Markus Hahn).
|
- Made the default copy ctor of cRecording private (thanks to Markus Hahn).
|
||||||
Same for the assign operator.
|
Same for the assign operator.
|
||||||
|
- Added cRecording::Undelete() (based on a patch from Markus Hahn).
|
||||||
|
28
recording.c
28
recording.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recording.c 1.155 2007/10/12 14:48:20 kls Exp $
|
* $Id: recording.c 1.156 2007/10/14 10:21:54 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -829,6 +829,32 @@ bool cRecording::Remove(void)
|
|||||||
return RemoveVideoFile(FileName());
|
return RemoveVideoFile(FileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cRecording::Undelete(void)
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
char *NewName = strdup(FileName());
|
||||||
|
char *ext = strrchr(NewName, '.');
|
||||||
|
if (ext && strcmp(ext, DELEXT) == 0) {
|
||||||
|
strncpy(ext, RECEXT, strlen(ext));
|
||||||
|
if (access(NewName, F_OK) == 0) {
|
||||||
|
// the new name already exists, so let's not remove that one:
|
||||||
|
esyslog("ERROR: attempt to undelete '%s', while recording '%s' exists", FileName(), NewName);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
isyslog("undeleting recording '%s'", FileName());
|
||||||
|
if (access(FileName(), F_OK) == 0)
|
||||||
|
result = RenameVideoFile(FileName(), NewName);
|
||||||
|
else {
|
||||||
|
isyslog("deleted recording '%s' vanished", FileName());
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(NewName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void cRecording::ResetResume(void) const
|
void cRecording::ResetResume(void) const
|
||||||
{
|
{
|
||||||
resume = RESUME_NOT_INITIALIZED;
|
resume = RESUME_NOT_INITIALIZED;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recording.h 1.58 2007/10/14 10:06:48 kls Exp $
|
* $Id: recording.h 1.59 2007/10/14 10:11:34 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RECORDING_H
|
#ifndef __RECORDING_H
|
||||||
@ -102,6 +102,10 @@ public:
|
|||||||
bool Remove(void);
|
bool Remove(void);
|
||||||
// Actually removes the file from the disk
|
// Actually removes the file from the disk
|
||||||
// Returns false in case of error
|
// 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 processed by cRemoveDeletedRecordingsThread.
|
||||||
|
// Returns false in case of error
|
||||||
};
|
};
|
||||||
|
|
||||||
class cRecordings : public cList<cRecording>, public cThread {
|
class cRecordings : public cList<cRecording>, public cThread {
|
||||||
|
Loading…
Reference in New Issue
Block a user