diff --git a/atom b/atom index 5c35308..a3f86b7 100755 --- a/atom +++ b/atom @@ -616,7 +616,7 @@ do rest=${line#*::AtOM:SQL:Sep::} filename=${rest%%::AtOM:SQL:Sep::*} oldfilename=${rest#*::AtOM:SQL:Sep::} - if [[ $oldfilename != $filename ]] && [ -f "$oldfilename" ] + if [[ $oldfilename != "$filename" ]] && [ -f "$oldfilename" ] then rm -f "$oldfilename" fi diff --git a/lib/encode/encodeFile::mp3 b/lib/encode/encodeFile::mp3 index c958f2a..1496570 100644 --- a/lib/encode/encodeFile::mp3 +++ b/lib/encode/encodeFile::mp3 @@ -51,7 +51,12 @@ encodeFile::mp3() { $( for key in ${!lameopts[@]} do - echo "cmd_arg$key ${lameopts[key]}" + cleanedopts="${lameopts[key]//\&/\\\&}" + cleanedopts="${cleanedopts//\[/\\[}" + cleanedopts="${cleanedopts//\]/\\]}" + cleanedopts="${cleanedopts//\{/\\{}" + cleanedopts="${cleanedopts//\}/\\\}}" + echo "cmd_arg$key $cleanedopts" done ) cleanup $tempdir/$tmpfile.wav diff --git a/lib/encode/encodeFile::opus b/lib/encode/encodeFile::opus index 2794a05..8e9bbcd 100644 --- a/lib/encode/encodeFile::opus +++ b/lib/encode/encodeFile::opus @@ -26,7 +26,12 @@ encodeFile::opus() { $( for key in ${!opusencopts[@]} do - echo "cmd_arg$key ${opusencopts[key]}" + cleanedopts="${opusencopts[key]//\&/\\\&}" + cleanedopts="${cleanedopts//\[/\\[}" + cleanedopts="${cleanedopts//\]/\\]}" + cleanedopts="${cleanedopts//\{/\\{}" + cleanedopts="${cleanedopts//\}/\\\}}" + echo "cmd_arg$key $cleanedopts" done ) cleanup $tempdir/$tmpfile.wav diff --git a/lib/encode/encodeFile::vorbis b/lib/encode/encodeFile::vorbis index c3a72e3..7c32538 100644 --- a/lib/encode/encodeFile::vorbis +++ b/lib/encode/encodeFile::vorbis @@ -22,6 +22,11 @@ encodeFile::vorbis() { $( for key in ${!oggencopts[@]} do + cleanedopts="${oggencopts[key]//\&/\\\&}" + cleanedopts="${cleanedopts//\[/\\[}" + cleanedopts="${cleanedopts//\]/\\]}" + cleanedopts="${cleanedopts//\{/\\{}" + cleanedopts="${cleanedopts//\}/\\\}}" echo "cmd_arg$key ${oggencopts[key]}" done ) diff --git a/lib/files/getFiles b/lib/files/getFiles index 1b53e6f..08a145f 100644 --- a/lib/files/getFiles +++ b/lib/files/getFiles @@ -19,7 +19,7 @@ getFiles() { mimetype=$(file -b --mime-type "$sourcepath/$filename") if [[ $mimetype == application/ogg ]] then - case "$(head -n1 "$sourcepath/$filename")" in + case "$(head -n5 "$sourcepath/$filename")" in *'vorbis'*) mimetype+=' vorbis' ;; diff --git a/lib/files/sanitizeFile b/lib/files/sanitizeFile index 2968f5e..07e8e50 100644 --- a/lib/files/sanitizeFile +++ b/lib/files/sanitizeFile @@ -27,12 +27,5 @@ sanitizeFile() { string=${string/%+(.)/} fi fi - # Not exactly filename sanitity, but these will make the script fail in - # a decorative way.. - string="${string//&/\\&}" - strint="${string//;/\\;}" - # And these would exhibit strange behaviors - string="${string//\[/\\\[}" - string="${string//\]/\\\]}" echo "$string" } diff --git a/lib/tags/getInfos::Ogg b/lib/tags/getInfos::Ogg index c376496..658c3ab 100644 --- a/lib/tags/getInfos::Ogg +++ b/lib/tags/getInfos::Ogg @@ -1,5 +1,5 @@ #!/bin/bash -getInfosOgg_version='Ogg-1' +getInfosOgg_version='Ogg-2' tagreaders+=( "$getInfosOgg_version" ) getInfos::Ogg() { tagreader="$getInfosOgg_version" @@ -22,9 +22,9 @@ getInfos::Ogg() { tracknum="$tracknum/$tracktotal" fi year=$(gettag date) - infos="${infos/: /=}" + infos="${infos//: /=}" rate=$(gettag rate|head -n1) channels=$(gettag channels|head -n1) - bitrate=$(gettag 'nominal bitrate') + bitrate=$(gettag 'average bitrate') bitrate=${bitrate%%,*} } diff --git a/lib/tags/getInfos::Opus b/lib/tags/getInfos::Opus index 2f99289..bed6242 100644 --- a/lib/tags/getInfos::Opus +++ b/lib/tags/getInfos::Opus @@ -1,5 +1,5 @@ #!/bin/bash -getInfosOpus_version='Opus-1' +getInfosOpus_version='Opus-2' tagreaders+=( "$getInfosOpus_version" ) getInfos::Opus() { tagreader="$getInfosOpus_version" @@ -22,7 +22,7 @@ getInfos::Opus() { tracknum="$tracknum/$tracktotal" fi year=$(gettag date) - infos="${infos/: /=}" + infos="${infos//: /=}" rate=$(gettag 'original sample rate'|head -n1) channels=$(gettag channels|head -n1) bitrate=$(gettag 'average bitrate') diff --git a/toys/README b/toys/README index d3d7af9..f9f57ab 100644 --- a/toys/README +++ b/toys/README @@ -1,3 +1,37 @@ +createindex +=========== +Creates a nice index of your collection, similar to what oidua +(http://oidua.suxbad.com/) does, but much faster, as it is using AtOM's DB +instead of rescanning your whole collection. + +Options define what will be shown and may optionnally be followed by the column +width (default: 50). + +Options: + -f: Path + -b: Average bitrate + -C: Channels + -s: Sample rate + -m: Mofification time + -M: Format + + -A: Album artist + -l: Album + -a: Artist + -c: Composer + -d: Disc + -g: Genre + -p: Performer + -t: Title + -y: Year + + -T : date-time format (see 'man date' for possible values) + -o -|: output file (path relative to Source) - mandatory - must + appear last. + + -u: update database first + -D: debug + checkextensions =============== Reports files whose extension does not match the (detected) mime-type. diff --git a/toys/createindex b/toys/createindex index 1291dce..4fc6034 100755 --- a/toys/createindex +++ b/toys/createindex @@ -82,7 +82,8 @@ done -b Average bitrate -C Channels -s Sample rate - -T Mofification time + -m Mofification time + -M Format -A Album artist -l Album @@ -94,7 +95,7 @@ done -t Title -y Year - -d : date-time format (see 'man date' for possible values) + -T : date-time format (see 'man date' for possible values) -o : output file (path relative to Source) -u : update database first