summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:38:35 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:38:35 +0200
commitf2473f0ed875fb059affbbedd6c464aecba471e1 (patch)
tree8888543e321a3a226fd23679b32bdf8c4a18e8c1
parent0ab64fe6ef3182019f5e9090a966b270cfd1cca1 (diff)
downloadnixos-f2473f0ed875fb059affbbedd6c464aecba471e1.tar
nixos-f2473f0ed875fb059affbbedd6c464aecba471e1.tar.gz
nixos-f2473f0ed875fb059affbbedd6c464aecba471e1.tar.bz2
nixos-f2473f0ed875fb059affbbedd6c464aecba471e1.tar.xz
nixos-f2473f0ed875fb059affbbedd6c464aecba471e1.zip
-rw-r--r--odin/strm.nix4
-rwxr-xr-xodin/strm/download_youtube6
2 files changed, 6 insertions, 4 deletions
diff --git a/odin/strm.nix b/odin/strm.nix
index 82ba2bdb..8c88514e 100644
--- a/odin/strm.nix
+++ b/odin/strm.nix
@@ -6,7 +6,9 @@ stdenv.mkDerivation {
6 6
7 phases = [ "unpackPhase" "buildPhase" "installPhase" ]; 7 phases = [ "unpackPhase" "buildPhase" "installPhase" ];
8 8
9 inherit zsh ffmpeg-full youtube-dl pv notmuch; 9 inherit zsh pv notmuch;
10 ffmpeg = ffmpeg-full;
11 youtubedl = youtube-dl;
10 12
11 buildPhase = '' 13 buildPhase = ''
12 substituteAllInPlace download_youtube 14 substituteAllInPlace download_youtube
diff --git a/odin/strm/download_youtube b/odin/strm/download_youtube
index 41d532cc..4c37cb7e 100755
--- a/odin/strm/download_youtube
+++ b/odin/strm/download_youtube
@@ -2,7 +2,7 @@
2 2
3alwaysTranscode=false 3alwaysTranscode=false
4 4
5ffmpeg() { { { @ffmpeg-full@/bin/ffmpeg $@ 1>&3 } 2>&1 | stdbuf -o 0 tr '\r' '\n' | grep -v --line-buffered -E '^$' 1>&2 } 3>&1 } 5ffmpeg() { { { @ffmpeg@/bin/ffmpeg $@ 1>&3 } 2>&1 | stdbuf -o 0 tr '\r' '\n' | grep -v --line-buffered -E '^$' 1>&2 } 3>&1 }
6pv() { { { @pv@/bin/pv -D 2 -i 2 -w 100 -H 1 -f $@ 1>&3 } 2>&1 | stdbuf -o 0 tr '\r' '\n' | grep -v --line-buffered -E '^$' 1>&2 } 3>&1 } 6pv() { { { @pv@/bin/pv -D 2 -i 2 -w 100 -H 1 -f $@ 1>&3 } 2>&1 | stdbuf -o 0 tr '\r' '\n' | grep -v --line-buffered -E '^$' 1>&2 } 3>&1 }
7trimName() { prefix=$1; shift; printf "%s%s" ${prefix} $(awk -v len=$((19 - $#prefix)) '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }' <<<"${(j: :)@}")} 7trimName() { prefix=$1; shift; printf "%s%s" ${prefix} $(awk -v len=$((19 - $#prefix)) '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }' <<<"${(j: :)@}")}
8 8
@@ -116,7 +116,7 @@ printf ">>> %s <<<\n %s\n" "${msgId}" "${message}"
116 typeset -a args 116 typeset -a args
117 args=(--no-playlist --add-metadata --newline --mark-watched -f ${formatString}) 117 args=(--no-playlist --add-metadata --newline --mark-watched -f ${formatString})
118 118
119 @youtube-dl@/bin/youtube-dl ${args} --get-filename -o $'%(extractor)s\n%(id)s\n%(format)s\n%(title)s\n%(ext)s' -- ${url} | { 119 @youtubedl@/bin/youtube-dl ${args} --get-filename -o $'%(extractor)s\n%(id)s\n%(format)s\n%(title)s\n%(ext)s' -- ${url} | {
120 oldIFS=${IFS} 120 oldIFS=${IFS}
121 export IFS= 121 export IFS=
122 122
@@ -156,7 +156,7 @@ printf ">>> %s <<<\n %s\n" "${msgId}" "${message}"
156 fi 156 fi
157 fi 157 fi
158 158
159 @youtube-dl@/bin/youtube-dl $args -o "${filename:r}.%(ext)s" -- ${url} 2>&1 </dev/null | stdbuf -o0 tr '\r' '\n' 159 @youtubedl@/bin/youtube-dl $args -o "${filename:r}.%(ext)s" -- ${url} 2>&1 </dev/null | stdbuf -o0 tr '\r' '\n'
160 ytResult=$? 160 ytResult=$?
161 161
162 if [[ ! -e ${filename} && -n ${filename} ]]; then 162 if [[ ! -e ${filename} && -n ${filename} ]]; then