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

Improved handling of blanks in channel and timer names

This commit is contained in:
Klaus Schmidinger 2000-07-16 15:02:33 +02:00
parent 685e0f6951
commit d0179ea219
7 changed files with 35 additions and 13 deletions

View File

@ -77,4 +77,6 @@ Video Disk Recorder Revision History
replay has been reduced to 2 digits to allow more space for the recording's replay has been reduced to 2 digits to allow more space for the recording's
title. In the internal file structure the year is still stored with 4 digits, title. In the internal file structure the year is still stored with 4 digits,
so there will be no problem at the next turn of the century ;-) so there will be no problem at the next turn of the century ;-)
- Channel names and timer filenames can now contain blanks. To avoid problems
with file names that contain blanks, all blanks in recording file names are
converted to underscores.

6
MANUAL
View File

@ -41,7 +41,11 @@ Video Disk Recorder User's Manual
by pressing the "Right" button (which puts brackets around the current by pressing the "Right" button (which puts brackets around the current
character as in "[R]TL"), selecting the desired character position with character as in "[R]TL"), selecting the desired character position with
"Left" and "Right", and changing the character with the "Up" and "Down" "Left" and "Right", and changing the character with the "Up" and "Down"
keys. "Ok" then confirms the changes. keys. "Ok" then confirms the changes. The special character '^' can be used
to "cut off" a string at this position. When this character is visible in the
brackets (as in abc[^]), the next press to the "Left" or "Ok" button will
actually cut off the string. Using "Up" and/or "Down" brings back the
original rest of the string (unless you have pressed "Left" or "Ok").
The "Red", "Green", "Yellow" and "Blue" buttons have special meanings The "Red", "Green", "Yellow" and "Blue" buttons have special meanings
in various menus and are listed at the bottom of the on-screen-display. in various menus and are listed at the bottom of the on-screen-display.

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: config.c 1.10 2000/07/16 11:47:30 kls Exp $ * $Id: config.c 1.11 2000/07/16 14:28:20 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -318,7 +318,7 @@ bool cTimer::Parse(char *s)
{ {
char *buffer1 = NULL; char *buffer1 = NULL;
char *buffer2 = NULL; char *buffer2 = NULL;
if (8 == sscanf(s, "%d:%d:%a[^:]:%d:%d:%d:%d:%as", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2)) { if (8 == sscanf(s, "%d:%d:%a[^:]:%d:%d:%d:%d:%a[^:\n]", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2)) {
day = ParseDay(buffer1); day = ParseDay(buffer1);
strncpy(file, buffer2, MaxFileName - 1); strncpy(file, buffer2, MaxFileName - 1);
file[strlen(buffer2)] = 0; file[strlen(buffer2)] = 0;

12
menu.c
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: menu.c 1.18 2000/07/16 13:42:29 kls Exp $ * $Id: menu.c 1.19 2000/07/16 14:52:48 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -16,7 +16,7 @@
#define MENUTIMEOUT 120 // seconds #define MENUTIMEOUT 120 // seconds
const char *FileNameChars = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-.# "; const char *FileNameChars = " aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-.#^";
// --- cMenuEditItem --------------------------------------------------------- // --- cMenuEditItem ---------------------------------------------------------
@ -429,7 +429,7 @@ void cMenuEditStrItem::Set(void)
char buf[1000]; char buf[1000];
if (pos >= 0) { if (pos >= 0) {
strncpy(buf, value, pos); strncpy(buf, value, pos);
const char *s = value[pos] != ' ' ? value + pos + 1 : ""; const char *s = value[pos] != '^' ? value + pos + 1 : "";
snprintf(buf + pos, sizeof(buf) - pos - 2, "[%c]%s", *(value + pos), s); snprintf(buf + pos, sizeof(buf) - pos - 2, "[%c]%s", *(value + pos), s);
SetValue(buf); SetValue(buf);
} }
@ -455,12 +455,12 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
{ {
switch (Key) { switch (Key) {
case kLeft: if (pos > 0) { case kLeft: if (pos > 0) {
if (value[pos] == ' ') if (value[pos] == '^')
value[pos] = 0; value[pos] = 0;
pos--; pos--;
} }
break; break;
case kRight: if (pos < length && value[pos] != ' ') { case kRight: if (pos < length && value[pos] != '^' && (pos < int(strlen(value) - 1) || value[pos] != ' ')) {
if (++pos >= int(strlen(value))) { if (++pos >= int(strlen(value))) {
value[pos] = ' '; value[pos] = ' ';
value[pos + 1] = 0; value[pos + 1] = 0;
@ -474,7 +474,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
return cMenuEditItem::ProcessKey(Key); return cMenuEditItem::ProcessKey(Key);
break; break;
case kOk: if (pos >= 0) { case kOk: if (pos >= 0) {
if (value[pos] == ' ') if (value[pos] == '^')
value[pos] = 0; value[pos] = 0;
pos = -1; pos = -1;
break; break;

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.10 2000/07/16 13:41:45 kls Exp $ * $Id: recording.c 1.11 2000/07/16 14:21:37 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -141,6 +141,7 @@ cRecording::cRecording(const char *FileName)
name = new char[p - FileName + 1]; name = new char[p - FileName + 1];
strncpy(name, FileName, p - FileName); strncpy(name, FileName, p - FileName);
name[p - FileName] = 0; name[p - FileName] = 0;
strreplace(name, '_', ' ');
} }
} }
} }
@ -157,6 +158,8 @@ const char *cRecording::FileName(void)
if (!fileName) { if (!fileName) {
struct tm *t = localtime(&start); 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, BaseDir, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime);
if (fileName)
strreplace(fileName, ' ', '_');
} }
return fileName; return fileName;
} }

14
tools.c
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: tools.c 1.8 2000/06/24 15:26:15 kls Exp $ * $Id: tools.c 1.9 2000/07/16 14:14:44 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -76,6 +76,18 @@ char *readline(FILE *f)
return NULL; return NULL;
} }
char *strreplace(char *s, char c1, char c2)
{
char *p = s;
while (*p) {
if (*p == c1)
*p = c2;
p++;
}
return s;
}
int time_ms(void) int time_ms(void)
{ {
static time_t t0 = 0; static time_t t0 = 0;

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: tools.h 1.8 2000/06/24 15:25:00 kls Exp $ * $Id: tools.h 1.9 2000/07/16 14:11:34 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -37,6 +37,7 @@ char readchar(int filedes);
bool readint(int filedes, int &n); bool readint(int filedes, int &n);
void purge(int filedes); void purge(int filedes);
char *readline(FILE *f); char *readline(FILE *f);
char *strreplace(char *s, char c1, char c2);
int time_ms(void); int time_ms(void);
void delay_ms(int ms); void delay_ms(int ms);
bool MakeDirs(const char *FileName, bool IsDirectory = false); bool MakeDirs(const char *FileName, bool IsDirectory = false);