diff options
Diffstat (limited to 'contrib/hddarchive')
-rw-r--r-- | contrib/hddarchive/README | 28 | ||||
-rw-r--r-- | contrib/hddarchive/hddarchive.conf | 17 | ||||
-rw-r--r-- | contrib/hddarchive/patches/live-ArchiveHDD.patch | 487 | ||||
-rw-r--r-- | contrib/hddarchive/reccmds/reccmds.custom.conf | 1 | ||||
-rw-r--r-- | contrib/hddarchive/reccmds/reccmds.custom.conf.de | 1 | ||||
-rw-r--r-- | contrib/hddarchive/vdr_move_to_hdd.sh | 116 |
6 files changed, 650 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." |