#! /bin/sh /usr/share/dpatch/dpatch-run ## opt-46_dvdarchive.dpatch by Andreas Kool ## http://www.akool.homepage.t-online.de/DVDarchive/download/vdr-dvdarchive-0.0.4.tar.bz2 ## ## Thomas Günther : ## - adapted to VDR-1.3.42 ## - solved conflicts with other patches ## - activated DVDARCHIVE define by default ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Play on DVD archived VDR recordings. @DPATCH@ diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/Makefile vdr-1.3.21/Makefile --- vdr-1.3.21.orig/Makefile 2005-02-13 11:13:45.000000000 +0100 +++ vdr-1.3.21/Makefile 2005-02-20 10:13:44.000000000 +0100 @@ -80,6 +80,10 @@ DEFINES += -DVFAT endif +ifndef NO_DVDARCHIVE +DEFINES += -DDVDARCHIVE +endif + all: vdr font: genfontfile\ fontfix-iso8859-1.c fontosd-iso8859-1.c fontsml-iso8859-1.c\ diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/config.c vdr-1.3.21/config.c --- vdr-1.3.21.orig/config.c 2005-02-05 11:43:04.000000000 +0100 +++ vdr-1.3.21/config.c 2005-02-20 10:17:51.000000000 +0100 @@ -294,6 +294,10 @@ SplitEditedFiles = 0; MinEventTimeout = 30; MinUserInactivity = 300; +#ifdef DVDARCHIVE + TrayOpenOnBegin = 1; + TrayOpenOnEnd = 1; +#endif /* DVDARCHIVE */ MultiSpeedMode = 0; ShowReplayMode = 0; ResumeID = 0; @@ -450,6 +454,10 @@ else if (!strcasecmp(Name, "SplitEditedFiles")) SplitEditedFiles = atoi(Value); else if (!strcasecmp(Name, "MinEventTimeout")) MinEventTimeout = atoi(Value); else if (!strcasecmp(Name, "MinUserInactivity")) MinUserInactivity = atoi(Value); +#ifdef DVDARCHIVE + else if (!strcasecmp(Name, "TrayOpenOnBegin")) TrayOpenOnBegin = atoi(Value); + else if (!strcasecmp(Name, "TrayOpenOnEnd")) TrayOpenOnEnd = atoi(Value); +#endif /* DVDARCHIVE */ else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value); else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value); else if (!strcasecmp(Name, "ResumeID")) ResumeID = atoi(Value); @@ -515,6 +523,10 @@ Store("MinUserInactivity", MinUserInactivity); Store("MultiSpeedMode", MultiSpeedMode); Store("ShowReplayMode", ShowReplayMode); +#ifdef DVDARCHIVE + Store("TrayOpenOnBegin", TrayOpenOnBegin); + Store("TrayOpenOnEnd", TrayOpenOnEnd); +#endif /* DVDARCHIVE */ Store("ResumeID", ResumeID); Store("CurrentChannel", CurrentChannel); Store("CurrentVolume", CurrentVolume); diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/config.h vdr-1.3.21/config.h --- vdr-1.3.21.orig/config.h 2005-02-08 12:22:14.000000000 +0100 +++ vdr-1.3.21/config.h 2005-02-20 10:21:51.000000000 +0100 @@ -248,6 +248,8 @@ int MaxVideoFileSize; int SplitEditedFiles; int MinEventTimeout, MinUserInactivity; + int TrayOpenOnBegin; + int TrayOpenOnEnd; int MultiSpeedMode; int ShowReplayMode; int ResumeID; diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/i18n.c vdr-1.3.21/i18n.c --- vdr-1.3.21.orig/i18n.c 2005-02-12 11:26:51.000000000 +0100 +++ vdr-1.3.21/i18n.c 2005-02-20 10:13:44.000000000 +0100 @@ -2231,6 +2231,84 @@ "Kõvaketas peaaegu täis!", "Kun lidt diskplads tilbage!", }, +#ifdef DVDARCHIVE + { "Please mount DVD %s", + "Bitte DVD %s einlegen", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, + { "Wrong DVD!", + "Falsche DVD!", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, + { "Setup.Replay$Tray open on begin", + "DVD-Schublade zu Beginn öffnen", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, + { "Setup.Replay$Tray open on end", + "DVD-Schublade am Ende öffnen", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, +#endif /* DVDARCHIVE */ { "Can't open CAM menu!", "CAM-Menü kann nicht geöffnet werden!", "Ne morem odpreti CAM menija!", diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/menu.c vdr-1.3.21/menu.c --- vdr-1.3.21.orig/menu.c 2005-02-06 12:33:13.000000000 +0100 +++ vdr-1.3.21/menu.c 2005-02-20 10:13:44.000000000 +0100 @@ -2171,6 +2171,8 @@ SetSection(tr("Replay")); Add(new cMenuEditBoolItem(tr("Setup.Replay$Multi speed mode"), &data.MultiSpeedMode)); Add(new cMenuEditBoolItem(tr("Setup.Replay$Show replay mode"), &data.ShowReplayMode)); + Add(new cMenuEditBoolItem(tr("Setup.Replay$Tray open on begin"), &data.TrayOpenOnBegin)); + Add(new cMenuEditBoolItem(tr("Setup.Replay$Tray open on end"), &data.TrayOpenOnEnd)); Add(new cMenuEditIntItem(tr("Setup.Replay$Resume ID"), &data.ResumeID, 0, 99)); } diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/recording.c vdr-1.3.21/recording.c --- vdr-1.3.21.orig/recording.c 2005-02-12 11:17:47.000000000 +0100 +++ vdr-1.3.21/recording.c 2005-02-20 10:28:31.000000000 +0100 @@ -1094,6 +1094,97 @@ LOG_ERROR_STR(fileName); } else { +#ifdef DVDARCHIVE + isOnDVD = false; + + if (access(fileName, R_OK)) { // fileName="/video0/Blumen_des_Schreckens/2004-05-10.12:25.50.99.rec/001.vdr" + if (errno == ENOENT) { + register char *p, *p1; + register int n = 1; + auto bool ok = false; + auto char fn[BUFSIZ], fn2[BUFSIZ], msg[BUFSIZ], cmd[BUFSIZ], s[BUFSIZ]; + auto FILE *f, *f1; + cReadLine ReadLine; + + strcpy(fn, fileName); + + if ((p = strrchr(fn, '.'))) { + memcpy(p - 3, "dvd", 3); // fn="/video0/Blumen_des_Schreckens/2004-05-10.12:25.50.99.rec/dvd.vdr" + + if ((f = fopen(fn, "r")) != (FILE *)NULL) { + if (fgets(s, sizeof s, f)) { + if ((p1 = strchr(s, '\n'))) + *p1 = 0; + sprintf(msg, tr("Please mount DVD %s"), s); + + do { + if (Setup.TrayOpenOnBegin) + SystemExec("umount /dev/cdrom; eject /dev/cdrom"); + else + SystemExec("umount /dev/cdrom"); + + if (Interface->Confirm(msg)) { + + SystemExec("eject -t /dev/cdrom; mkdir -p /tmp/vdr.dvd; mount -o ro /dev/cdrom /tmp/vdr.dvd"); + isOnDVD = true; + + *(p - 4) = 0; + sprintf(cmd, "find /tmp/vdr.dvd -name '%s'", p - 30); // fn="2004-05-10.12:25.50.99.rec" + + if ((f1 = popen(cmd, "r")) != (FILE *)NULL) { + + if ((p1 = ReadLine.Read(f1)) != NULL) { + + if ((p = strrchr(fileName, '/'))) + *p = 0; + + do { + sprintf(fn2, "%s/%03d.vdr", p1, n); + + if (!access(fn2, R_OK)) { + sprintf(s, "ln -sf '%s' '%s/%03d.vdr'", fn2, fileName, n); + SystemExec(s); + dsyslog(s); + } + else + break; + } + while (++n < MAXFILESPERRECORDING); + + sprintf(fn2, "%s/index.vdr", p1); + + if (!access(fn2, R_OK)) { + sprintf(s, "ln -sf '%s' '%s/index.vdr'", fn2, fileName); + SystemExec(s); + dsyslog(s); + } + + *p = '/'; + + ok = true; + } + pclose(f1); + } + + if (!ok) { +#if VDRVERSNUM >= 10307 + Skins.Message(mtError, tr("Wrong DVD!")); +#else + Interface->Error(tr("Wrong DVD!")); +#endif + isOnDVD = false; + } + } + else + break; + } while (!ok); + } + fclose(f); + } + } + } + } +#endif /* DVDARCHIVE */ if (access(fileName, R_OK) == 0) { dsyslog("playing '%s'", fileName); file = open(fileName, O_RDONLY | BlockingFlag); @@ -1113,6 +1204,15 @@ if ((record && CloseVideoFile(file) < 0) || (!record && file->Close() < 0)) LOG_ERROR_STR(fileName); file = NULL; +#ifdef DVDARCHIVE + if (isOnDVD) { + if (Setup.TrayOpenOnEnd) + SystemExec("umount /dev/cdrom; eject /dev/cdrom"); + else + SystemExec("umount /dev/cdrom"); + isOnDVD = false; + } +#endif /* DVDARCHIVE */ } } diff -drubNB -x PLUGINS -x mk -x 'ORIG*' vdr-1.3.21.orig/recording.h vdr-1.3.21/recording.h --- vdr-1.3.21.orig/recording.h 2005-01-16 16:11:31.000000000 +0100 +++ vdr-1.3.21/recording.h 2005-02-20 10:13:44.000000000 +0100 @@ -163,6 +163,9 @@ char *fileName, *pFileNumber; bool record; bool blocking; +#ifdef DVDARCHIVE + bool isOnDVD; +#endif /* DVDARCHIVE */ public: cFileName(const char *FileName, bool Record, bool Blocking = false); ~cFileName();