From 0d7571054579614f9278999077921942ca08a7bf Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 2 Sep 2001 10:28:20 +0200 Subject: [PATCH] Using '~' in recording filename --- FORMATS | 4 +++- HISTORY | 7 ++++++- MANUAL | 6 ++++++ menu.c | 5 +++-- recording.c | 15 ++++++++++++--- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/FORMATS b/FORMATS index 03739ee5..3c5d36d4 100644 --- a/FORMATS +++ b/FORMATS @@ -67,7 +67,9 @@ Video Disk Recorder File Formats be automatically deleted by a new recording with higher priority, 99 means that this recording will never be automatically deleted - Name of timer (will be used to name the recording); if the name contains - any ':' characters, these have to be replaced with '|' + any ':' characters, these have to be replaced with '|'. If the name shall + contain subdirectories, these have to be delimited by '~' (since the '/' + character may be part of a regular programme name). - Summary (any newline characters in the summary have to be replaced with '|'; the summary may contain ':' characters) diff --git a/HISTORY b/HISTORY index a1e17e3c..7ea886d3 100644 --- a/HISTORY +++ b/HISTORY @@ -677,7 +677,7 @@ Video Disk Recorder Revision History they will be recording. This can be disabled in the "Setup" menu. Note that the "Mark" button doesn't work if timers are displayed sorted. -2001-09-01: Version 0.9.4 +2001-09-02: Version 0.9.4 - Changed version number notation. - Implemented automatic shutdown (see INSTALL and MANUAL for details). @@ -696,3 +696,8 @@ Video Disk Recorder Revision History one timer ends at the same time another timer starts. - New setup parameter OSDMessageTime to define how long an OSD message shall be displayed. +- The "File" parameter of a timer can now contain the '~' character to store + the recording in a hierarchical directory structure. The '~' character has + been chosen since the file system's directory delimiter '/' may be part of + a regular programme name (showing the directory hierarchy in the "Recordings" + menu will follow later). diff --git a/MANUAL b/MANUAL index 90067006..2645f681 100644 --- a/MANUAL +++ b/MANUAL @@ -285,6 +285,12 @@ Video Disk Recorder User's Manual time, so it is possible to have a "repeating timer" store all its recordings under the same name; they will be distinguishable by their date and time). + If the file name contains the special character '~', the recording + will be stored in a hierarchical directory structure. For instance, + a file name of "Sci-Fi~Star Trek~Voyager" will result in a directory + structure "/video/Sci-Fi/Star_Trek/Voyager". The '~' character has + been chosen for this since the file system's directory delimiter '/' + may be part of a regular programme name. If this field is left blank, the channel name will be used to form the name of the recording. diff --git a/menu.c b/menu.c index 60ea250c..1f4e8674 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.112 2001/09/01 15:18:23 kls Exp $ + * $Id: menu.c 1.113 2001/09/02 10:00:40 kls Exp $ */ #include "menu.h" @@ -19,7 +19,7 @@ #define MENUTIMEOUT 120 // seconds #define MAXWAIT4EPGINFO 10 // seconds -const char *FileNameChars = " aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-.#^"; +const char *FileNameChars = " aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-.#~^"; // --- cMenuEditItem --------------------------------------------------------- @@ -494,6 +494,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key) if (value[pos] == '^') value[pos] = 0; pos = -1; + stripspace(value); break; } // run into default diff --git a/recording.c b/recording.c index ba063fb9..c98d5252 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.34 2001/09/01 13:05:56 kls Exp $ + * $Id: recording.c 1.35 2001/09/02 10:25:12 kls Exp $ */ #define _GNU_SOURCE @@ -179,6 +179,7 @@ void cResumeFile::Delete(void) struct tCharExchange { char a; char b; }; tCharExchange CharExchange[] = { + { '~', '/' }, { ' ', '_' }, { '\'', '\x01' }, { '/', '\x02' }, @@ -190,8 +191,16 @@ tCharExchange CharExchange[] = { char *ExchangeChars(char *s, bool ToFileSystem) { - for (struct tCharExchange *ce = CharExchange; ce->a && ce->b; ce++) - strreplace(s, ToFileSystem ? ce->a : ce->b, ToFileSystem ? ce->b : ce->a); + char *p = s; + while (*p) { + for (struct tCharExchange *ce = CharExchange; ce->a && ce->b; ce++) { + if (*p == (ToFileSystem ? ce->a : ce->b)) { + *p = ToFileSystem ? ce->b : ce->a; + break; + } + } + p++; + } return s; }