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/reclist | |
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/reclist')
-rw-r--r-- | contrib/reclist/README | 42 | ||||
-rw-r--r-- | contrib/reclist/commands/commands.reclist.conf | 15 | ||||
-rw-r--r-- | contrib/reclist/commands/commands.reclist.conf.de | 15 | ||||
-rw-r--r-- | contrib/reclist/vdr_add_recording.sh | 13 | ||||
-rw-r--r-- | contrib/reclist/vdr_create_recording_list_entry.awk | 302 | ||||
-rw-r--r-- | contrib/reclist/vdr_crop_output.sh | 34 | ||||
-rw-r--r-- | contrib/reclist/vdr_generate_recording_list.sh | 194 | ||||
-rw-r--r-- | contrib/reclist/vdr_get_recordings.sh | 33 | ||||
-rw-r--r-- | contrib/reclist/vdr_set_values_for_recording_lists.sh | 31 |
9 files changed, 679 insertions, 0 deletions
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 |