summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Maass <mase@mase1.setho.org>2013-10-21 18:24:18 +0200
committerThomas Maass <mase@mase1.setho.org>2013-10-21 18:24:18 +0200
commit06054c88a217d65b32a3bd53f8032eb772d3aed1 (patch)
tree31111246f6e1a226aa6b02e300182772122962cc
parent526f69027750591f7196e0c3bd311936dc2610c5 (diff)
downloadvdr-plugin-hddarchive-06054c88a217d65b32a3bd53f8032eb772d3aed1.tar.gz
vdr-plugin-hddarchive-06054c88a217d65b32a3bd53f8032eb772d3aed1.tar.bz2
Added shellscript to archive an recording.
Updated README.
-rw-r--r--README26
-rw-r--r--vdr_move_to_hdd.sh95
2 files changed, 118 insertions, 3 deletions
diff --git a/README b/README
index ae2cb39..b5529cc 100644
--- a/README
+++ b/README
@@ -2,14 +2,14 @@ This is a "plugin" for the Video Disk Recorder (VDR).
Written by: Thomas Maass <mase@setho.org>
-Project's homepage: URL
+Project's homepage: http://projects.vdr-developer.org/projects/plg-hddarchive
-Latest version available at: URL
+Latest version available at: http://projects.vdr-developer.org/projects/plg-hddarchive
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+any later version.
See the file COPYING for more information.
Requirements
@@ -19,3 +19,23 @@ Requirements
Description:
This plugin brings the archive-hdd functionality to VDR.
+Install and start it like any other plugin.
+The optional patch for VDR integrates the archive functionalities into
+its original recordings menu.
+There is also a patch for Skinnopacity to display an archive symbol.
+The symbol isn't part of this patch. Just use an 48x48px image from your
+desktop environment and copy it to skinnopacity/icons/skinIcons/archive.png.
+
+The script vdr_move_to_hdd.sh can be used with the reccmds.conf to archive
+a recording. Change the mountpoint inside and use it with vdr-bg.sh or at:
+
+Archive?: /usr/local/bin/vdr-bg.sh /usr/local/bin/vdr_move_to_hdd.sh
+
+Make sure, that the vdr user has permissions to mount the archive-disk. Setup
+/etc/fstab like this:
+
+/dev/sdb1 /media/archive-hdd auto defaults,user,noauto 0 0
+
+To create an archive-disk, just format it and create a text file named "hdd"
+in its root. Write the archive-id in this file (8 characters max. ). This
+id is used to identify the archive-disk, so choose a unique one.
diff --git a/vdr_move_to_hdd.sh b/vdr_move_to_hdd.sh
new file mode 100644
index 0000000..3fd2e0d
--- /dev/null
+++ b/vdr_move_to_hdd.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+ARCHIVEHDD=/media/archive-hdd
+
+HDDMOUNTED=0
+
+VID_FULLPATH="`cd \"$VIDEO\" 2>/dev/null && pwd || echo \"$VIDEO\"`/"
+
+SRC_FULLPATH="`cd \"$1\" 2>/dev/null && pwd || echo \"${1}\"`/"
+
+VIDPATH="`cd \"$1\" && cd \"..\" 2>/dev/null && pwd || echo \"${1}\"`/"
+
+PART1=${VIDPATH%*/}
+PART1=${PART1##*/}
+
+PART2=${SRC_FULLPATH%*/}
+PART2=${PART2##*/}
+
+MOVIEFOLDER=$PART1"/"$PART2"/"
+
+# Test, if recording has already moved?
+if [ -f ${SRC_FULLPATH}/hdd.vdr ]; then
+ svdrpsend mesg "Recording has already been moved to Archive-HDD!"
+ 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 mesg "Archive-HDD could not be mounted!"
+ exit 1
+fi
+
+# Test if there is enough disk space on Archive-HDD
+SIZE_SRC="`du $SRC_FULLPATH | cut -f 1`"
+SIZE_DEST="`df -Pk /media/archive-hdd | tail -n 1 | tr -s ' ' | cut -d' ' -f 4`"
+
+if [ $SIZE_DEST -lt $SIZE_SRC ]; then
+ svdrpsend mesg "Not enough space on Archive-HDD!"
+ umount ${ARCHIVEHDD}
+ exit 1
+fi
+
+MODMOVIEFOLDER=$(echo "$MOVIEFOLDER" | awk '
+BEGIN{
+ FS="/";
+}
+{
+ MODMOVIEFOLDER="";
+ for (i=1; i<=NF; i++) {
+ if ((i==NF-2) && (index($i, "%")==1)) { # cutted movie
+ MODMOVIEFOLDER=MODMOVIEFOLDER "" substr ($i, 2);
+ } else {
+ MODMOVIEFOLDER=MODMOVIEFOLDER "" $i;
+ }
+ if (i<NF) MODMOVIEFOLDER=MODMOVIEFOLDER "/";
+ }
+ printf "%s", MODMOVIEFOLDER;
+}' ARCHIVEHDD="$ARCHIVEHDD")
+
+mkdir -p ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+for i in ${SRC_FULLPATH}/0??.vdr; do
+ if [ -e "${i}" ]; then
+ B=$(basename $i)
+ svdrpsend mesg "Moving $B..."
+ mv ${i} ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+ fi
+done
+for i in ${SRC_FULLPATH}/0????.ts; do
+ if [ -e "${i}" ]; then
+ B=$(basename $i)
+ svdrpsend mesg "Moving $B..."
+ mv ${i} ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+ fi
+done
+cp ${SRC_FULLPATH}/index.vdr ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+cp ${SRC_FULLPATH}/index ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+cp ${SRC_FULLPATH}/info.vdr ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+cp ${SRC_FULLPATH}/info ${ARCHIVEHDD}/${MODMOVIEFOLDER}
+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
+ umount ${ARCHIVEHDD}
+fi
+
+svdrpsend mesg "Successfully moved Recording to Archive-HDD."