summaryrefslogtreecommitdiff
path: root/hel/recv-media.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-05-15 23:18:09 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-05-15 23:18:09 +0200
commitbba00f87fd5460e394fc20252732647e301a67ff (patch)
tree73e57f0f58a3e0d7fd8a82c860f4714c57e4a8f0 /hel/recv-media.nix
parent96b03e1bf70e5ed6021481710a7d6a53a9211c1f (diff)
downloadnixos-bba00f87fd5460e394fc20252732647e301a67ff.tar
nixos-bba00f87fd5460e394fc20252732647e301a67ff.tar.gz
nixos-bba00f87fd5460e394fc20252732647e301a67ff.tar.bz2
nixos-bba00f87fd5460e394fc20252732647e301a67ff.tar.xz
nixos-bba00f87fd5460e394fc20252732647e301a67ff.zip
video over uucp
Diffstat (limited to 'hel/recv-media.nix')
-rw-r--r--hel/recv-media.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/hel/recv-media.nix b/hel/recv-media.nix
new file mode 100644
index 00000000..f85598f4
--- /dev/null
+++ b/hel/recv-media.nix
@@ -0,0 +1,22 @@
1{ stdenv, coreutils, ffmpeg-full writeScriptBin }:
2
3writeScriptBin "recv-media" ''
4 #!${stdenv.shell}
5
6 PATH=${ffmpeg-full}/bin:${coreutils}/bin
7
8 dir=/var/media
9
10 file="''${dir}/.$(basename "$1")"
11 file2="''${dir}/.copy.$(basename "$1")"
12 nFile="''${dir}/$(basename "$1")"
13 cat > "''${file}"
14 if ! ffmpeg -v warning -i "''${file}" -c copy "''${file2}" 2>&1 </dev/null; then
15 echo "Download of ''${file} failed"
16 rm -f "''${nFile}" "''${file}" "''${file2}"
17 exit 1
18 else
19 rm -f "''${file}"
20 mv "''${file2}" "''${nFile}"
21 fi
22'';