nixos-config/nixos/machines/chungus/sync-script.nix
Ingolf Wagner 56b1c6c29d
add tdarr
2023-05-04 20:59:26 +02:00

43 lines
1.3 KiB
Nix

# [ nix-shell:/media/music ]# transmission-create -o ~/first.torrent "Zardonic - Antihero (2015)" -t http://robi.private:6969/announce
# Creating
# torrent "/root/first.torrent" .... done!
#
# [nix-shell:/media/music]# transmission-remote sync.chungus.private:80 -a ~/first.torrent --download-dir /media/music
# sync.chungus.private:80/transmission/rpc/ responded: "success"
#
# [nix-shell:/media/music]# transmission-remote sync.robi.private:80 -a ~/first.torrent --download-dir /media/music
# sync.robi.private:80/transmission/rpc/ responded: "success"
#
#
{ pkgs, ... }:
{
environment.systemPackages = [
(pkgs.writers.writeBashBin "torrent-sync" ''
set -e
set -x
file_folder=$( realpath "$1" )
folder=$( dirname "$file_folder" )
file=$( basename "$file_folder" )
pushd "$folder"
${pkgs.transmission}/bin/transmission-create \
-t udp://robi.private:6969/announce \
-o ~/last.torrent \
"$file"
popd
${pkgs.transmission}/bin/transmission-remote \
sync.chungus.private:80 \
-a ~/last.torrent \
--download-dir "$folder"
${pkgs.transmission}/bin/transmission-remote \
sync.robi.private:80 \
-a ~/last.torrent \
--download-dir "$folder"
'')
];
}