2023-09-30 15:34:06 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
tree,
|
|
|
|
...
|
2024-07-06 17:20:28 +01:00
|
|
|
}: {
|
2024-07-24 14:13:59 +01:00
|
|
|
imports = with tree.profiles.home-manager; [
|
|
|
|
apps.rclone
|
|
|
|
apps.musicutil
|
2023-09-30 15:34:06 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
home.packages = [
|
|
|
|
pkgs.nodePackages.html-minifier
|
|
|
|
];
|
|
|
|
|
2024-03-10 18:27:22 +00:00
|
|
|
home.file."Music/music-sync-check.sh" = {
|
|
|
|
executable = true;
|
|
|
|
text = ''
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
cd "''${SCRIPT_DIR}"
|
|
|
|
|
|
|
|
ERROR_LOG=$(mktemp -t music-check-log-XXX)
|
|
|
|
|
|
|
|
echo "Checking StorageBox sync status"
|
|
|
|
if rclone check . Storage:Music --exclude "/*.sh" 2>$ERROR_LOG; then
|
|
|
|
echo "Up to date with StorageBox"
|
|
|
|
else
|
|
|
|
echo "An error occured attempting to check sync status:"
|
|
|
|
cat "$ERROR_LOG"
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm "$ERROR_LOG"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-05-25 21:10:26 +01:00
|
|
|
home.file."Music/music-gen-listing.sh" = {
|
2023-09-30 15:34:06 +01:00
|
|
|
executable = true;
|
|
|
|
text = ''
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-05-25 21:10:26 +01:00
|
|
|
TMPDIR=$(mktemp -d)
|
2023-09-30 15:34:06 +01:00
|
|
|
|
|
|
|
TITLE="chaos's Music Library"
|
|
|
|
DESCRIPTION="A listing of all music we listen to and have downloaded/brought"
|
|
|
|
LINK_BASE="https://storage-http.owo.monster/Music"
|
|
|
|
|
|
|
|
musicutil genhtml . "$TMPDIR" --title "$TITLE" --description "$DESCRIPTION" --link-base="$LINK_BASE"
|
|
|
|
|
|
|
|
pushd "$TMPDIR"
|
|
|
|
|
|
|
|
html-minifier \
|
|
|
|
--collapse-whitespace --remove-comments \
|
|
|
|
--remove-redundant-attributes --remove-script-type-attributes \
|
|
|
|
--remove-tag-whitespace --use-short-doctype \
|
|
|
|
index.html > index_min.html
|
|
|
|
mv index_min.html index.html
|
|
|
|
|
|
|
|
rsync --recursive ./ hetzner-arm:/var/lib/static-sites/music_library/
|
|
|
|
ssh hetzner-arm chown -R nginx:nginx /var/lib/static-sites/music_library
|
|
|
|
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-05-25 21:10:26 +01:00
|
|
|
home.file."Music/music-sync.sh" = {
|
|
|
|
executable = true;
|
|
|
|
text = ''
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
cd "''${SCRIPT_DIR}"
|
|
|
|
|
|
|
|
rclone sync -P . Storage:Music --exclude "/*.sh"
|
|
|
|
|
|
|
|
bash $HOME/Music/music-gen-listing.sh
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-09-30 15:34:06 +01:00
|
|
|
home.file."Music/music-download.sh" = {
|
|
|
|
executable = true;
|
|
|
|
text = ''
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
cd "''${SCRIPT_DIR}"
|
|
|
|
|
|
|
|
rclone sync -P --exclude music-sync.sh,music-download.sh Storage:Music .
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|