git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Pfeiffer <coding _ lirion.net> 2014-08-09 21:34:33 +0200
committerHarald Pfeiffer <coding _ lirion.net> 2014-08-09 21:34:33 +0200
commit93e081f5c47aaf396f37245dd490bcad03b64477 (patch)
tree54a4ba1cc5bac7a076720f5f65dc259b408cc80d
parenta3c96046e7dda5d18c0bfdf07df9952b7ecf9670 (diff)
downloadmp3dir2html-93e081f5c47aaf396f37245dd490bcad03b64477.tar.bz2
starting with functions
-rwxr-xr-xbin/mp3dirlist25
1 files changed, 19 insertions, 6 deletions
diff --git a/bin/mp3dirlist b/bin/mp3dirlist
index 4bba771..46c0653 100755
--- a/bin/mp3dirlist
+++ b/bin/mp3dirlist
@@ -6,21 +6,34 @@ DIRLISTHEAD="/etc/mp3dir2html/head.php"
# Regular expression that is to be excluded in the final listing
DIRLISTEX='^Susperia|^B.*hse.*nkelz'
+
+# CORE SCRIPT FROM HERE. DON'T FIDDLE IF YOU DON'T KNOW WHAT YOU'RE DOING.
+
if [ "$1" == "" ]; then
SDIR="*"
else
SDIR="$1 $2 $3 $4 $5 $6 $7 $8"
fi
-exiftool -ext .mp3 -ext .MP3 -ext .wma -ext .WMA -ext .ogg -ext .OGG -lang en -Artist -Title -Album -Year -Track -t -r $SDIR | grep -v 'files read' |\
- sed 's/========.*/========/g' |\
- sed 's/\t$/\t" "/g' |\
- grep -v 'directories scanned' |\
- tr '\n' '\t' | sed 's/========/\n========/g;s/========\t/========/g' |\
+function m3l_rm_verb {
+ #As -q nukes away too much, we have to omit that and remove status stuff here:
+ grep -v 'directories scanned' | grep -v 'files read'
+}
+
+function m3l_prep_table {
+ #Let's create a tab separated table with empty values where we have none but need at least an empty one.
+ # (Besides, this kind of rhymes.)
+ sed 's/========.*/====/g' | sed 's/\t$/\t" "/g' | tr '\n' '\t' |\
+ sed 's/====/\n====/g;s/====\t/====/g'
+}
+
+exiftool -ext .mp3 -ext .MP3 -ext .wma -ext .WMA -ext .ogg -ext .OGG -lang en -Artist -Title -Album -Year -Track -t -r $SDIR |\
+ m3l_rm_verb |\
+ m3l_prep_table |\
sed 's/Artist\t//;s/Title\t//;s/Album\t//;s/\(.*\)Year\t/\1/;s/\(.*\)Track\t/\1/' |\
sed 's/\[ \t0-9\]*image files read//g' |\
uniq |\
- sed 's/========//g' |\
+ sed 's/====//g' |\
sed 's/\ &\ /\ \&amp\;\ /g' |\
tr -s '\n' |\
sed 's/\t0\t/\t"0"\t/g' |\