stuff
This commit is contained in:
parent
7c08e4b106
commit
f2501da417
|
@ -19,21 +19,45 @@
|
||||||
pkgs.opusTools
|
pkgs.opusTools
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
src="$1"
|
src=$(realpath -- "$1")
|
||||||
dst=''${src%.flac}.opus
|
dst=$src
|
||||||
dst=/srv/compmusic/''${dst#./}
|
dst=''${dst%.flac}.opus
|
||||||
|
dst=/srv/compmusic/''${dst#/srv/music/}
|
||||||
|
|
||||||
if [[ -f "$dst" ]]; then
|
if [[ -f "$dst" ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir --parents -- "$(dirname -- "$dst")"
|
mkdir --parents -- "$(dirname -- "$dst")"
|
||||||
|
|
||||||
|
echo "encoding ''${src@Q} -> ''${dst@Q}" >&2
|
||||||
exec opusenc --quiet --bitrate 96.000 -- "$src" "$dst"
|
exec opusenc --quiet --bitrate 96.000 -- "$src" "$dst"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
clean = pkgs.writeShellApplication {
|
||||||
|
name = "clean";
|
||||||
|
text = ''
|
||||||
|
del=$(realpath -- "$1")
|
||||||
|
chk=$del
|
||||||
|
chk=''${chk%.opus}.flac
|
||||||
|
chk=/srv/music/''${chk#/srv/compmusic/}
|
||||||
|
|
||||||
|
if [[ ! -f "$chk" ]]; then
|
||||||
|
echo "deleting ''${del@Q}" >&2
|
||||||
|
rm --force -- "$del"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
in ''
|
in ''
|
||||||
cd /srv/music
|
shopt -s globstar nullglob
|
||||||
|
|
||||||
|
pushd /srv/music
|
||||||
find . -name '*.flac' -print0 | parallel --null -- ${lib.getExe enc} {}
|
find . -name '*.flac' -print0 | parallel --null -- ${lib.getExe enc} {}
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd /srv/compmusic
|
||||||
|
find . -name '*.flac' -exec ${clean} {} \;
|
||||||
|
popd
|
||||||
|
|
||||||
rsync --verbose --verbose --archive --update --delete --mkpath --exclude lost+found \
|
rsync --verbose --verbose --archive --update --delete --mkpath --exclude lost+found \
|
||||||
--rsh 'ssh -i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' \
|
--rsh 'ssh -i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' \
|
||||||
|
|
Loading…
Reference in a new issue