diff options
author | Andreas Mair <andreas@vdr-developer.org> | 2010-08-26 07:50:59 +0200 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2010-08-26 07:57:29 +0200 |
commit | 57a99e05234ffc28bb3a1d16c058bf38ce629d82 (patch) | |
tree | fd24bf63611cfe9aad299e2cb88c1c85df950c1d /contrib | |
parent | acf461064b16ec85ef52887773d8d6a364826106 (diff) | |
download | vdr-plugin-extrecmenu-57a99e05234ffc28bb3a1d16c058bf38ce629d82.tar.gz vdr-plugin-extrecmenu-57a99e05234ffc28bb3a1d16c058bf38ce629d82.tar.bz2 |
Merge from v1.3-devel head (Submitted by Joe_D @vdr-portal.de).
Diffstat (limited to 'contrib')
19 files changed, 1373 insertions, 0 deletions
diff --git a/contrib/hddarchive/README b/contrib/hddarchive/README new file mode 100644 index 0000000..68b674e --- /dev/null +++ b/contrib/hddarchive/README @@ -0,0 +1,28 @@ +The hddarchive feature of the extrecmenu plugin is similar to +the dvdarchive feature. Except that the recordings are moved to a +HDD and not burned to a DVD. +In my case, I have an external USB docking station for SATA HDDs in which +I plug in the HDD with the recording to play. + + +Installation +============ + +1. Copy the 'hddarchive.sh' to the same directory like 'dvdarchive.sh' + (in Gentoo Linux it is /usr/bin/hddarchive.sh) +2. Copy the 'hddarchive.conf' to the same directory like 'dvdarchive.conf' + (in Gentoo Linux it is located in /etc/vdr/) +3. Edit the 'hddarchive.conf'. MOUNTPOINT should be an existing path, in + which the HDD will be mounted. +4. Copy the script 'vdr_move_to_hdd.sh' to /usr/local/bin/ +5. Edit /usr/local/bin/vdr_move_to_hdd.sh: check that ARCHIVEHDD is the same + as MOUNTPOINT in 3. + VDRSETTINGSFILE is the path to the gentoo vdr config file (/etc/conf.d/vdr). + This is only used to get the envvar ${VIDEO}. Alternative, You can set + VIDEO=... manually. +6. Add the content of ./reccmds/reccmds.custom.conf to Your reccmds.conf. +7. Create a file hdd.vdr in the root direcory on each archive HDD (/hdd.vdr) + The content is used to identify the HDD and should be unique. + I have used 2 digits 01, 02... "99 harddisks ought to be enough for anybody" ;-) +8. If you use the "live" plugin you may want to patch it with + ./patches/live-ArchiveHDD.patch to support the archive HDDs. diff --git a/contrib/hddarchive/hddarchive.conf b/contrib/hddarchive/hddarchive.conf new file mode 100644 index 0000000..c07e213 --- /dev/null +++ b/contrib/hddarchive/hddarchive.conf @@ -0,0 +1,17 @@ +# config file for /usr/bin/hddarchive.sh +# this is used by vdr-extrecmenu for hddarchives + +# Mountpoint, the same as in fstab +MOUNTPOINT="/mnt/archive-hdd" # no trailing '/' + +# Log warnings/errors in syslog. 1 = yes, 0 = no. +SYSLOG=1 + +# Create a length.vdr after mounting the dvd for the played recording. 1 = yes, 0 = no. +# Only for non-vfat and with index.vdr only on dvd. +GETLENGTH=1 + +# Put debug infos in file $DEBUGLOG. Only if $DEBUG=1. +DEBUG=0 +DEBUGLOG="/tmp/hddarchive.sh-debug.log" + diff --git a/contrib/hddarchive/patches/live-ArchiveHDD.patch b/contrib/hddarchive/patches/live-ArchiveHDD.patch new file mode 100644 index 0000000..d9c053e --- /dev/null +++ b/contrib/hddarchive/patches/live-ArchiveHDD.patch @@ -0,0 +1,487 @@ +diff -Nurb live-0.2.0-org/i18n-generated.h live-0.2.0/i18n-generated.h +--- live-0.2.0-org/i18n-generated.h 2008-04-30 21:43:49.000000000 +0200 ++++ live-0.2.0/i18n-generated.h 2008-10-10 12:03:33.000000000 +0200 +@@ -501,6 +501,41 @@ + "", + #endif + }, ++ { "On archive HDD No.", ++ "Auf Archiv-HDD Nr.", ++ "", ++ "In archivio HDD No.", ++ "", ++ "", ++ "Sur le HDD archive no°", ++ "", ++ "Arkistointi-HDD:llä numero", ++ "", ++ "", ++ "", ++ "", ++ "", ++ "", ++ "", ++#if VDRVERSNUM >= 10302 ++ "", ++#endif ++#if VDRVERSNUM >= 10307 ++ "", ++#endif ++#if VDRVERSNUM >= 10313 ++ "", ++#endif ++#if VDRVERSNUM >= 10316 ++ "", ++#endif ++#if VDRVERSNUM >= 10342 ++ "", ++#endif ++#if VDRVERSNUM >= 10502 ++ "", ++#endif ++ }, + { "Couldn't find channel or no channels available.", + "Kann das Programm nicht finden oder keine vorhanden.", + "", +diff -Nurb live-0.2.0-org/i18n.cpp live-0.2.0/i18n.cpp +--- live-0.2.0-org/i18n.cpp 2007-08-19 21:48:54.000000000 +0200 ++++ live-0.2.0/i18n.cpp 2008-10-10 12:03:33.000000000 +0200 +@@ -3564,7 +3564,7 @@ + { "On archive DVD No.", // English + "Auf Archiv-DVD Nr.", // Deutsch + "", // Slovenski +- "", // Italiano ++ "In archivio DVD No.", // Italiano + "", // Nederlands + "", // Português + "Sur le DVD archive no°", // Français +@@ -3583,6 +3583,28 @@ + "", // Dansk + "", // Czech + }, ++ { "On archive HDD No.", // English ++ "Auf Archiv-HDD Nr.", // Deutsch ++ "", // Slovenski ++ "In archivio HDD No.", // Italiano ++ "", // Nederlands ++ "", // Português ++ "Sur le HDD archive no°", // Français ++ "", // Norsk ++ "Arkistointi-HDD:llä numero", ++ "", // Polski ++ "", // Español ++ "", // Greek ++ "", // Svenska ++ "", // Românã ++ "", // Magyar ++ "", // Català ++ "", // Russian ++ "", // Hrvatski ++ "", // Eesti ++ "", // Dansk ++ "", // Czech ++ }, + { "Starts between", // English + "Beginnt zwischen", // Deutsch + "", // Slovenski +diff -Nurb live-0.2.0-org/po/ca_ES.po live-0.2.0/po/ca_ES.po +--- live-0.2.0-org/po/ca_ES.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/ca_ES.po 2008-10-10 12:03:33.000000000 +0200 +@@ -59,6 +59,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/cs_CZ.po live-0.2.0/po/cs_CZ.po +--- live-0.2.0-org/po/cs_CZ.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/cs_CZ.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/da_DK.po live-0.2.0/po/da_DK.po +--- live-0.2.0-org/po/da_DK.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/da_DK.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/de_DE.po live-0.2.0/po/de_DE.po +--- live-0.2.0-org/po/de_DE.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/de_DE.po 2008-10-10 12:03:33.000000000 +0200 +@@ -59,6 +59,9 @@ + msgid "On archive DVD No." + msgstr "Auf Archiv-DVD Nr." + ++msgid "On archive HDD No." ++msgstr "Auf Archiv-HDD Nr." ++ + msgid "Couldn't find channel or no channels available." + msgstr "Kann das Programm nicht finden oder keine vorhanden." + +diff -Nurb live-0.2.0-org/po/el_GR.po live-0.2.0/po/el_GR.po +--- live-0.2.0-org/po/el_GR.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/el_GR.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/es_ES.po live-0.2.0/po/es_ES.po +--- live-0.2.0-org/po/es_ES.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/es_ES.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/et_EE.po live-0.2.0/po/et_EE.po +--- live-0.2.0-org/po/et_EE.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/et_EE.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/fi_FI.po live-0.2.0/po/fi_FI.po +--- live-0.2.0-org/po/fi_FI.po 2008-04-27 12:49:36.000000000 +0200 ++++ live-0.2.0/po/fi_FI.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "Arkistointi-DVD:llä numero" + ++msgid "On archive HDD No." ++msgstr "Arkistointi-HDD:llä numero" ++ + msgid "Couldn't find channel or no channels available." + msgstr "Kanavaa ei löydy tai yhtään kanavaa ei ole saatavilla." + +diff -Nurb live-0.2.0-org/po/fr_FR.po live-0.2.0/po/fr_FR.po +--- live-0.2.0-org/po/fr_FR.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/fr_FR.po 2008-10-10 12:03:33.000000000 +0200 +@@ -60,6 +60,9 @@ + msgid "On archive DVD No." + msgstr "Sur le DVD archive no°" + ++msgid "On archive HDD No." ++msgstr "Sur le HDD archive noä" ++ + msgid "Couldn't find channel or no channels available." + msgstr "Impossible de trouver la chaîne ou pas de chaînes disponibles." + +diff -Nurb live-0.2.0-org/po/hr_HR.po live-0.2.0/po/hr_HR.po +--- live-0.2.0-org/po/hr_HR.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/hr_HR.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/hu_HU.po live-0.2.0/po/hu_HU.po +--- live-0.2.0-org/po/hu_HU.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/hu_HU.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/it_IT.po live-0.2.0/po/it_IT.po +--- live-0.2.0-org/po/it_IT.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/it_IT.po 2008-10-10 12:03:33.000000000 +0200 +@@ -59,6 +59,9 @@ + msgid "On archive DVD No." + msgstr "In archivio DVD No." + ++msgid "On archive HDD No." ++msgstr "In archivio HDD No." ++ + msgid "Couldn't find channel or no channels available." + msgstr "Impossibile trovare canale o canali disponibili." + +diff -Nurb live-0.2.0-org/po/nl_NL.po live-0.2.0/po/nl_NL.po +--- live-0.2.0-org/po/nl_NL.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/nl_NL.po 2008-10-10 12:03:33.000000000 +0200 +@@ -60,6 +60,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/nn_NO.po live-0.2.0/po/nn_NO.po +--- live-0.2.0-org/po/nn_NO.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/nn_NO.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/pl_PL.po live-0.2.0/po/pl_PL.po +--- live-0.2.0-org/po/pl_PL.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/pl_PL.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/pt_PT.po live-0.2.0/po/pt_PT.po +--- live-0.2.0-org/po/pt_PT.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/pt_PT.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/ro_RO.po live-0.2.0/po/ro_RO.po +--- live-0.2.0-org/po/ro_RO.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/ro_RO.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/ru_RU.po live-0.2.0/po/ru_RU.po +--- live-0.2.0-org/po/ru_RU.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/ru_RU.po 2008-10-10 12:03:33.000000000 +0200 +@@ -57,6 +57,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/sl_SI.po live-0.2.0/po/sl_SI.po +--- live-0.2.0-org/po/sl_SI.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/sl_SI.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/sv_SE.po live-0.2.0/po/sv_SE.po +--- live-0.2.0-org/po/sv_SE.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/sv_SE.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/po/tr_TR.po live-0.2.0/po/tr_TR.po +--- live-0.2.0-org/po/tr_TR.po 2008-04-21 00:35:22.000000000 +0200 ++++ live-0.2.0/po/tr_TR.po 2008-10-10 12:03:33.000000000 +0200 +@@ -58,6 +58,9 @@ + msgid "On archive DVD No." + msgstr "" + ++msgid "On archive HDD No." ++msgstr "" ++ + msgid "Couldn't find channel or no channels available." + msgstr "" + +diff -Nurb live-0.2.0-org/recman.cpp live-0.2.0/recman.cpp +--- live-0.2.0-org/recman.cpp 2008-10-10 12:06:17.000000000 +0200 ++++ live-0.2.0/recman.cpp 2008-10-10 12:09:00.000000000 +0200 +@@ -1,5 +1,4 @@ + #include <unistd.h> +-#include <cstring> + #include <string> + #include <sstream> + #include <fstream> +@@ -13,6 +12,7 @@ + #include "recman.h" + + #define INDEXFILESUFFIX "/index.vdr" ++#define LENGTHFILESUFFIX "/length.vdr" + + using namespace std::tr1; + using namespace std; +@@ -101,24 +101,28 @@ + Recordings.DelByName(name.c_str()); + } + +- bool RecordingsManager::IsArchived(cRecording const * recording) ++ int RecordingsManager::GetArchiveType(cRecording const * recording) + { + string filename = recording->FileName(); + +- string vdrFile = filename + "/001.vdr"; +- if (0 == access(vdrFile.c_str(), R_OK)) +- return false; +- +- filename += "/dvd.vdr"; +- return (0 == access(filename.c_str(), R_OK)); ++ string dvdFile = filename + "/dvd.vdr"; ++ if (0 == access(dvdFile.c_str(), R_OK)) { ++ return 1; ++ } ++ string hddFile = filename + "/hdd.vdr"; ++ if (0 == access(hddFile.c_str(), R_OK)) { ++ return 2; ++ } ++ return 0; + } + +- string const RecordingsManager::GetArchiveId(cRecording const * recording) ++ string const RecordingsManager::GetArchiveId(cRecording const * recording, int archiveType) + { + string filename = recording->FileName(); + +- filename += "/dvd.vdr"; +- ifstream dvd(filename.c_str()); ++ if (archiveType==1) { ++ string dvdFile = filename + "/dvd.vdr"; ++ ifstream dvd(dvdFile.c_str()); + + if (dvd) { + string archiveDisc; +@@ -130,17 +134,35 @@ + } + return archiveDisc; + } ++ } else if(archiveType==2) { ++ string hddFile = filename + "/hdd.vdr"; ++ ifstream hdd(hddFile.c_str()); ++ ++ if (hdd) { ++ string archiveDisc; ++ hdd >> archiveDisc; ++ return archiveDisc; ++ } ++ } + return ""; + } + + string const RecordingsManager::GetArchiveDescr(cRecording const * recording) + { ++ int archiveType; + string archived; +- if (IsArchived(recording)) { ++ archiveType = GetArchiveType(recording); ++ if (archiveType==1) { + archived += " ["; + archived += tr("On archive DVD No."); + archived += ": "; +- archived += GetArchiveId(recording); ++ archived += GetArchiveId(recording, archiveType); ++ archived += "]"; ++ } else if (archiveType==2) { ++ archived += " ["; ++ archived += tr("On archive HDD No."); ++ archived += ": "; ++ archived += GetArchiveId(recording, archiveType); + archived += "]"; + } + return archived; +@@ -266,6 +266,13 @@ + } + delete index; + #endif ++ if (RecLength == 0) { ++ cString lengthFile = cString::sprintf("%s%s", m_recording->FileName(), LENGTHFILESUFFIX); ++ ifstream length(*lengthFile); ++ if(length) ++ length >> RecLength; ++ } ++ + return RecLength; + } + +diff -Nurb live-0.2.0-org/recman.h live-0.2.0/recman.h +--- live-0.2.0-org/recman.h 2008-04-08 19:52:00.000000000 +0200 ++++ live-0.2.0/recman.h 2008-10-10 12:03:33.000000000 +0200 +@@ -78,14 +78,14 @@ + * Determine wether the recording has been archived on + * removable media (e.g. DVD-ROM) + */ +- static bool IsArchived(cRecording const * recording); ++ static int GetArchiveType(cRecording const * recording); + + /** + * Provide an identification of the removable media + * (e.g. DVD-ROM Number or Name) where the recording has + * been archived. + */ +- static std::string const GetArchiveId(cRecording const * recording); ++ static std::string const GetArchiveId(cRecording const * recording, int archiveType); + + static std::string const GetArchiveDescr(cRecording const * recording); + diff --git a/contrib/hddarchive/reccmds/reccmds.custom.conf b/contrib/hddarchive/reccmds/reccmds.custom.conf new file mode 100644 index 0000000..92869ea --- /dev/null +++ b/contrib/hddarchive/reccmds/reccmds.custom.conf @@ -0,0 +1 @@ +Move to Archive-HDD: /usr/share/vdr/bin/vdr-bg.sh /usr/local/bin/vdr_move_to_hdd.sh diff --git a/contrib/hddarchive/reccmds/reccmds.custom.conf.de b/contrib/hddarchive/reccmds/reccmds.custom.conf.de new file mode 100644 index 0000000..2a12f98 --- /dev/null +++ b/contrib/hddarchive/reccmds/reccmds.custom.conf.de @@ -0,0 +1 @@ +Auf Archiv-HDD verschieben: /usr/share/vdr/bin/vdr-bg.sh /usr/local/bin/vdr_move_to_hdd.sh diff --git a/contrib/hddarchive/vdr_move_to_hdd.sh b/contrib/hddarchive/vdr_move_to_hdd.sh new file mode 100644 index 0000000..c50ef28 --- /dev/null +++ b/contrib/hddarchive/vdr_move_to_hdd.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +#LOGFILE=~/vdr_move_to_hdd.log + +#ARCHIVEHDD=~/Archive-HDD +ARCHIVEHDD=/mnt/archive-hdd + +#VDRSETTINGSFILE=~/vdr +VDRSETTINGSFILE=/etc/conf.d/vdr + +source ${VDRSETTINGSFILE} + +HDDMOUNTED=0 + + +#echo "" > ${LOGFILE} + +# Test, if recording has already moved? +if [ -f ${SRC_FULLPATH}/hdd.vdr ]; then + svdrpsend.pl mesg "Recording has already been moved to Archive-HDD!" +# echo "Recording has already been moved to Archive-HDD!" >> ${LOGFILE} + exit 1 +fi + + +# Test, if Archive-HDD can be mounted +if [ ! -f ${ARCHIVEHDD}/hdd.vdr ]; then + mount ${ARCHIVEHDD} + HDDMOUNTED=1 +fi +if [ ! -f ${ARCHIVEHDD}/hdd.vdr ]; then + svdrpsend.pl mesg "Archive-HDD could not be mounted!" +# echo "Archive-HDD could not be mounted!" >> ${LOGFILE} + exit 1 +fi + + +#echo "PARAMETER = $1" >> ${LOGFILE} +#echo "VDRSETTINGSFILE= ${VDRSETTINGSFILE}" >> ${LOGFILE} +#echo "VIDEO = ${VIDEO}" >> ${LOGFILE} +#echo "ARCHIVEHDD = ${ARCHIVEHDD}" >> ${LOGFILE} +#echo "" >> ${LOGFILE} + +VID_FULLPATH="`cd \"$VIDEO\" 2>/dev/null && pwd || echo \"$VIDEO\"`/" +#echo "VID_FULLPATH = ${VID_FULLPATH}" >> ${LOGFILE} + +SRC_FULLPATH="`cd \"$1\" 2>/dev/null && pwd || echo \"${1}\"`/" +#echo "SRC_FULLPATH = ${SRC_FULLPATH}" >> ${LOGFILE} +#echo "" >> ${LOGFILE} + + + +#RELPATH=$(echo ${SRC_FULLPATH} | sed -e "s#$VID_FULLPATH##") +RELPATH=${SRC_FULLPATH#$VID_FULLPATH} +#echo "RELPATH = ${RELPATH}" >> ${LOGFILE} + +MODPATH=$(echo "$RELPATH" | awk ' +BEGIN{ + FS="/"; +} +{ + MODPATH=""; + #printf "0: %s\n", MODPATH; + for (i=1; i<=NF; i++) { + if ((i==NF-2) && (index($i, "%")==1)) { # cutted movie + #printf "replace\n"; + MODPATH=MODPATH "" substr ($i, 2); + } else { + #printf "original\n"; + MODPATH=MODPATH "" $i; + } + if (i<NF) MODPATH=MODPATH "/"; + #printf "%i:%s %s\n", i, $i, MODPATH; + } + printf "%s", MODPATH; +}' ARCHIVEHDD="$ARCHIVEHDD") +#echo "MODPATH = ${MODPATH}" >> ${LOGFILE} + +mkdir -p ${ARCHIVEHDD}/${MODPATH} +for i in ${SRC_FULLPATH}/0??.vdr; do + if [ -e "${i}" ]; then + B=$(basename $i) + svdrpsend.pl mesg "Moving $B..." +# sleep 5 + mv ${i} ${ARCHIVEHDD}/${MODPATH} + fi +done +for i in ${SRC_FULLPATH}/0????.ts; do + if [ -e "${i}" ]; then + B=$(basename $i) + svdrpsend.pl mesg "Moving $B..." +# sleep 5 + mv ${i} ${ARCHIVEHDD}/${MODPATH} + fi +done +mv ${SRC_FULLPATH}/index.vdr ${ARCHIVEHDD}/${MODPATH} +mv ${SRC_FULLPATH}/index ${ARCHIVEHDD}/${MODPATH} +cp ${SRC_FULLPATH}/info.vdr ${ARCHIVEHDD}/${MODPATH} +cp ${SRC_FULLPATH}/info ${ARCHIVEHDD}/${MODPATH} +rm ${SRC_FULLPATH}/resume.vdr +rm ${SRC_FULLPATH}/resume +rm ${SRC_FULLPATH}/marks.vdr +rm ${SRC_FULLPATH}/marks +cp ${ARCHIVEHDD}/hdd.vdr ${SRC_FULLPATH}/ + + +if [ "${HDDMOUNTED}" == "1" ]; then +# svdrpsend.pl mesg "umount." +# sleep 5 + umount ${ARCHIVEHDD} +#else +# svdrpsend.pl mesg "NO umount." +# sleep 5 +fi + +svdrpsend.pl mesg "Successfully moved Recording to Archive-HDD." diff --git a/contrib/rating/README b/contrib/rating/README new file mode 100644 index 0000000..e4da43d --- /dev/null +++ b/contrib/rating/README @@ -0,0 +1,12 @@ +The rating feature of the extrecmenu plugin gives the possibility +to rate recordings. These ratings are shown in the Recordings menu +with up to 5 stars. + + +Installation +============ + +1. Copy ./vdr-rate-recording.sh to Your local file system +2. Edit your reccmds.conf file: add entries to rate a recording. + You may want to use ./reccmds/reccmds.custom.conf as a starting point. + Modify the path to vdr-rate-recording.sh (if neccessary) diff --git a/contrib/rating/reccmds/reccmds.custom.conf b/contrib/rating/reccmds/reccmds.custom.conf new file mode 100644 index 0000000..0555e4d --- /dev/null +++ b/contrib/rating/reccmds/reccmds.custom.conf @@ -0,0 +1,12 @@ +=== Rate Recording === : echo "no function" +-rate with 10: /usr/share/vdr/bin/vdr-rate-recording.sh 10 +-rate with 9: /usr/share/vdr/bin/vdr-rate-recording.sh 9 +-rate with 8: /usr/share/vdr/bin/vdr-rate-recording.sh 8 +-rate with 7: /usr/share/vdr/bin/vdr-rate-recording.sh 7 +-rate with 6: /usr/share/vdr/bin/vdr-rate-recording.sh 6 +-rate with 5: /usr/share/vdr/bin/vdr-rate-recording.sh 5 +-rate with 4: /usr/share/vdr/bin/vdr-rate-recording.sh 4 +-rate with 3: /usr/share/vdr/bin/vdr-rate-recording.sh 3 +-rate with 2: /usr/share/vdr/bin/vdr-rate-recording.sh 2 +-rate with 1: /usr/share/vdr/bin/vdr-rate-recording.sh 1 +-remove rating: /usr/share/vdr/bin/vdr-rate-recording.sh 0 diff --git a/contrib/rating/reccmds/reccmds.custom.conf.de b/contrib/rating/reccmds/reccmds.custom.conf.de new file mode 100644 index 0000000..89c875d --- /dev/null +++ b/contrib/rating/reccmds/reccmds.custom.conf.de @@ -0,0 +1,12 @@ +=== Aufnahme bewerten === : echo "no function" +-bewerte mit 10: /usr/share/vdr/bin/vdr-rate-recording.sh 10 +-bewerte mit 9: /usr/share/vdr/bin/vdr-rate-recording.sh 9 +-bewerte mit 8: /usr/share/vdr/bin/vdr-rate-recording.sh 8 +-bewerte mit 7: /usr/share/vdr/bin/vdr-rate-recording.sh 7 +-bewerte mit 6: /usr/share/vdr/bin/vdr-rate-recording.sh 6 +-bewerte mit 5: /usr/share/vdr/bin/vdr-rate-recording.sh 5 +-bewerte mit 4: /usr/share/vdr/bin/vdr-rate-recording.sh 4 +-bewerte mit 3: /usr/share/vdr/bin/vdr-rate-recording.sh 3 +-bewerte mit 2: /usr/share/vdr/bin/vdr-rate-recording.sh 2 +-bewerte mit 1: /usr/share/vdr/bin/vdr-rate-recording.sh 1 +-entferne Bewertung: /usr/share/vdr/bin/vdr-rate-recording.sh 0 diff --git a/contrib/rating/vdr-rate-recording.sh b/contrib/rating/vdr-rate-recording.sh new file mode 100644 index 0000000..30b43b1 --- /dev/null +++ b/contrib/rating/vdr-rate-recording.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +[ $? -ne 2 ] && echo "Usage: $0 <path to the VDR recording> <rating 0 - 10>" && exit 1 + +rm ${2}/rated.vdr >/dev/null 2>&1 +if [ ! ${1} = "0" ]; then + echo "${1}" > $2/rated.vdr +fi diff --git a/contrib/reclist/README b/contrib/reclist/README new file mode 100644 index 0000000..7f5ae33 --- /dev/null +++ b/contrib/reclist/README @@ -0,0 +1,42 @@ +The reclist is independent of the extrecmenu plugin. +It's nothing else than a set of scripts to create a 'database' of all +recordings. And to create different user defined outputs of this DB. + + +Installation +============ + +1. Copy the include scripts to /usr/local/bin +2. Edit vdr_set_values_for_recording_lists.sh to meet Your needs. + VIDEODIR should contain Your video directory (eg: /video) + RECLISTDIR is the directory, the list will be created in + RECLISTFILE is the filename of the list + All other parameters are values to define the layout of the output +3. Edit Your commands.conf file: + You may want to use ./commands/commands.reclist.conf as a starting point. + Modify the path to vdr_get_recordings.sh and + vdr_generate_recording_list.sh (if neccessary) + + +Explanation of the scripts +-------------------------- +vdr_set_values_for_recording_lists.sh + sets values to generate the list and to generate the user defined outputs +vdr_get_recordings.sh + scans all recordings and calls 'vdr_add_recording.sh' for each recording +vdr_add_recording.sh + calls 'vdr_create_recording_list_entry.awk' to create an entry for each recording +vdr_create_recording_list_entry.awk + does the real work. It extracts the neccessary values out of info or info.vdr + and stores them in the reclist. Currently these values will be extracted: + Title, Genre, Country, Year, Length, Date, Size, Media, Path. +vdr_generate_recording_list.sh + creates the user defined outputs of the list. + usage: vdr_generate_recording_list.sh <type> <what> + where <type> = (title|genre|country|year|length|date|size|media|path) + and <what> = (all|head|tail) + 'all' shows all entries, 'head' shows the first n entries, 'tail' the last n entries + where n id the LINES_PER_PAGE defined in vdr_set_values_for_recording_lists.sh +vdr_crop_output.sh + is just a script for convenience. It can crop a lengthy output to the first/last + LINES_PER_PAGE lines diff --git a/contrib/reclist/commands/commands.reclist.conf b/contrib/reclist/commands/commands.reclist.conf new file mode 100644 index 0000000..bfe7b9b --- /dev/null +++ b/contrib/reclist/commands/commands.reclist.conf @@ -0,0 +1,15 @@ +List of Recordings commands { + generate list of recordings : /usr/share/vdr/bin/vdr-bg.sh /usr/local/bin/vdr_get_recordings.sh + Recordings sorted by title : vdr_generate_recording_list.sh title all + Recordings sorted by genre : vdr_generate_recording_list.sh genre all + Recordings sorted by country : vdr_generate_recording_list.sh country all + Recordings sorted by year : vdr_generate_recording_list.sh year all + Recordings sorted by length : vdr_generate_recording_list.sh length all + Recordings sorted by media : vdr_generate_recording_list.sh media all + Recordings sorted by path : vdr_generate_recording_list.sh path all + Recordings sorted by size : vdr_generate_recording_list.sh size tail + '' (w/o Tatort+Kochen) : vdr_generate_recording_list.sh size all | grep -v "Kochen/" | grep -v "Tatort/" | vdr_crop_output.sh tail + '' (w/o Tatort,Kochen+Musik) : vdr_generate_recording_list.sh size all | grep -v "Kochen/" | grep -v "Tatort/" | grep -v "Musik/" | vdr_crop_output.sh tail + '' (only Movies) : vdr_generate_recording_list.sh size all | grep "Spielfilme/" | vdr_crop_output.sh tail + show newest Recordings : vdr_generate_recording_list.sh date tail +} diff --git a/contrib/reclist/commands/commands.reclist.conf.de b/contrib/reclist/commands/commands.reclist.conf.de new file mode 100644 index 0000000..fc2b0b6 --- /dev/null +++ b/contrib/reclist/commands/commands.reclist.conf.de @@ -0,0 +1,15 @@ +Liste der Aufnahmen { + generiere Liste der Aufnahmen : /usr/share/vdr/bin/vdr-bg.sh /usr/local/bin/vdr_get_recordings.sh + Aufnahmen sortiert nach Titel : vdr_generate_recording_list.sh title all + Aufnahmen sortiert nach Genre : vdr_generate_recording_list.sh genre all + Aufnahmen sortiert nach Land : vdr_generate_recording_list.sh country all + Aufnahmen sortiert nach Jahr : vdr_generate_recording_list.sh year all + Aufnahmen sortiert nach Länge : vdr_generate_recording_list.sh length all + Aufnahmen sortiert nach Medium : vdr_generate_recording_list.sh media all + Aufnahmen sortiert nach Verzeichnis : vdr_generate_recording_list.sh path all + Aufnahmen sortiert nach Größe : vdr_generate_recording_list.sh size tail + '' (ohne Tatort+Kochen) : vdr_generate_recording_list.sh size all | grep -v "Kochen/" | grep -v "Tatort/" | vdr_crop_output.sh tail + '' (ohne Tatort,Kochen+Musik) : vdr_generate_recording_list.sh size all | grep -v "Kochen/" | grep -v "Tatort/" | grep -v "Musik/" | vdr_crop_output.sh tail + '' (nur Spielfilme) : vdr_generate_recording_list.sh size all | grep "Spielfilme/" | vdr_crop_output.sh tail + neueste Aufnahmen anzeigen : vdr_generate_recording_list.sh date tail +} diff --git a/contrib/reclist/vdr_add_recording.sh b/contrib/reclist/vdr_add_recording.sh new file mode 100644 index 0000000..1ca4b42 --- /dev/null +++ b/contrib/reclist/vdr_add_recording.sh @@ -0,0 +1,13 @@ +#!/bin/sh + + +echo "${1}" | \ + awk -f /usr/local/bin/vdr_create_recording_list_entry.awk basedir="${VIDEODIR}" Seperator="${SEPERATOR}" \ + LenTitle="${LEN_TITLE}" \ + LenGenre="${LEN_GENRE}" \ + LenCountry="${LEN_COUNTRY}" \ + LenYear="${LEN_YEAR}" \ + LenLength="${LEN_LENGTH}" \ + LenDate="${LEN_DATE}" \ + LenSize="${LEN_SIZE}" \ + LenMedia="${LEN_MEDIA}" >> ${RECLISTDIR}/${RECLISTFILE}
\ No newline at end of file diff --git a/contrib/reclist/vdr_create_recording_list_entry.awk b/contrib/reclist/vdr_create_recording_list_entry.awk new file mode 100644 index 0000000..ba6fe60 --- /dev/null +++ b/contrib/reclist/vdr_create_recording_list_entry.awk @@ -0,0 +1,302 @@ +BEGIN { + debug=4; + BLANK=" "; + TAG_RECORDING=".rec"; + + + # set default values if not defined + if (basedir == "") {basedir="/var/vdr/data/_video/";} + if (Seperator == "") {Seperator="|";} + if (LenTitle == "") {LenTitle=50;} + if (LenGenre == "") {LenGenre=20;} + if (LenCountry == "") {LenCountry=5;} + if (LenYear == "") {LenYear=4;} + if (LenLength == "") {LenLength=4;} + if (LenDate == "") {LenDate=10;} + if (LenSize == "") {LenSize=9;} + if (LenMedia == "") {LenMedia=8;} +} + +{ + InputParam=$0 + InfoFile=InputParam; + if (debug>0) printf("InfoFile :%s\n", InfoFile) > "/dev/stderr"; + InfoFileBasename=""; + + Title=""; + SubTitle=""; + Genre=""; + Country=""; + Year=""; + Length=""; + Date=""; + Size=""; + Media="Internal"; + Path=""; + + Len=""; + Nr="----"; + FullDir=""; + + n = split (InfoFile, p, "/"); + if (debug>2) { + for (i=1; i<=n; i++) { + printf("p[%d] :%s\n", i, p[i]) > "/dev/stderr"; + } + } + if (n>2) { + Dir = p[1]; + FullDir = p[1]; + if (debug>2) printf("FullDir1 :%s\n", FullDir) > "/dev/stderr"; + InfoFileBasename = p[n]; + for (i=2; i<=n-1; i++) { + if (i<=n-2) { + Dir = Dir "/" p[i]; + if (debug>2) printf("Dir 2 :%s\n", Dir) > "/dev/stderr"; + } else { + Date = substr(p[i],1, 10); + if (debug>2) printf("Date :%s\n", Date) > "/dev/stderr"; + } + FullDir = FullDir "/" p[i]; + if (debug>2) printf("FullDir2 :%s\n", FullDir) > "/dev/stderr"; + } + if (index(Dir, basedir)==1) { + Path = substr(Dir, length(basedir)+1); + if (debug>2) printf("Path :%s\n", Path) > "/dev/stderr"; + } + } + if (FullDir != "") { + EscDir = FullDir; + gsub(/\"/, "\\\"", EscDir); + if (debug>0) printf("EscDir :%s\n", EscDir) > "/dev/stderr"; + getsize = "du \""EscDir"\""; + if ((getsize | getline duRes) > 0) { + n = split(duRes, s, " "); + Size = s[1]; + if (debug>1) printf("Size :%s\n", Size) > "/dev/stderr"; + close(getsize) + } + } + + + # check, if recording is valid (not deleted) + if (match(EscDir, /rec$/)) { + + # check for length file + LenFile=InputParam; + sub( InfoFileBasename, "length.vdr", LenFile ); + if (debug>0) printf("Looking for length...\n") > "/dev/stderr"; + if (debug>1) printf("LenFile1 :%s\n", LenFile) > "/dev/stderr"; + getline Len < LenFile; + if (debug>1) printf("Len 1 :%s\n", Len) > "/dev/stderr"; + if (Len != "") { + Length = sprintf("%d:%02d", Len/60, Len%60); + } else { + IndexFile=InputParam; + sub( InfoFileBasename, "index.vdr", IndexFile ); + gsub(/\"/, "\\\"", IndexFile); + if (debug>1) printf("IndexFile:%s\n", IndexFile) > "/dev/stderr"; + $1=""; + "stat -L -c %s \""IndexFile"\" 2>/dev/null" | getline; + if (debug>2) printf("Len 2 :%s\t%s\n", $1, IndexFile) > "/dev/stderr"; + if ($1 != "") { + Len=($1/12000); + if (debug>1) printf("Len 3 :%s\n", Len) > "/dev/stderr"; + Length = sprintf("%d:%02d", Len/60, Len%60); + } + } + + + # check for archive DVD + ExtFile=InputParam; + sub( InfoFileBasename, "dvd.vdr", ExtFile ); + if (debug>0) printf("Looking for archive DVD...\n") > "/dev/stderr"; + if (debug>1) printf("ExtFile1 :%s\n", ExtFile) > "/dev/stderr"; + getline Nr < ExtFile; + if (debug>1) printf("Nr 1 :%s\n", Nr) > "/dev/stderr"; + if (Nr != "----") { + Media="DVD "Nr; + } else { + # check for archive HDD + ExtFile=InputParam; + sub( InfoFileBasename, "hdd.vdr", ExtFile ); + if (debug>0) printf("Looking for archive HDD...\n") > "/dev/stderr"; + if (debug>1) printf("ExtFile2 :%s\n", ExtFile) > "/dev/stderr"; + getline Nr < ExtFile; + if (debug>1) printf("Nr 2 :%s\n", Nr) > "/dev/stderr"; + if (Nr != "----") { + Media="HDD "Nr; + } + } + + + do { + rc=getline line < InfoFile; + if ( rc>0 ) { + if ( substr(line, 1, 1)=="T" ) { + Title=substr(line, 3); + } else if ( substr(line, 1, 1)=="S" ) { + SubTitle=substr(line, 3); + } else if ( substr(line, 1, 1)=="D" ) { + + # D Horrorfilm, USA 1999||... + line=substr(line, 3); + # Horrorfilm, USA 1999||... + if (debug>2) printf("line3:%s\n", line) > "/dev/stderr"; + + if (debug>0) printf("Looking for values...\n") > "/dev/stderr"; + + # get Genre from tag (...|Genre: xxx|...) + Genre2=line; + if (debug>0) printf("Looking for Genre... ( tag '...|Genre: xxx|...' )\n") > "/dev/stderr"; + startIndex=index(Genre2, "|Genre: "); + if (startIndex>0) { + Genre3=substr(Genre2, startIndex+8); + if (debug>2) printf("c3 :%s\n", Genre3) > "/dev/stderr"; + stopIndex=index(Genre3, "|"); + if (stopIndex>1) { + Genre4=substr(Genre3, 0, stopIndex-1); + Genre=Genre4; + if (debug>1) printf("Found Genre: %s\n", Genre) > "/dev/stderr"; + } + } + + # get Year from tag (...|Year: xxx|...) + Year2=line; + if (debug>0) printf("Looking for Year... ( tag '...|Year: xxx|...' )\n") > "/dev/stderr"; + startIndex=index(Year2, "|Year: "); + if (startIndex>0) { + Year3=substr(Year2, startIndex+7); + if (debug>2) printf("y3 :%s\n", Year3) > "/dev/stderr"; + stopIndex=index(Year3, "|"); + if (stopIndex>1) { + Year4=substr(Year3, 0, stopIndex-1); + Year=Year4; + if (debug>1) printf("Found Year: %s\n", Year) > "/dev/stderr"; + } + } + + # get Country (and Year if not already filled) from tag (...|Land: XXX YYYY|...) + if(Country=="" || Year=="") { + Country2=line; + if (debug>0) printf("Looking for Country or Year... ( tag '...|Land: XXX YYYY|...' )\n") > "/dev/stderr"; + startIndex=index(Country2, "|Land: "); + if (startIndex>0) { + Country3=substr(Country2, startIndex+7); # USA 1999|... + if (debug>2) printf("c3 :%s\n", Country3) > "/dev/stderr"; + stopIndex=index(Country3, "|"); + if (stopIndex>1) { + Country4=substr(Country3, 0, stopIndex-1); # USA 1999 + if (debug>2) printf("c4 :%s\n", Country4) > "/dev/stderr"; + gsub(/^ +/, "", Country4); + gsub(/ +$/, "", Country4); + gsub(/ +/, " ", Country4); # USA 1999 + if (debug>2) printf("c5 :%s\n", Country4) > "/dev/stderr"; + n = split (Country4, F2, / *[, ] */ ); # split to 'USA' '1999' + for (i=1; i<=n; i++) { + if (match (F2[i], /^[0-9]+$/)) { # only digits + if (Year=="") { + Year = F2[i]; + if (debug>1) printf("Found Year: %s\n", Year) > "/dev/stderr"; + } + } else { + if (match (F2[i], /^[A-Z/]+$/)) { # only UPPERCASE + if (Country=="") { + Country = F2[i]; + if (debug>1) printf("Found Country: %s\n", Country) > "/dev/stderr"; + } + } + } + } + } + } + } + + + # if not filled already, get Genre, Country and Year from the beginning of the line (Horrorfilm, USA 1999||...) + if(Genre=="" || Country=="" || Year=="") { + if (debug>0) printf("Looking for Genre, Country or Year... ( tag 'D Horrorfilm, USA 1999||...' )\n") > "/dev/stderr"; + n = split (line, F1, "|"); + # F1[1]: Horrorfilm, USA 1999 + gsub(/^ +/, "", F1[1]); + gsub(/ +$/, "", F1[1]); + if (debug>2) printf("b1: F1[1]:%s\n", F1[1]) > "/dev/stderr"; + n = split (F1[1], F2, / *[, ] */ ); # split to 'Horrorfilm' 'USA' '1999' + for (i=1; i<=n; i++) { + if (debug>2) printf("b2: F2[%d]:%s\n", i, F2[i]) > "/dev/stderr"; + if (match (F2[i], /^[0-9]+$/)) { # only digits + if (Year=="") { + Year = F2[i]; + if (debug>1) printf("Found Year: %s\n", Year) > "/dev/stderr"; + } + } else { + if (match (F2[i], /^[A-Z/]+$/)) { # only UPPERCASE + if (Country=="") { + Country = F2[i]; + if (debug>1) printf("Found Country: %s\n", Country) > "/dev/stderr"; + } + } else { + if (Genre=="") { + Genre = F2[i]; + if (debug>1) printf("Found Genre: %s\n", Genre) > "/dev/stderr"; + } + } + } + } + } + + } else { + if (debug>2) printf("l :%s\n", line) > "/dev/stderr"; + } + } + } while (rc>0); +# close("/dev/stderr"); + + if (debug>0) { + printf("Title :%s\n", Title) > "/dev/stderr"; + printf("SubTitle :%s\n", SubTitle) > "/dev/stderr"; + printf("Genre :%s\n", Genre) > "/dev/stderr"; + printf("Country :%s\n", Country) > "/dev/stderr"; + printf("Year :%s\n", Year) > "/dev/stderr"; + printf("Length :%s\n", Length) > "/dev/stderr"; + printf("Date :%s\n", Date) > "/dev/stderr"; + printf("Size :%s\n", Size) > "/dev/stderr"; + printf("Media :%s\n", Media) > "/dev/stderr"; + printf("Path :%s\n\n\n", Path) > "/dev/stderr"; + } + + if (SubTitle != "") { + Title = Title": "SubTitle; + } + if (length(Title)>LenTitle) { Title = substr(Title, 1, LenTitle) }; + printf("%-"LenTitle"s%s", Title, Seperator); + + if (length(Genre)>LenGenre) { Genre = substr(Genre, 1, LenGenre) }; + printf("%-"LenGenre"s%s", Genre, Seperator); + + if (length(Media)>LenCountry) { Country = substr(Country, 1, LenCountry) }; + printf("%-"LenCountry"s%s", Country, Seperator); + + if (length(Year)>LenYear) { Year = substr(Year, length(Year)-LenYear+1, LenYear) }; + printf("%"LenYear"s%s", Year, Seperator); + + if (length(Media)>LenLength) { Length = substr(Length, length(Length)-LenLength+1, LenLength) }; + printf("%-"LenLength"s%s", Length, Seperator); + + if (length(Date)>LenDate) { Date = substr(Date, length(Date)-LenDate+1, LenDate) }; + printf("%"LenDate"s%s", Date, Seperator); + + if (length(Size)>LenSize) { Size = substr(Size, length(Size)-LenSize+1, LenSize) }; + printf("%"LenSize"s%s", Size, Seperator); + + if (length(Media)>LenMedia) { Media = substr(Media, length(Media)-LenMedia+1, LenMedia) }; + printf("%-"LenMedia"s%s", Media, Seperator); + + printf("%s\n", Path); + } else { + if (debug>1) printf("No regular recording. Ignoring.\n") > "/dev/stderr"; + } +} + +END { +}
\ No newline at end of file diff --git a/contrib/reclist/vdr_crop_output.sh b/contrib/reclist/vdr_crop_output.sh new file mode 100644 index 0000000..80df4f3 --- /dev/null +++ b/contrib/reclist/vdr_crop_output.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +PRGNAME=$(basename $0) + +usage() { + echo "usage: ${PRGNAME} (all|head|tail)" +} + +what=${1} +if [[ -z ${what} ]]; then + usage + exit +fi + + + +# set values for the positions of each column and the sortpositions +. vdr_set_values_for_recording_lists.sh + + + +# crop vertically / lines +if [ "$what" == "head" ] ; then + LINEFILTER=" head -n ${LINES_PER_PAGE} |" +elif [ "$what" == "tail" ] ; then + LINEFILTER=" tail -n ${LINES_PER_PAGE} |" +else + LINEFILTER="" +fi + + +COMMAND="cat /dev/stdin | ${LINEFILTER} cut -b 1-${CHARS_PER_LINE}" +#echo "cmd: ${COMMAND}" +eval "${COMMAND}" diff --git a/contrib/reclist/vdr_generate_recording_list.sh b/contrib/reclist/vdr_generate_recording_list.sh new file mode 100644 index 0000000..f49efa5 --- /dev/null +++ b/contrib/reclist/vdr_generate_recording_list.sh @@ -0,0 +1,194 @@ +#!/bin/bash + +usage() { + echo "usage: ${PRGNAME} <type> <what>" + echo " where <type> = (title|genre|country|year|length|date|size|media|path)" + echo " and <what> = (all|head|tail)" +} + +PRGNAME=$(basename $0) +type=${1} +what=${2} + +if [[ -z ${type} ]]; then + usage + exit +fi +if [[ -z ${what} ]]; then + usage + exit +fi + + + +# set values for the column length +. vdr_set_values_for_recording_lists.sh + + + +# crop vertically / lines per page +if [ "$what" == "head" ] ; then + LINEFILTER=" head -n ${LINES_PER_PAGE} |" +elif [ "$what" == "tail" ] ; then + LINEFILTER=" tail -n ${LINES_PER_PAGE} |" +else + LINEFILTER="" +fi + + + +if [ "$type" == "title" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k 1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$1; l1=32; \ + c2=\$2; l2=10; \ + c3=\$3; l3=3; \ + c4=\$4; l4=4; \ + c5=\$5; l5=4; \ + c6=\$8; l6=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "genre" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k2,2 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$2; l1=20; \ + c2=\$1; l2=22; \ + c3=\$3; l3=3; \ + c4=\$4; l4=4; \ + c5=\$5; l5=4; \ + c6=\$8; l6=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "country" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k3,3 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$3; l1=5; \ + c2=\$1; l2=30; \ + c3=\$2; l3=10; \ + c4=\$4; l4=4; \ + c5=\$5; l5=4; \ + c6=\$8; l6=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "year" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -k4,4 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$4; l1=4; \ + c2=\$1; l2=32; \ + c3=\$2; l3=10; \ + c4=\$3; l4=3; \ + c5=\$5; l5=4; \ + c6=\$8; l6=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "length" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k5,5 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$5; l1=4; \ + c2=\$1; l2=32; \ + c3=\$2; l3=10; \ + c4=\$3; l4=3; \ + c5=\$4; l5=4; \ + c6=\$8; l6=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "date" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k6,6 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$6; l1=10; \ + c2=\$1; l2=22; \ + c3=\$2; l3=9; \ + c4=\$3; l4=3; \ + c5=\$4; l5=4; \ + c6=\$5; l6=4; \ + c7=\$8; l7=1; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6), \ + l7, substr(c7,1,l7) ); \ + }'" + +elif [ "$type" == "size" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -n -k7,7 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$7; l1=9; \ + c2=\$9; l2=49; \ + printf (\"%-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2) ); \ + }'" + +elif [ "$type" == "media" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k8,8 -k1,1 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$8; l1=8; \ + c2=\$1; l2=25; \ + c3=\$2; l3=10; \ + c4=\$3; l4=3; \ + c5=\$4; l5=4; \ + c6=\$5; l6=4; \ + printf (\"%-*s %-*s %-*s %-*s %-*s %-*s\n\", \ + l1, substr(c1,1,l1), \ + l2, substr(c2,1,l2), \ + l3, substr(c3,1,l3), \ + l4, substr(c4,1,l4), \ + l5, substr(c5,1,l5), \ + l6, substr(c6,1,l6) ); \ + }'" + +elif [ "$type" == "path" ] ; then + COMMAND="cat ${RECLISTDIR}/${RECLISTFILE} | sort -t'|' -d -b -f -k9,9 | ${LINEFILTER} awk ' \ + BEGIN{FS=\"|\"} { \ + c1=\$9; l1=59; \ + printf (\"%-*s\n\", \ + l1, substr(c1,1,l1) ); \ + }'" + +fi + + +# crop horizontally / chars per line +COMMAND="${COMMAND} | cut -b 1-${CHARS_PER_LINE}" + + +#echo "cmd: ${COMMAND}" +eval "${COMMAND}" diff --git a/contrib/reclist/vdr_get_recordings.sh b/contrib/reclist/vdr_get_recordings.sh new file mode 100644 index 0000000..7e5a5ba --- /dev/null +++ b/contrib/reclist/vdr_get_recordings.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# set values for the length of each column +. vdr_set_values_for_recording_lists.sh + +#echo "LEN_TITLE : ${LEN_TITLE}" +#echo "LEN_GENRE : ${LEN_GENRE}" +#echo "LEN_COUNTRY : ${LEN_COUNTRY}" +#echo "LEN_YEAR : ${LEN_YEAR}" +#echo "LEN_LENGTH : ${LEN_LENGTH}" +#echo "LEN_DATE : ${LEN_DATE}" +#echo "LEN_SIZE : ${LEN_SIZE}" +#echo "LEN_MEDIA : ${LEN_MEDIA}" +#echo "LEN_PATH : ${LEN_PATH}" + +#echo "VIDEODIR : ${VIDEODIR}" + +# find the info.vdr files and let awk create a recording list entry +rm ${RECLISTDIR}/${RECLISTFILE} 2>/dev/null + +find ${VIDEODIR} -name 'info.vdr' -exec vdr_add_recording.sh \{\} \; +find ${VIDEODIR} -name 'info' -exec vdr_add_recording.sh \{\} \; + +#find ${VIDEODIR} -name info.vdr -exec echo "{}" \; | \ +# awk -f /usr/local/bin/vdr_create_recording_list_entry.awk basedir="${VIDEODIR}" Seperator="${SEPERATOR}" \ +# LenTitle="${LEN_TITLE}" \ +# LenGenre="${LEN_GENRE}" \ +# LenCountry="${LEN_COUNTRY}" \ +# LenYear="${LEN_YEAR}" \ +# LenLength="${LEN_LENGTH}" \ +# LenDate="${LEN_DATE}" \ +# LenSize="${LEN_SIZE}" \ +# LenMedia="${LEN_MEDIA}" >> ${RECLISTDIR}/${RECLISTFILE}
\ No newline at end of file diff --git a/contrib/reclist/vdr_set_values_for_recording_lists.sh b/contrib/reclist/vdr_set_values_for_recording_lists.sh new file mode 100644 index 0000000..0a23d74 --- /dev/null +++ b/contrib/reclist/vdr_set_values_for_recording_lists.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +source /etc/conf.d/vdr +export VIDEODIR="${VIDEO}/" +export RECLISTDIR="$(dirname ${EPGFILE})/" +#export RECLISTDIR="/root/t/" +export RECLISTFILE="vdr_recordings.lst" + +PAGE_WIDTH=1139 +PAGE_HEIGHT=395 +FONTFIXSIZE=$[$(grep "FontFixSize " /etc/vdr/setup.conf | awk 'BEGIN{FS="="}{print $2}')] + +#export CHARS_PER_LINE=$[${PAGE_WIDTH}/(${FONTFIXSIZE}+1)] +export CHARS_PER_LINE=59 +#echo "CHARS_PER_LINE: ${CHARS_PER_LINE}" +#export LINES_PER_PAGE=$[${PAGE_HEIGHT}/${FONTFIXSIZE}] +export LINES_PER_PAGE=21 +#echo "LINES_PER_PAGE: ${LINES_PER_PAGE}" + + +export SEPERATOR="|" + + +export LEN_TITLE=50 +export LEN_GENRE=20 +export LEN_COUNTRY=8 +export LEN_YEAR=4 +export LEN_LENGTH=4 +export LEN_DATE=10 +export LEN_SIZE=9 +export LEN_MEDIA=8 |