mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fall back to 'summary.vdr' if there is no 'info.vdr'
This commit is contained in:
parent
a0e6585304
commit
2d3702b850
3
HISTORY
3
HISTORY
@ -3533,7 +3533,8 @@ Video Disk Recorder Revision History
|
|||||||
|
|
||||||
summary2info.pl /video
|
summary2info.pl /video
|
||||||
|
|
||||||
(the parameter given has to be the video directory).
|
(the parameter given has to be the video directory). If there is no 'info.vdr'
|
||||||
|
file for a recording, an attempt is made to read a 'summary.vdr'.
|
||||||
- The "Summary" button in the "Recordings" menu has been renamed to "Info", and
|
- The "Summary" button in the "Recordings" menu has been renamed to "Info", and
|
||||||
the page it brings up now shows the recording's information, much like the EPG
|
the page it brings up now shows the recording's information, much like the EPG
|
||||||
event page. Therefore it now no longer uses the skin's SetText() function, but
|
event page. Therefore it now no longer uses the skin's SetText() function, but
|
||||||
|
55
recording.c
55
recording.c
@ -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.101 2005/05/22 09:13:26 kls Exp $
|
* $Id: recording.c 1.102 2005/05/22 10:43:10 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -23,6 +23,8 @@
|
|||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "videodir.h"
|
#include "videodir.h"
|
||||||
|
|
||||||
|
#define SUMMARYFALLBACK
|
||||||
|
|
||||||
#define RECEXT ".rec"
|
#define RECEXT ".rec"
|
||||||
#define DELEXT ".del"
|
#define DELEXT ".del"
|
||||||
/* This was the original code, which works fine in a Linux only environment.
|
/* This was the original code, which works fine in a Linux only environment.
|
||||||
@ -45,6 +47,9 @@
|
|||||||
// end of implementation for brain dead systems
|
// end of implementation for brain dead systems
|
||||||
|
|
||||||
#define RESUMEFILESUFFIX "/resume%s%s.vdr"
|
#define RESUMEFILESUFFIX "/resume%s%s.vdr"
|
||||||
|
#ifdef SUMMARYFALLBACK
|
||||||
|
#define SUMMARYFILESUFFIX "/summary.vdr"
|
||||||
|
#endif
|
||||||
#define INFOFILESUFFIX "/info.vdr"
|
#define INFOFILESUFFIX "/info.vdr"
|
||||||
#define MARKSFILESUFFIX "/marks.vdr"
|
#define MARKSFILESUFFIX "/marks.vdr"
|
||||||
|
|
||||||
@ -230,10 +235,12 @@ cRecordingInfo::~cRecordingInfo()
|
|||||||
delete ownEvent;
|
delete ownEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecordingInfo::SetTitleAndDescription(const char *Title, const char *Description)
|
void cRecordingInfo::SetData(const char *Title, const char *ShortText, const char *Description)
|
||||||
{
|
{
|
||||||
if (isempty(event->Title()) && !isempty(Title))
|
if (!isempty(Title))
|
||||||
((cEvent *)event)->SetTitle(Title);
|
((cEvent *)event)->SetTitle(Title);
|
||||||
|
if (!isempty(ShortText))
|
||||||
|
((cEvent *)event)->SetShortText(ShortText);
|
||||||
if (!isempty(Description))
|
if (!isempty(Description))
|
||||||
((cEvent *)event)->SetDescription(Description);
|
((cEvent *)event)->SetDescription(Description);
|
||||||
}
|
}
|
||||||
@ -422,7 +429,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
|
|||||||
// timer into the recording info, but it saves us from having to actually
|
// timer into the recording info, but it saves us from having to actually
|
||||||
// copy the entire event data:
|
// copy the entire event data:
|
||||||
if (!isempty(Timer->Summary()))
|
if (!isempty(Timer->Summary()))
|
||||||
info->SetTitleAndDescription(Timer->File(), Timer->Summary());
|
info->SetData(isempty(info->Title()) ? Timer->File() : NULL, NULL, Timer->Summary());
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecording::cRecording(const char *FileName)
|
cRecording::cRecording(const char *FileName)
|
||||||
@ -462,6 +469,46 @@ cRecording::cRecording(const char *FileName)
|
|||||||
else if (errno != ENOENT)
|
else if (errno != ENOENT)
|
||||||
LOG_ERROR_STR(InfoFileName);
|
LOG_ERROR_STR(InfoFileName);
|
||||||
free(InfoFileName);
|
free(InfoFileName);
|
||||||
|
#ifdef SUMMARYFALLBACK
|
||||||
|
// fall back to the old 'summary.vdr' if there was no 'info.vdr':
|
||||||
|
if (isempty(info->Title())) {
|
||||||
|
char *SummaryFileName = NULL;
|
||||||
|
asprintf(&SummaryFileName, "%s%s", fileName, SUMMARYFILESUFFIX);
|
||||||
|
FILE *f = fopen(SummaryFileName, "r");
|
||||||
|
if (f) {
|
||||||
|
int line = 0;
|
||||||
|
char *data[3] = { NULL };
|
||||||
|
cReadLine ReadLine;
|
||||||
|
char *s;
|
||||||
|
while ((s = ReadLine.Read(f)) != NULL && line < 3) {
|
||||||
|
if (*s) {
|
||||||
|
if (data[line]) {
|
||||||
|
int len = strlen(s);
|
||||||
|
len += strlen(data[line]) + 1;
|
||||||
|
data[line] = (char *)realloc(data[line], len + 1);
|
||||||
|
strcat(data[line], "\n");
|
||||||
|
strcat(data[line], s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
data[line] = strdup(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
if (line == 1) {
|
||||||
|
data[2] = data[1];
|
||||||
|
data[1] = NULL;
|
||||||
|
}
|
||||||
|
info->SetData(data[0], data[1], data[2]);
|
||||||
|
for (int i = 0; i < 3; i ++)
|
||||||
|
free(data[i]);
|
||||||
|
}
|
||||||
|
else if (errno != ENOENT)
|
||||||
|
LOG_ERROR_STR(SummaryFileName);
|
||||||
|
free(SummaryFileName);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.36 2005/05/22 09:08:40 kls Exp $
|
* $Id: recording.h 1.37 2005/05/22 10:29:02 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RECORDING_H
|
#ifndef __RECORDING_H
|
||||||
@ -39,7 +39,7 @@ private:
|
|||||||
const cEvent *event;
|
const cEvent *event;
|
||||||
cEvent *ownEvent;
|
cEvent *ownEvent;
|
||||||
cRecordingInfo(const cEvent *Event = NULL);
|
cRecordingInfo(const cEvent *Event = NULL);
|
||||||
void SetTitleAndDescription(const char *Title, const char *Description);
|
void SetData(const char *Title, const char *ShortText, const char *Description);
|
||||||
public:
|
public:
|
||||||
~cRecordingInfo();
|
~cRecordingInfo();
|
||||||
const char *Title(void) const { return event->Title(); }
|
const char *Title(void) const { return event->Title(); }
|
||||||
|
@ -10,7 +10,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: summary2info.pl 1.1 2005/05/15 16:03:10 kls Exp $
|
# $Id: summary2info.pl 1.2 2005/05/22 10:37:47 kls Exp $
|
||||||
|
|
||||||
$VideoDir = $ARGV[0] || die "please provide the name of the video directory\n";
|
$VideoDir = $ARGV[0] || die "please provide the name of the video directory\n";
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ for $SummaryFile (@SummaryFiles) {
|
|||||||
$data[$line] .= $_;
|
$data[$line] .= $_;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$line++ unless ($_);
|
$line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(F);
|
close(F);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user