actually fix music
This commit is contained in:
parent
d67ade06c8
commit
e585ffe73e
|
@ -18,6 +18,7 @@
|
|||
../profiles/wallabag
|
||||
../profiles/finance
|
||||
../profiles/sync/website
|
||||
../profiles/sync/music
|
||||
../profiles/grasp
|
||||
# ../profiles/archivebox
|
||||
# ../profiles/woodpecker-agent
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.ffmpeg ];
|
||||
mossnet.gonic.enable = true;
|
||||
mossnet.gonic.settings = ''
|
||||
music-path /mnt/two/music/
|
||||
podcast-path /data/podcasts
|
||||
cache-path /data/cache
|
||||
playlists-path /data/playlists
|
||||
transcode-cache-size 1000
|
||||
transcode-eject-interval 1440
|
||||
'';
|
||||
mossnet.gonic.user = "gonic";
|
||||
mossnet.gonic.group = "audio";
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
path = [
|
||||
pkgs.coreutils
|
||||
pkgs.rsync
|
||||
pkgs.beets
|
||||
];
|
||||
script = builtins.readFile ./get-music.sh;
|
||||
serviceConfig = {
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
REMOTE_HOST="anish@talos.feralhosting.com"
|
||||
REMOTE_HOST="aynish@talos.feralhosting.com"
|
||||
REMOTE_PATH="private/transmission/data/"
|
||||
LOCAL_PATH="/data/incoming"
|
||||
TRACKING_FILE="/data/incoming/.downloaded_albums"
|
||||
LOG_FILE="/data/incoming/download-log"
|
||||
LOCAL_PATH="/mnt/two/incoming"
|
||||
TRACKING_FILE="/mnt/two/incoming/.downloaded_albums"
|
||||
LOG_FILE="/mnt/two/incoming/download-log"
|
||||
|
||||
# Create tracking file if it doesn't exist
|
||||
touch "$TRACKING_FILE"
|
||||
|
||||
# Get list of albums on remote server
|
||||
echo "$(date): Checking for new albums on seedbox..." >>"$LOG_FILE"
|
||||
REMOTE_ALBUMS=$(rsync --dry-run --list-only "$REMOTE_HOST:$REMOTE_PATH" | grep '^d' | awk '{print $5}' | grep -v '^\.') || true
|
||||
REMOTE_ALBUMS=$(rsync --dry-run --list-only "$REMOTE_HOST:$REMOTE_PATH" | grep '^d' | awk '{$1=$2=$3=$4=""; sub(/^ +/, ""); print}' | grep -v '^\.') || true
|
||||
|
||||
if [ -z "$REMOTE_ALBUMS" ]; then
|
||||
echo "$(date): No albums found on remote server" >>"$LOG_FILE"
|
||||
|
@ -23,7 +23,7 @@ fi
|
|||
# Check each album against tracking file
|
||||
NEW_ALBUMS=""
|
||||
while IFS= read -r album; do
|
||||
if [ -n "$album" ] && ! grep -q "^$album$" "$TRACKING_FILE"; then
|
||||
if [ -n "$album" ] && ! grep -qF "$album" "$TRACKING_FILE"; then
|
||||
NEW_ALBUMS="$NEW_ALBUMS$album\n"
|
||||
echo "$(date): Found new album: $album" >>"$LOG_FILE"
|
||||
fi
|
||||
|
@ -39,9 +39,17 @@ echo "$(date): Starting download of new albums..." >> "$LOG_FILE"
|
|||
while IFS= read -r album; do
|
||||
if [ -n "$album" ]; then
|
||||
echo "$(date): Downloading $album" >>"$LOG_FILE"
|
||||
if rsync -r --log-file="$LOG_FILE" "$REMOTE_HOST:$REMOTE_PATH$album/" "$LOCAL_PATH/"; then
|
||||
if rsync -r --log-file="$LOG_FILE" "$REMOTE_HOST:$REMOTE_PATH$album/" "$LOCAL_PATH/$album/"; then
|
||||
echo "$album" >>"$TRACKING_FILE"
|
||||
echo "$(date): Successfully downloaded $album" >>"$LOG_FILE"
|
||||
|
||||
# Import to beets
|
||||
echo "$(date): Importing $album to beets..." >>"$LOG_FILE"
|
||||
if beet -p fetchart import -m -l /home/anish/music.log -q -g "$LOCAL_PATH/$album"; then
|
||||
echo "$(date): Successfully imported $album to beets" >>"$LOG_FILE"
|
||||
else
|
||||
echo "$(date): Failed to import $album to beets" >>"$LOG_FILE"
|
||||
fi
|
||||
else
|
||||
echo "$(date): Failed to download $album" >>"$LOG_FILE"
|
||||
fi
|
||||
|
@ -49,4 +57,3 @@ while IFS= read -r album; do
|
|||
done <<<"$(echo -e "$NEW_ALBUMS")"
|
||||
|
||||
echo "$(date): Music sync completed" >>"$LOG_FILE"
|
||||
|
||||
|
|
Loading…
Reference in a new issue