summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-08-17 16:16:24 +0200
committerlassulus <lass@aidsballs.de>2015-08-17 16:16:24 +0200
commit9218b163f2d8bc965b853ed9fc9e13d15a703456 (patch)
tree8523cca58c0713ec47719b58ede193bad11004a6
parent323a66775168b6addb3acddaee0a8ff227ea4bd4 (diff)
make target mutable
-rw-r--r--Makefile2
-rwxr-xr-xbin/ogg-maker14
-rwxr-xr-xbin/yout2ogg2
3 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 1d0e0f4..cd72b58 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
download: ## download all links to ./music
- cat links | xargs -n 1 bin/yout2ogg
+ cat links | target=./music xargs -n 1 bin/yout2ogg
add: ##make add url="http://youtube..."
add: ##to add link to ./links
diff --git a/bin/ogg-maker b/bin/ogg-maker
index 4528df2..82e2f8c 100755
--- a/bin/ogg-maker
+++ b/bin/ogg-maker
@@ -2,13 +2,15 @@
filename="$1"
outname=$(echo $1 | sed 's/^\(.*\)\..*/\1/').ogg
if [ "$filename" == "$outname" ]; then
- ffmpeg -i $filename tmp_$filename
- sox --norm=3 $filename tmp_$filename silence 1 0.1 1% reverse silence 1 0.1 1% reverse rate 44100
- vorbisgain ${filename}tmp
- mv tmp_$filename $filename
+ ffmpeg -i $filename tmp_$outname
+ sox --norm=3 tmp_$outname tmp2_$outname silence 1 0.1 1% reverse silence 1 0.1 1% reverse rate 44100
+ rm tmp_$outname
+ vorbisgain tmp2_$outname
+ mv tmp2_$outname $outname
else
- ffmpeg -i $filename $outname
- sox --norm=-3 $filename $outname silence 1 0.1 1% reverse silence 1 0.1 1% reverse rate 44100
+ ffmpeg -i $filename tmp_$outname
+ sox --norm=-3 tmp_$outname $outname silence 1 0.1 1% reverse silence 1 0.1 1% reverse rate 44100
+ rm tmp_$outname
vorbisgain $outname
rm $filename
fi
diff --git a/bin/yout2ogg b/bin/yout2ogg
index b6ab9c9..b316099 100755
--- a/bin/yout2ogg
+++ b/bin/yout2ogg
@@ -1,6 +1,6 @@
#! /bin/sh
set -euf
-target_folder="./music"
+target_folder=${target-./}
uri=$1
id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//')