1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling the '.update' file in case the video directory is not at the default location

This commit is contained in:
Klaus Schmidinger 2005-10-01 10:33:38 +02:00
parent 46a89d211b
commit 13f68c4787
4 changed files with 19 additions and 7 deletions

View File

@ -934,6 +934,8 @@ Jon Burgess <mplayer@jburgess.uklinux.net>
for pointing out a problem with NPTL ("Native Posix Thread Library") for pointing out a problem with NPTL ("Native Posix Thread Library")
for changing thread handling to make it work with NPTL ("Native Posix Thread Library") for changing thread handling to make it work with NPTL ("Native Posix Thread Library")
for fixing a memory leak in thread handling when using NPTL for fixing a memory leak in thread handling when using NPTL
for reporting a bug in handling the '.update' file in case the video directory is
not at the default location
Thomas Schmidt <thomas.schmidt@in.stud.tu-ilmenau.de> Thomas Schmidt <thomas.schmidt@in.stud.tu-ilmenau.de>
for reporting a crash when canceling a newly created timer for reporting a crash when canceling a newly created timer

View File

@ -3858,3 +3858,5 @@ Video Disk Recorder Revision History
exists (reported by Udo Richter). exists (reported by Udo Richter).
- Fixed an unjustified "Error while accessing recording!" after deleting a recording - Fixed an unjustified "Error while accessing recording!" after deleting a recording
from a subfolder. from a subfolder.
- Fixed handling the '.update' file in case the video directory is not at the default
location (reported by Jon Burgess).

View File

@ -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.119 2005/09/25 14:29:49 kls Exp $ * $Id: recording.c 1.120 2005/10/01 10:29:02 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -743,10 +743,11 @@ void cRecording::ResetResume(void) const
cRecordings Recordings; cRecordings Recordings;
char *cRecordings::updateFileName = NULL;
cRecordings::cRecordings(bool Deleted) cRecordings::cRecordings(bool Deleted)
:cThread("video directory scanner") :cThread("video directory scanner")
{ {
updateFileName = strdup(AddDirectory(VideoDirectory, ".update"));
deleted = Deleted; deleted = Deleted;
lastUpdate = 0; lastUpdate = 0;
state = 0; state = 0;
@ -755,7 +756,6 @@ cRecordings::cRecordings(bool Deleted)
cRecordings::~cRecordings() cRecordings::~cRecordings()
{ {
Cancel(3); Cancel(3);
free(updateFileName);
} }
void cRecordings::Action(void) void cRecordings::Action(void)
@ -763,6 +763,13 @@ void cRecordings::Action(void)
Refresh(); Refresh();
} }
const char *cRecordings::UpdateFileName(void)
{
if (!updateFileName)
updateFileName = strdup(AddDirectory(VideoDirectory, ".update"));
return updateFileName;
}
void cRecordings::Refresh(bool Foreground) void cRecordings::Refresh(bool Foreground)
{ {
lastUpdate = time(NULL); // doing this first to make sure we don't miss anything lastUpdate = time(NULL); // doing this first to make sure we don't miss anything
@ -825,13 +832,13 @@ bool cRecordings::StateChanged(int &State)
void cRecordings::TouchUpdate(void) void cRecordings::TouchUpdate(void)
{ {
TouchFile(updateFileName); TouchFile(UpdateFileName());
lastUpdate = time(NULL); // make sure we don't tigger ourselves lastUpdate = time(NULL); // make sure we don't tigger ourselves
} }
bool cRecordings::NeedsUpdate(void) bool cRecordings::NeedsUpdate(void)
{ {
return lastUpdate < LastModifiedTime(updateFileName); return lastUpdate < LastModifiedTime(UpdateFileName());
} }
bool cRecordings::Update(bool Wait) bool cRecordings::Update(bool Wait)

View File

@ -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.44 2005/09/25 14:30:13 kls Exp $ * $Id: recording.h 1.45 2005/10/01 10:24:41 kls Exp $
*/ */
#ifndef __RECORDING_H #ifndef __RECORDING_H
@ -93,10 +93,11 @@ public:
class cRecordings : public cList<cRecording>, public cThread { class cRecordings : public cList<cRecording>, public cThread {
private: private:
char *updateFileName; static char *updateFileName;
bool deleted; bool deleted;
time_t lastUpdate; time_t lastUpdate;
int state; int state;
const char *UpdateFileName(void);
void Refresh(bool Foreground = false); void Refresh(bool Foreground = false);
void ScanVideoDir(const char *DirName, bool Foreground = false); void ScanVideoDir(const char *DirName, bool Foreground = false);
protected: protected: