summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-08-06 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-08-06 18:00:00 +0200
commit9b405778674d5325b225b32ab694d9216b099527 (patch)
treedbce3ee646e63439d0690ffbcdf6cf93d7314d25 /recording.c
parent1d22145c423f2524c7766b4ae30ee2c26174113d (diff)
downloadvdr-patch-lnbsharing-9b405778674d5325b225b32ab694d9216b099527.tar.gz
vdr-patch-lnbsharing-9b405778674d5325b225b32ab694d9216b099527.tar.bz2
Version 0.61vdr-0.61
- When scrolling through a list it now moves a full page up or down when the cursor reaches the top or bottom of the menu (thanks to Heino Goldenstein!). - Added missing '#include <sys/stat.h>' to recording.c. - The video directory can now be defined with the command line option -v. - There can now be more than one video directory (in case you have several disks). - Fixed learning key codes for PC keyboard. - New command line option '-l' to set the log level. - Times in timers.conf are now always printed with 4 digits (leading '0'). - Slow forward/back mode (thanks to Guido Fiala!). - The "Up" key in replay mode no longer restarts replay at the very beginning, but rather resumes normal replay mode after a "pause", "forward" or "backward" operation. Use the "Skip -60s" function repeatedly to go back to the beginning of the recording. - Improved reaction on user input in fast/slow forward/back modes. - No more upper limit for the value of 'Pnr'. - Checking if the video card is really a DVB card. - New SVDRP command UPDT to update an existing timer (or add a new one if it doesn't yet exist). - New version of the 'epg2timers' tool (with a modified channel list). - Bugfix in closing window in DEBUG_OSD mode.
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c49
1 files changed, 10 insertions, 39 deletions
diff --git a/recording.c b/recording.c
index e37ccd8..9f3b388 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.12 2000/07/24 16:31:07 kls Exp $
+ * $Id: recording.c 1.15 2000/07/29 14:08:17 kls Exp $
*/
#define _GNU_SOURCE
@@ -13,9 +13,11 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <sys/stat.h>
#include <unistd.h>
#include "interface.h"
#include "tools.h"
+#include "videodir.h"
#define RECEXT ".rec"
#define DELEXT ".del"
@@ -24,40 +26,12 @@
#define SUMMARYFILESUFFIX "/summary.vdr"
-#define FINDCMD "find %s -type d -name '%s' | sort -df"
+#define FINDCMD "find %s -follow -type d -name '%s' 2> /dev/null | sort -df"
-#define DFCMD "df -m %s"
#define MINDISKSPACE 1024 // MB
#define DISKCHECKDELTA 300 // seconds between checks for free disk space
-const char *BaseDir = "/video";
-
-static bool LowDiskSpace(void)
-{
- //TODO Find a simpler way to determine the amount of free disk space!
- bool result = true;
- char *cmd = NULL;
- asprintf(&cmd, DFCMD, BaseDir);
- FILE *p = popen(cmd, "r");
- if (p) {
- char *s;
- while ((s = readline(p)) != NULL) {
- if (*s == '/') {
- int available;
- sscanf(s, "%*s %*d %*d %d", &available);
- result = available < MINDISKSPACE;
- break;
- }
- }
- pclose(p);
- }
- else
- esyslog(LOG_ERR, "ERROR: can't open pipe for cmd '%s'", cmd);
- delete cmd;
- return result;
-}
-
void AssertFreeDiskSpace(void)
{
// With every call to this function we try to actually remove
@@ -65,7 +39,7 @@ void AssertFreeDiskSpace(void)
// it will get removed during the next call.
static time_t LastFreeDiskCheck = 0;
if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA) {
- if (LowDiskSpace()) {
+ if (!VideoFileSpaceAvailable(MINDISKSPACE)) {
// Remove the oldest file that has been "deleted":
cRecordings Recordings;
if (Recordings.Load(true)) {
@@ -123,7 +97,7 @@ cRecording::cRecording(const char *FileName)
{
titleBuffer = NULL;
fileName = strdup(FileName);
- FileName += strlen(BaseDir) + 1;
+ FileName += strlen(VideoDirectory) + 1;
char *p = strrchr(FileName, '/');
name = NULL;
@@ -189,7 +163,7 @@ const char *cRecording::FileName(void)
{
if (!fileName) {
struct tm *t = localtime(&start);
- asprintf(&fileName, NAMEFORMAT, BaseDir, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime);
+ asprintf(&fileName, NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime);
if (fileName)
strreplace(fileName, ' ', '_');
}
@@ -239,10 +213,7 @@ bool cRecording::Delete(void)
if (strcmp(ext, RECEXT) == 0) {
strncpy(ext, DELEXT, strlen(ext));
isyslog(LOG_INFO, "deleting recording %s", FileName());
- if (rename(FileName(), NewName) == -1) {
- esyslog(LOG_ERR, "ERROR: %s: %s", FileName(), strerror(errno));
- result = false;
- }
+ result = RenameVideoFile(FileName(), NewName);
}
delete NewName;
return result;
@@ -251,7 +222,7 @@ bool cRecording::Delete(void)
bool cRecording::Remove(void)
{
isyslog(LOG_INFO, "removing recording %s", FileName());
- return RemoveFileOrDir(FileName());
+ return RemoveVideoFile(FileName());
}
// --- cRecordings -----------------------------------------------------------
@@ -261,7 +232,7 @@ bool cRecordings::Load(bool Deleted)
Clear();
bool result = false;
char *cmd = NULL;
- asprintf(&cmd, FINDCMD, BaseDir, Deleted ? "*" DELEXT : "*" RECEXT);
+ asprintf(&cmd, FINDCMD, VideoDirectory, Deleted ? "*" DELEXT : "*" RECEXT);
FILE *p = popen(cmd, "r");
if (p) {
char *s;