summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-01-27 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-01-27 18:00:00 +0100
commit27919ee969866b68fc95b327a047a9989e4b4153 (patch)
tree1857862abf169ff6e9287152cd6fec6a1d9dbc41 /recording.c
parentb420457467ad0c8ae71f8b985914e85b7a0ff5aa (diff)
downloadvdr-patch-lnbsharing-27919ee969866b68fc95b327a047a9989e4b4153.tar.gz
vdr-patch-lnbsharing-27919ee969866b68fc95b327a047a9989e4b4153.tar.bz2
Version 0.99pre2vdr-0.99pre2
- Fixed setting the OSD size in the 'Confirm' interface call (thanks to Deti Fliegl). - Removed the 'read incomplete section...' error message in the EIT processor. - Fixed channel data for "DW TV" (thanks to Axel Gruber). - Added DPID to "PREMIERE MOVIE 1" in channels.conf.cable (thanks to Stephan Schreiber). - Prepared the OSD functions for multiple overlapping windows. - Removed the check to see whether the system time is running linearly. - Improved performance of SVDRP command entry. - Removed EPGBugfixLevel '3' - after more than a year Pro-7 finally managed to broadcast the correct timestamps for EPG events between 0:00 and 6:00! - Fixed failing watchdog timer if program hangs in OSD activities (thanks to Carsten Koch). - No longer requiring 'libncurses' if compiling without DEBUG_OSD=1 and REMOTE=KBD (thanks to Lauri Pesonen). - The "Recordings" menu now displays a hierarchical structure if there are subdirectories for the recordings. This can be controlled through the "RecordingDirs" parameter in the "Setup" menu. See "MANUAL/Replaying a Recording" for details. - Improved speed of setting the Help button texts. - Fixed handling file names that contain single quotes (') or dollar signs ($) in the call to the shutdown command (option '-s') and the recording command (option '-r'). - Improved error handling in the editing process; the resulting file will be deleted if an error occured. - A message is now prompted at the end of the editing process, indicating whether the process succeeded or failed. - Fixed setting the LastActivity timestamp after a shutdown prompt (thanks to Sergei Haller). - A message is now prompted if free disk space becomes low during recording. - The editing process now calls AssertFreeDiskSpace() to remove deleted recordings if the disk becomes full. - The "Main" menu now displays in its title the used disk space (in percent) and the estimated free disk space (in hh:mm), assuming a data rate of 30 MB per minute. - Activating the "Recordings" menu now displays "scanning recordings..." to give the user some feedback in case this takes longer. - Status messages are now displayed centered. - Removed the 'Tools' subdirectory from the VDR archive. All contributed tools can now be found at ftp://ftp.cadsoft.de/pub/people/kls/vdr/Tools.
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c105
1 files changed, 82 insertions, 23 deletions
diff --git a/recording.c b/recording.c
index fe56a6e..acdf264 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 1.42 2001/10/20 10:28:28 kls Exp $
+ * $Id: recording.c 1.48 2002/01/27 15:14:45 kls Exp $
*/
#include "recording.h"
@@ -14,6 +14,7 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "i18n.h"
#include "interface.h"
#include "tools.h"
#include "videodir.h"
@@ -37,7 +38,7 @@
#define DELETEDLIFETIME 1 // hours after which a deleted recording will be actually removed
#define REMOVECHECKDELTA 3600 // seconds between checks for removing deleted files
-#define DISKCHECKDELTA 300 // seconds between checks for free disk space
+#define DISKCHECKDELTA 100 // seconds between checks for free disk space
#define REMOVELATENCY 10 // seconds to wait until next check after removing a file
void RemoveDeletedRecordings(void)
@@ -118,7 +119,7 @@ void AssertFreeDiskSpace(int Priority)
return;
}
// Unable to free disk space, but there's nothing we can do about that...
- esyslog(LOG_ERR, "low disk space, but no recordings to delete");
+ Interface->Confirm(tr("Low disk space"), 30);
}
LastFreeDiskCheck = time(NULL);
}
@@ -184,6 +185,8 @@ void cResumeFile::Delete(void)
// --- cRecording ------------------------------------------------------------
+#define RESUME_NOT_INITIALIZED (-2)
+
struct tCharExchange { char a; char b; };
tCharExchange CharExchange[] = {
{ '~', '/' },
@@ -213,6 +216,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary)
{
+ resume = RESUME_NOT_INITIALIZED;
titleBuffer = NULL;
sortBuffer = NULL;
fileName = NULL;
@@ -242,6 +246,7 @@ cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary)
cRecording::cRecording(const char *FileName)
{
+ resume = RESUME_NOT_INITIALIZED;
titleBuffer = NULL;
sortBuffer = NULL;
fileName = strdup(FileName);
@@ -342,6 +347,15 @@ char *cRecording::SortName(void)
return sortBuffer;
}
+int cRecording::GetResume(void)
+{
+ if (resume == RESUME_NOT_INITIALIZED) {
+ cResumeFile ResumeFile(FileName());
+ resume = ResumeFile.Read();
+ }
+ return resume;
+}
+
bool cRecording::operator< (const cListObject &ListObject)
{
cRecording *r = (cRecording *)&ListObject;
@@ -360,27 +374,47 @@ const char *cRecording::FileName(void)
return fileName;
}
-const char *cRecording::Title(char Delimiter, bool NewIndicator)
+const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
{
- char New = ' ';
- if (NewIndicator) {
- cResumeFile ResumeFile(FileName());
- if (ResumeFile.Read() <= 0)
- New = '*';
- }
+ char New = NewIndicator && IsNew() ? '*' : ' ';
delete titleBuffer;
titleBuffer = NULL;
- struct tm tm_r;
- struct tm *t = localtime_r(&start, &tm_r);
- asprintf(&titleBuffer, "%02d.%02d%c%02d:%02d%c%c%s",
- t->tm_mday,
- t->tm_mon + 1,
- Delimiter,
- t->tm_hour,
- t->tm_min,
- New,
- Delimiter,
- name);
+ if (Level < 0 || Level == HierarchyLevels()) {
+ struct tm tm_r;
+ struct tm *t = localtime_r(&start, &tm_r);
+ const char *s;
+ if (Level > 0 && (s = strrchr(name, '~')) != NULL)
+ s++;
+ else
+ s = name;
+ asprintf(&titleBuffer, "%02d.%02d%c%02d:%02d%c%c%s",
+ t->tm_mday,
+ t->tm_mon + 1,
+ Delimiter,
+ t->tm_hour,
+ t->tm_min,
+ New,
+ Delimiter,
+ s);
+ }
+ else if (Level < HierarchyLevels()) {
+ const char *s = name;
+ const char *p = s;
+ while (*++s) {
+ if (*s == '~') {
+ if (Level--)
+ p = s + 1;
+ else
+ break;
+ }
+ }
+ titleBuffer = new char[s - p + 3];
+ *titleBuffer = Delimiter;
+ *(titleBuffer + 1) = Delimiter;
+ strn0cpy(titleBuffer + 2, p, s - p + 1);
+ }
+ else
+ return "";
return titleBuffer;
}
@@ -395,6 +429,17 @@ const char *cRecording::PrefixFileName(char Prefix)
return NULL;
}
+int cRecording::HierarchyLevels(void)
+{
+ const char *s = name;
+ int level = 0;
+ while (*++s) {
+ if (*s == '~')
+ level++;
+ }
+ return level;
+}
+
bool cRecording::WriteSummary(void)
{
if (summary) {
@@ -429,6 +474,11 @@ bool cRecording::Delete(void)
bool cRecording::Remove(void)
{
+ // let's do a final safety check here:
+ if (!endswith(FileName(), DELEXT)) {
+ esyslog(LOG_ERR, "attempt to remove recording %s", FileName());
+ return false;
+ }
isyslog(LOG_INFO, "removing recording %s", FileName());
return RemoveVideoFile(FileName());
}
@@ -446,7 +496,7 @@ bool cRecordings::Load(bool Deleted)
char *s;
while ((s = readline(p)) != NULL) {
cRecording *r = new cRecording(s);
- if (r->name)
+ if (r->Name())
Add(r);
else
delete r;
@@ -461,6 +511,15 @@ bool cRecordings::Load(bool Deleted)
return result;
}
+cRecording *cRecordings::GetByName(const char *FileName)
+{
+ for (cRecording *recording = First(); recording; recording = Next(recording)) {
+ if (strcmp(recording->FileName(), FileName) == 0)
+ return recording;
+ }
+ return NULL;
+}
+
// --- cMark -----------------------------------------------------------------
char *cMark::buffer = NULL;
@@ -573,7 +632,7 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi
{
if (command) {
char *cmd;
- asprintf(&cmd, "%s %s '%s'", command, State, RecordingFileName);
+ asprintf(&cmd, "%s %s \"%s\"", command, State, strescape(RecordingFileName, "\"$"));
isyslog(LOG_INFO, "executing '%s'", cmd);
SystemExec(cmd);
delete cmd;