diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
commit | 204731c0a69136c9cebcb54f1afecf5145e26bbe (patch) | |
tree | fc9132e5dc74e4a8e1327cdd411839a90f9410aa /pkgs/sources/scripts/source/specific/spodi/sh/update.sh | |
parent | refactor(sys): Modularize and move to `modules/system` or `pkgs` (diff) | |
download | nixos-config-204731c0a69136c9cebcb54f1afecf5145e26bbe.zip |
refactor(pkgs): Categorize into `by-name` shards
This might not be the perfect way to organize a package set -- especially if the set is not nearly the size of nixpkgs -- but it is _at_ least a way of organization.
Diffstat (limited to 'pkgs/sources/scripts/source/specific/spodi/sh/update.sh')
-rwxr-xr-x | pkgs/sources/scripts/source/specific/spodi/sh/update.sh | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/pkgs/sources/scripts/source/specific/spodi/sh/update.sh b/pkgs/sources/scripts/source/specific/spodi/sh/update.sh deleted file mode 100755 index a289cf58..00000000 --- a/pkgs/sources/scripts/source/specific/spodi/sh/update.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env dash - -update() { - UPDATE_DIRECTORY="%XDG_MUSIC_DIR/artists" - UPDATE_CONFIG_FILE="%XDG_MUSIC_DIR/artists/update.conf" - - if ! [ -f "$UPDATE_CONFIG_FILE" ]; then - error="$( - cat <<EOF -Please provide an update config file at: '$UPDATE_CONFIG_FILE'. - -The 'update.conf' file should follow this pattern: -<path_to_artist>/<artist_name>|<spotify_url> - -All comments and empty lines are ignored -EOF - )" - die "$error" - fi - - config_file="$(mktmp)" - clean "$UPDATE_CONFIG_FILE" >"$config_file" - - while IFS="|" read -r artist url; do - full_artist="$UPDATE_DIRECTORY/$artist" - [ -d "$full_artist" ] || mkdir --parents "$full_artist" - [ -d "$full_artist/update" ] || mkdir --parents "$full_artist/update" - [ -d "$full_artist/all" ] || mkdir --parents "$full_artist/all" - [ -d "$full_artist/filtered" ] || mkdir --parents "$full_artist/filtered" - - while read -r file; do - ln --symbolic --relative "$file" "$full_artist/update/$(basename "$file")" - done <"$(tmp fd --type file --extension opus . "$full_artist/all")" - - msg2 "Updating $artist with url: '$url'" - download "$url" "$full_artist/update" - - while read -r file; do - mv "$file" "$full_artist/all" - ln --symbolic --relative "$full_artist/all/$(basename "$file")" "$full_artist/filtered/$(basename "$file")" - done <"$(tmp fd --type file --extension opus . "$full_artist/update")" - - while read -r file; do - rm "$file" - done <"$(tmp fd --type symlink --extension opus . "$full_artist/update")" - - cp "$full_artist/update/spotdl.log" "$full_artist/all/spotdl.$(date +%Y_%m_%d).log" - cp "$full_artist/update/spotdl-errors.log" "$full_artist/all/spotdl-errors.$(date +%Y_%m_%d).log" - done <"$config_file" -} - -# vim: ft=sh |