From 1a9758a251618beb3dfca5ec755f980ebb2bcaee Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 8 Apr 2013 02:52:56 +0200 Subject: [PATCH] add shebang on lib files --- lib/config/getConfig | 1 + lib/config/getConfigDestination | 1 + lib/config/getConfigGeneral | 1 + lib/config/getConfigSource | 1 + lib/config/print | 1 + lib/copy/checkCopy | 1 + lib/copy/copyFiles_action | 1 + lib/copy/copyFiles_matching | 1 + lib/database/Delete | 1 + lib/database/Insert | 1 + lib/database/InsertIfUnset | 1 + lib/database/InsertOrUpdate | 1 + lib/database/Select | 1 + lib/database/Update | 1 + lib/database/closeDatabase | 1 + lib/database/openDatabase | 1 + lib/decode/decodeFile | 1 + lib/decode/decodeMpcdec | 1 + lib/decode/decodeOpusdec | 1 + lib/decode/decodeSox | 1 + lib/destinations/createDestinations | 1 + lib/destinations/updateMimes | 1 + lib/encode/encodeFile::mp3 | 1 + lib/encode/encodeFile::opus | 1 + lib/encode/encodeFile::vorbis | 1 + lib/files/getDestDir | 1 + lib/files/getDestFile | 1 + lib/files/getFiles | 1 + lib/files/removeObsoleteFiles | 1 + lib/files/sanitizeFile | 1 + lib/tags/getInfos::APE | 1 + lib/tags/getInfos::FLAC | 1 + lib/tags/getInfos::MP3 | 1 + lib/tags/getInfos::Ogg | 1 + lib/tags/getInfos::Opus | 1 + lib/tags/getRateChannelMPC | 1 + lib/tags/getRateChannelSoxi | 1 + lib/tags/getTags | 1 + lib/tags/gettag | 1 + lib/tags/tryAPE | 1 + lib/tasks/gettaskinfos | 1 + lib/tools/progressSpin | 1 + lib/workers/checkworkers | 1 + lib/workers/cleaner | 1 + lib/workers/createworker | 1 + lib/workers/destroyworker | 1 + lib/workers/getworkerid | 1 + lib/workers/master | 1 + lib/workers/worker | 1 + 49 files changed, 49 insertions(+) diff --git a/lib/config/getConfig b/lib/config/getConfig index 6c14e36..9243fb1 100644 --- a/lib/config/getConfig +++ b/lib/config/getConfig @@ -1,3 +1,4 @@ +#!/bin/bash getConfig() { while read key value do diff --git a/lib/config/getConfigDestination b/lib/config/getConfigDestination index 6195ed5..a6fa6a8 100644 --- a/lib/config/getConfigDestination +++ b/lib/config/getConfigDestination @@ -1,3 +1,4 @@ +#!/bin/bash getConfigDestination() { case "$key" in 'path') diff --git a/lib/config/getConfigGeneral b/lib/config/getConfigGeneral index 125b7b6..9de2888 100644 --- a/lib/config/getConfigGeneral +++ b/lib/config/getConfigGeneral @@ -1,3 +1,4 @@ +#!/bin/bash getConfigGeneral() { case $key in 'max-load') diff --git a/lib/config/getConfigSource b/lib/config/getConfigSource index 9df19c3..1042969 100644 --- a/lib/config/getConfigSource +++ b/lib/config/getConfigSource @@ -1,3 +1,4 @@ +#!/bin/bash getConfigSource() { case "$key" in 'path') diff --git a/lib/config/print b/lib/config/print index f466547..6722de6 100644 --- a/lib/config/print +++ b/lib/config/print @@ -1,3 +1,4 @@ +#!/bin/bash printConfig() { { cat <<-EOF diff --git a/lib/copy/checkCopy b/lib/copy/checkCopy index 7aa76d6..45cd185 100644 --- a/lib/copy/checkCopy +++ b/lib/copy/checkCopy @@ -1,3 +1,4 @@ +#!/bin/bash checkCopy() { ( [ -z "${destinationfrequency[$destination]}" ] \ diff --git a/lib/copy/copyFiles_action b/lib/copy/copyFiles_action index 5124b42..7482836 100644 --- a/lib/copy/copyFiles_action +++ b/lib/copy/copyFiles_action @@ -1,3 +1,4 @@ +#!/bin/bash copyFiles_action() { echo ' SELECT diff --git a/lib/copy/copyFiles_matching b/lib/copy/copyFiles_matching index 194fc88..7870cfe 100644 --- a/lib/copy/copyFiles_matching +++ b/lib/copy/copyFiles_matching @@ -1,3 +1,4 @@ +#!/bin/bash copyFiles_matching() { extension="${filename##*.}" cp -al \ diff --git a/lib/database/Delete b/lib/database/Delete index 2cd5718..01933ce 100644 --- a/lib/database/Delete +++ b/lib/database/Delete @@ -1,3 +1,4 @@ +#!/bin/bash Delete() { #Delete table < where_key where_operator where_value # [where_key where_operator where_value diff --git a/lib/database/Insert b/lib/database/Insert index 1e0338b..77f7ec2 100644 --- a/lib/database/Insert +++ b/lib/database/Insert @@ -1,3 +1,4 @@ +#!/bin/bash Insert() { #Insert table [no_id] < key value # [key value diff --git a/lib/database/InsertIfUnset b/lib/database/InsertIfUnset index c81ce33..4277a62 100644 --- a/lib/database/InsertIfUnset +++ b/lib/database/InsertIfUnset @@ -1,3 +1,4 @@ +#!/bin/bash InsertIfUnset() { #InsertIfUnset table [no_id] < key value \n key value local \ diff --git a/lib/database/InsertOrUpdate b/lib/database/InsertOrUpdate index 2fdf7c2..4f25110 100644 --- a/lib/database/InsertOrUpdate +++ b/lib/database/InsertOrUpdate @@ -1,3 +1,4 @@ +#!/bin/bash InsertOrUpdate() { #InsertOrUpdate table set_key set_value [set_key set_value […]] < where_key where_value # [where_key where_value diff --git a/lib/database/Select b/lib/database/Select index 4a0ca7e..b096953 100644 --- a/lib/database/Select +++ b/lib/database/Select @@ -1,3 +1,4 @@ +#!/bin/bash Select() { #Select table [col1 [col2 [..]]] < WHERE_key WHERE_operator WHERE_value # [WHERE_key WHERE_operator WHERE_value diff --git a/lib/database/Update b/lib/database/Update index 2e5f1c5..0fe5db5 100644 --- a/lib/database/Update +++ b/lib/database/Update @@ -1,3 +1,4 @@ +#!/bin/bash Update() { #Update table set_key set_value [set_key set_value […]] < where_key where_operator where_value # [where_key where_operator where_value diff --git a/lib/database/closeDatabase b/lib/database/closeDatabase index 91dccad..2d6e1a2 100644 --- a/lib/database/closeDatabase +++ b/lib/database/closeDatabase @@ -1,3 +1,4 @@ +#!/bin/bash closeDatabase() { echo .quit >&3 (( debug )) && echo -n "Waiting for SQLite to terminate... " diff --git a/lib/database/openDatabase b/lib/database/openDatabase index 1b4f970..74f4745 100644 --- a/lib/database/openDatabase +++ b/lib/database/openDatabase @@ -1,3 +1,4 @@ +#!/bin/bash openDatabase() { if [ ! -d "$tempdir" ] then diff --git a/lib/decode/decodeFile b/lib/decode/decodeFile index fb6591b..b66c6ef 100644 --- a/lib/decode/decodeFile +++ b/lib/decode/decodeFile @@ -1,3 +1,4 @@ +#!/bin/bash decodeFile() { if ! decodetaskid=$( Select tasks id <<<"key = $tmpfile" diff --git a/lib/decode/decodeMpcdec b/lib/decode/decodeMpcdec index e1ee72c..fd92a4f 100644 --- a/lib/decode/decodeMpcdec +++ b/lib/decode/decodeMpcdec @@ -1,3 +1,4 @@ +#!/bin/bash decodeMpcdec() { tmpfile="${fileid}mpcdec" commandline=(mpcdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav") diff --git a/lib/decode/decodeOpusdec b/lib/decode/decodeOpusdec index 4721b89..9f9d0ef 100644 --- a/lib/decode/decodeOpusdec +++ b/lib/decode/decodeOpusdec @@ -1,3 +1,4 @@ +#!/bin/bash decodeOpusdec() { tmpfile="${fileid}opusdec" commandline=(opusdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav") diff --git a/lib/decode/decodeSox b/lib/decode/decodeSox index 84c29c6..69f8053 100644 --- a/lib/decode/decodeSox +++ b/lib/decode/decodeSox @@ -1,3 +1,4 @@ +#!/bin/bash decodeSox() { commandline=(sox --single-threaded --temp "$tempdir") soxoptions_in='' diff --git a/lib/destinations/createDestinations b/lib/destinations/createDestinations index f2c2d51..fc6e3bc 100644 --- a/lib/destinations/createDestinations +++ b/lib/destinations/createDestinations @@ -1,3 +1,4 @@ +#!/bin/bash createDestinations() { for destination in ${!destinationpath[@]} do diff --git a/lib/destinations/updateMimes b/lib/destinations/updateMimes index 8fc433d..189572b 100644 --- a/lib/destinations/updateMimes +++ b/lib/destinations/updateMimes @@ -1,3 +1,4 @@ +#!/bin/bash updateMimes() { Update mime_actions action 1 <<<"action != 1" for destination in ${!destinationskipmime[@]} diff --git a/lib/encode/encodeFile::mp3 b/lib/encode/encodeFile::mp3 index b49bd05..34aa133 100644 --- a/lib/encode/encodeFile::mp3 +++ b/lib/encode/encodeFile::mp3 @@ -1,3 +1,4 @@ +#!/bin/bash encodeFile::mp3() { lameopts=(lame --quiet -v --abr ${destinationquality[$destination]}) [ -n "$album" ] && lameopts+=(--tl "$album" ) diff --git a/lib/encode/encodeFile::opus b/lib/encode/encodeFile::opus index 50d8a1c..bc7d9f3 100644 --- a/lib/encode/encodeFile::opus +++ b/lib/encode/encodeFile::opus @@ -1,3 +1,4 @@ +#!/bin/bash encodeFile::opus() { opusencopts=(opusenc --music --quiet) opusencopts+=(--bitrate ${destinationquality[$destination]}) diff --git a/lib/encode/encodeFile::vorbis b/lib/encode/encodeFile::vorbis index 7ff4acd..e3d87d4 100644 --- a/lib/encode/encodeFile::vorbis +++ b/lib/encode/encodeFile::vorbis @@ -1,3 +1,4 @@ +#!/bin/bash encodeFile::vorbis() { oggencopts=(oggenc -Q -q ${destinationquality[$destination]}) [ -n "$albumartist" ] && oggencopts+=(-c "ALBUMARTIST=$albumartist") diff --git a/lib/files/getDestDir b/lib/files/getDestDir index 4f0baae..d433cb3 100644 --- a/lib/files/getDestDir +++ b/lib/files/getDestDir @@ -1,3 +1,4 @@ +#!/bin/bash getDestDir() { destdir="${destinationpath[$destination]}/" if [ -n "${destinationrenamepath[$destination]}" ] diff --git a/lib/files/getDestFile b/lib/files/getDestFile index 14f4874..7730b48 100644 --- a/lib/files/getDestFile +++ b/lib/files/getDestFile @@ -1,3 +1,4 @@ +#!/bin/bash getDestFile() { if [ -n "${destinationrename[$destination]}" ] then diff --git a/lib/files/getFiles b/lib/files/getFiles index 977bc4a..1b53e6f 100644 --- a/lib/files/getFiles +++ b/lib/files/getFiles @@ -1,3 +1,4 @@ +#!/bin/bash getFiles() { scantime=$(date +%s) for prune_expression in "${skippeddirectories[@]}" diff --git a/lib/files/removeObsoleteFiles b/lib/files/removeObsoleteFiles index 6cf0f54..69bd04b 100644 --- a/lib/files/removeObsoleteFiles +++ b/lib/files/removeObsoleteFiles @@ -1,3 +1,4 @@ +#!/bin/bash removeObsoleteFiles() { Delete source_files <<-EOWhere last_seen < $scantime diff --git a/lib/files/sanitizeFile b/lib/files/sanitizeFile index 90a3ebc..34bf8e3 100644 --- a/lib/files/sanitizeFile +++ b/lib/files/sanitizeFile @@ -1,3 +1,4 @@ +#!/bin/bash sanitizeFile() { shopt -s extglob string="$1" diff --git a/lib/tags/getInfos::APE b/lib/tags/getInfos::APE index 181c668..66f2a29 100644 --- a/lib/tags/getInfos::APE +++ b/lib/tags/getInfos::APE @@ -1,3 +1,4 @@ +#!/bin/bash getInfosAPE_version='APE-1' tagreaders+=( "$getInfosAPE_version" ) getInfos::APE() { diff --git a/lib/tags/getInfos::FLAC b/lib/tags/getInfos::FLAC index 04533fa..288eac7 100644 --- a/lib/tags/getInfos::FLAC +++ b/lib/tags/getInfos::FLAC @@ -1,3 +1,4 @@ +#!/bin/bash getInfosFLAC_version='FLAC-1' tagreaders+=( "$getInfosFLAC_version" ) getInfos::FLAC() { diff --git a/lib/tags/getInfos::MP3 b/lib/tags/getInfos::MP3 index 62290dc..c98de74 100644 --- a/lib/tags/getInfos::MP3 +++ b/lib/tags/getInfos::MP3 @@ -1,3 +1,4 @@ +#!/bin/bash getInfosMP3_version='ID3-2' tagreaders+=( "$getInfosMP3_version" ) getInfos::MP3() { diff --git a/lib/tags/getInfos::Ogg b/lib/tags/getInfos::Ogg index 175fe00..c376496 100644 --- a/lib/tags/getInfos::Ogg +++ b/lib/tags/getInfos::Ogg @@ -1,3 +1,4 @@ +#!/bin/bash getInfosOgg_version='Ogg-1' tagreaders+=( "$getInfosOgg_version" ) getInfos::Ogg() { diff --git a/lib/tags/getInfos::Opus b/lib/tags/getInfos::Opus index 61198ba..2f99289 100644 --- a/lib/tags/getInfos::Opus +++ b/lib/tags/getInfos::Opus @@ -1,3 +1,4 @@ +#!/bin/bash getInfosOpus_version='Opus-1' tagreaders+=( "$getInfosOpus_version" ) getInfos::Opus() { diff --git a/lib/tags/getRateChannelMPC b/lib/tags/getRateChannelMPC index 05fdbc9..14b28ba 100644 --- a/lib/tags/getRateChannelMPC +++ b/lib/tags/getRateChannelMPC @@ -1,3 +1,4 @@ +#!/bin/bash getRateChannelMPC() { while read key value garbage do diff --git a/lib/tags/getRateChannelSoxi b/lib/tags/getRateChannelSoxi index a8613cb..91db5fe 100644 --- a/lib/tags/getRateChannelSoxi +++ b/lib/tags/getRateChannelSoxi @@ -1,3 +1,4 @@ +#!/bin/bash getRateChannelSoxi() { rate=$(soxi -r "$sourcepath/$filename" 2>/dev/null) channels=$(soxi -c "$sourcepath/$filename" 2>/dev/null) diff --git a/lib/tags/getTags b/lib/tags/getTags index dbc08e3..6a735df 100644 --- a/lib/tags/getTags +++ b/lib/tags/getTags @@ -1,3 +1,4 @@ +#!/bin/bash getTags_version='unknown-2' tagreaders+=( "$getTags_version" ) getTags() { diff --git a/lib/tags/gettag b/lib/tags/gettag index d6f6a2d..b6f5409 100644 --- a/lib/tags/gettag +++ b/lib/tags/gettag @@ -1,3 +1,4 @@ +#!/bin/bash gettag() { echo -e "$infos" \ | sed -n "/^${1}=/I{s/^${1}=//I;p;q}" diff --git a/lib/tags/tryAPE b/lib/tags/tryAPE index 3cf2db2..53f963e 100644 --- a/lib/tags/tryAPE +++ b/lib/tags/tryAPE @@ -1,3 +1,4 @@ +#!/bin/bash tryAPE() { grep -q 'APETAGEX' \ "$sourcepath/$filename" \ diff --git a/lib/tasks/gettaskinfos b/lib/tasks/gettaskinfos index a92fe91..f0023bd 100644 --- a/lib/tasks/gettaskinfos +++ b/lib/tasks/gettaskinfos @@ -1,3 +1,4 @@ +#!/bin/bash gettaskinfos() { echo ' SELECT diff --git a/lib/tools/progressSpin b/lib/tools/progressSpin index ba41f8e..cecff55 100644 --- a/lib/tools/progressSpin +++ b/lib/tools/progressSpin @@ -1,3 +1,4 @@ +#!/bin/bash progressSpin() { case $(( ++count % 40 )) in 0) echo -ne '\b|' ;; diff --git a/lib/workers/checkworkers b/lib/workers/checkworkers index f8b711e..fa52afb 100644 --- a/lib/workers/checkworkers +++ b/lib/workers/checkworkers @@ -1,3 +1,4 @@ +#!/bin/bash checkworkers() { for key in ${!workers[@]} do diff --git a/lib/workers/cleaner b/lib/workers/cleaner index c1bc581..3db4e0a 100644 --- a/lib/workers/cleaner +++ b/lib/workers/cleaner @@ -1,3 +1,4 @@ +#!/bin/bash cleaner() { for key in ${!failedtasks[@]} do diff --git a/lib/workers/createworker b/lib/workers/createworker index a2b955a..16d8e24 100644 --- a/lib/workers/createworker +++ b/lib/workers/createworker @@ -1,3 +1,4 @@ +#!/bin/bash createworker() { worker $1 & workers[$1]=$! diff --git a/lib/workers/destroyworker b/lib/workers/destroyworker index 707c574..3e34426 100644 --- a/lib/workers/destroyworker +++ b/lib/workers/destroyworker @@ -1,3 +1,4 @@ +#!/bin/bash destroyworker() { dyingworker=${workers[$1]} unset workers[$1] diff --git a/lib/workers/getworkerid b/lib/workers/getworkerid index 0d7ddc3..4e6affc 100644 --- a/lib/workers/getworkerid +++ b/lib/workers/getworkerid @@ -1,3 +1,4 @@ +#!/bin/bash getworkerid() { local i for (( i=0 ; i >= 0 ; i++ )) diff --git a/lib/workers/master b/lib/workers/master index 518dc72..4c22abe 100644 --- a/lib/workers/master +++ b/lib/workers/master @@ -1,3 +1,4 @@ +#!/bin/bash master() { if (( active >= concurrency)) || [ -n "$quit" ] then diff --git a/lib/workers/worker b/lib/workers/worker index 4dd40b5..c4b5954 100644 --- a/lib/workers/worker +++ b/lib/workers/worker @@ -1,3 +1,4 @@ +#!/bin/bash worker() { exec 2>>"$tempdir/worker$1.log" (( debug >= 2 )) && echo "${cmd_arg[@]}" >&2