blob: 4ce05d4410832f4cb6bf86ff5b86893ea54f50fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{ stdenv, coreutils, ffmpeg-full, writeScriptBin }:
writeScriptBin "recv-media" ''
#!${stdenv.shell}
[[ -z "$1" ]] && exit 2
PATH=${ffmpeg-full}/bin:${coreutils}/bin
dir=/var/media
file="''${dir}/.$(basename "$1")"
#file2="''${dir}/.copy.$(basename "$1")"
nFile="''${dir}/$(basename "$1")"
#cat > "''${file}"
if ffmpeg -v warning -i "''$1" -c copy "''${file}" 2>&1 </dev/null; then
mv "''${file}" "''${nFile}"
else
echo "Download of ''${file} failed"
rm -f "''${nFile}" "''${file}"
exit 1
fi
''
|