Add separate audiobook script

This commit is contained in:
exu 2024-08-25 11:45:25 +02:00
parent 55087c4d65
commit 1fb1b5c3d8
2 changed files with 25 additions and 9 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
user=exu
server=he1app14
port=22
sshkeypath=$HOME/.ssh/id_ed25519
# NOTE don't transfer to the storage box directly, leads to mangled file names
# see: https://serverfault.com/a/765951
# unlock ssh key
if ! ssh-add -T "${sshkeypath}.pub" &>/dev/null; then
ssh-add -q "$sshkeypath"
fi
# NAS: audiobooks
rsync -uvrL --progress --delete "/mnt/storage/MediaLibrary/Audiobooks" /mnt/lan1nas1/ &
# Server: audiobooks
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" "/mnt/storage/MediaLibrary/Audiobooks" "${user}@${server}:/mnt/media/"
# wait for background jobs
wait
echo "Finished transfering data"

View File

@ -13,27 +13,18 @@ if ! ssh-add -T "${sshkeypath}.pub" &>/dev/null; then
ssh-add -q "$sshkeypath"
fi
# Server: sync other files from audiobooks
rsync -uvr --progress -e "ssh -i $sshkeypath -p $port" "${user}@${server}:/mnt/media/Audiobooks" "/mnt/storage/MediaLibrary/"
# NAS: video files
rsync -uvr --progress --delete /mnt/storage/MediaLibrary/{Movies,other,Patreon,Shows} /mnt/lan1nas1/ &
# NAS: music
rsync -uvrL --progress --delete /home/exu/Musik /mnt/lan1nas1/ &
# NAS: audiobooks
rsync -uvrL --progress --delete "/mnt/storage/MediaLibrary/Audiobooks" /mnt/lan1nas1/ &
# Server: music
rsync -uvrL --progress --delete -e "ssh -i $sshkeypath -p $port" /home/exu/Musik/ ${user}@${server}:/mnt/media/Musik/
# Server: video files
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/{Movies,Shows,other} ${user}@${server}:/mnt/media/
# Server: audiobooks
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" "/mnt/storage/MediaLibrary/Audiobooks" "${user}@${server}:/mnt/media/"
# wait for background jobs
wait