diff options
author | lassulus <lassulus@lassul.us> | 2018-03-11 18:57:49 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-03-11 18:57:49 +0100 |
commit | 608857af5ba9c7f4a421bf3ec6ad3cdd1ff707b2 (patch) | |
tree | a26d19678217f09a8f9a2927800f6ab86a8ab75c | |
parent | 00b1d065a36a9800a9f8a8f6af30f90a006c9251 (diff) |
shell.nix: run on all nix systems
-rwxr-xr-x | bin/checkMissing | 9 | ||||
-rwxr-xr-x | bin/checkMissingLink | 13 | ||||
-rwxr-xr-x | bin/checkMissingmp3 | 9 | ||||
-rwxr-xr-x | bin/ogg-maker | 16 | ||||
-rwxr-xr-x | bin/ogg2mp3 | 15 | ||||
-rwxr-xr-x | bin/yout2mp3 | 24 | ||||
-rwxr-xr-x | bin/yout2ogg | 24 | ||||
-rwxr-xr-x | bin/youtplaylist | 2 | ||||
-rw-r--r-- | shell.nix | 16 |
9 files changed, 8 insertions, 120 deletions
diff --git a/bin/checkMissing b/bin/checkMissing deleted file mode 100755 index f53549c..0000000 --- a/bin/checkMissing +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -uri=$1 -musicDir=${musicDir-./} -id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//') - -if ! file=$(find $musicDir -maxdepth 1 | grep -q "[-]$id\\.ogg\$"); then - echo $uri -fi diff --git a/bin/checkMissingLink b/bin/checkMissingLink deleted file mode 100755 index 4b53f79..0000000 --- a/bin/checkMissingLink +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -file=$1 -id=$(echo "$file" | sed 's/.*\(.\{11\}\)\.ogg/\1/') - -if [ $id = '' ]; then - echo 'no id' - exit 23 -fi - -if ! grep -q -- "$id#" links; then - echo $file -fi diff --git a/bin/checkMissingmp3 b/bin/checkMissingmp3 deleted file mode 100755 index d7722d2..0000000 --- a/bin/checkMissingmp3 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -uri=$1 -musicDir=${musicDir-./} -id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//') - -if ! file=$(find $musicDir | grep -q "[-]$id\\.mp3\$"); then - echo $uri -fi diff --git a/bin/ogg-maker b/bin/ogg-maker deleted file mode 100755 index a812f09..0000000 --- a/bin/ogg-maker +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -filename="$1" -outname=$(echo $1 | sed 's/^\(.*\)\..*/\1/').ogg -if [ "$filename" == "$outname" ]; then - ffmpeg -i $filename tmp_$outname - sox --norm 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 tmp_$outname - sox --norm 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/ogg2mp3 b/bin/ogg2mp3 deleted file mode 100755 index 1fbf414..0000000 --- a/bin/ogg2mp3 +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh -set -euf -target_folder=${target-./} - -source=$1 -target_mp3=$(basename $1 | sed 's/ogg$/mp3/') - -mkdir -p $target_folder - -if test -e $target_folder/$target_mp3; then - echo "already done: $target_mp3 in $target_folder" >&2 - exit -fi - -ffmpeg -i $source $target_folder/$target_mp3 diff --git a/bin/yout2mp3 b/bin/yout2mp3 deleted file mode 100755 index 72ea234..0000000 --- a/bin/yout2mp3 +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -set -euf -target_folder=${target-./} - -uri=$1 -id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//') -script=$(readlink -f "$0") -basedir=$(dirname $script) - -mkdir -p $target_folder - -if ! echo "$id" | grep -q .; then - echo "[31mbad uri: $uri[m" >&2 - exit 23 -fi - -cd $target_folder - -if file=$(ls | grep "[-]$id\\.mp3\$"); then - echo "already done: $file in $target_folder" >&2 - exit -fi - -youtube-dl -i -o "%(title)s-%(id)s.%(ext)s" --restrict-filenames -x "$uri" --add-metadata --audio-format mp3 diff --git a/bin/yout2ogg b/bin/yout2ogg deleted file mode 100755 index b316099..0000000 --- a/bin/yout2ogg +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -set -euf -target_folder=${target-./} - -uri=$1 -id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//') -script=$(readlink -f "$0") -basedir=$(dirname $script) - -mkdir -p $target_folder - -if ! echo "$id" | grep -q .; then - echo "[31mbad uri: $uri[m" >&2 - exit 23 -fi - -cd $target_folder - -if file=$(ls | grep "[-]$id\\.ogg\$"); then - echo "already done: $file in $target_folder" >&2 - exit -fi - -youtube-dl -i -o "%(title)s-%(id)s.%(ext)s" --restrict-filenames -x "$uri" --add-metadata --exec "$basedir/ogg-maker {}" diff --git a/bin/youtplaylist b/bin/youtplaylist deleted file mode 100755 index c2468a0..0000000 --- a/bin/youtplaylist +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -youtube-dl -i -o "http://www.youtube.com/watch?v=%(id)s#%(title)s" --restrict-filenames --get-filename $1 @@ -1,12 +1,12 @@ let - lib = import <stockholm/lib>; - pkgs = import <nixpkgs> { overlays = [(import <stockholm/krebs/5pkgs>)]; }; - #pkgs = import (opkgs.fetchFromGitHub { - # owner = "nixos"; - # repo = "nixpkgs"; - # rev = "579a190cfdb187e8a279962bdb3df51fbd23a08b"; #youtube-dl upgrade - # sha256 = "0lj9kdp0r0c66sb95yiqxjm4s4cywsyy0dpw1w01rff1acgdr2bh"; - #}) {}; + opkgs = import <nixpkgs> {}; + stockholm = opkgs.fetchgit { + url = "https://cgit.lassul.us/stockholm"; + rev = "02f67ee"; + sha256 = "1ml6aw8ds1sw6bl238v9vc78sjv3iys71184ayirmj2kn6dr33ap"; + }; + lib = import "${stockholm}/lib"; + pkgs = import <nixpkgs> { overlays = [(import "${stockholm}/krebs/5pkgs")]; }; commands.review = let moveToDir = key: dir: pkgs.writeText "move-with-${key}.lua" '' |