From 1e2ed4ab49ce22ef4773f1f853c7ccced5300b3b Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Tue, 2 Apr 2019 15:31:01 +0800 Subject: [PATCH] Delete cache entries for favourites on creation --- FaveSync.sh | 6 ++++++ SongSync.sh | 4 ++-- config.sh.example | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/FaveSync.sh b/FaveSync.sh index 048e674..4e04c19 100755 --- a/FaveSync.sh +++ b/FaveSync.sh @@ -49,6 +49,12 @@ if [ "$1" = "apply" ]; then while read -r song_path; do just_song=$(echo $song_path | cut -sd / -f2) + crc32="$(echo -n "/Songs/${persons_folder}/${just_song}/" | gzip -c | tail -c8 | hexdump -n4 -e '"%u"')" + + echo "${just_song} -> ${persons_folder}" + echo -e "\t${path_to_song_cache}/${crc32}" + + rm "${path_to_song_cache}/${crc32}" ln -s "$path_to_songs/$song_path" "$path_to_songs/$persons_folder/$just_song" done <<< "$song_paths" done diff --git a/SongSync.sh b/SongSync.sh index 228da8c..76ab323 100755 --- a/SongSync.sh +++ b/SongSync.sh @@ -83,9 +83,9 @@ if [ "$1" = "apply" ]; then for add_path in "${!adds[@]}"; do pack_dir=$(echo $add_path | cut -sd / -f1) if ! [ -z "${removes[${add_path}]}" ]; then - crc32="$(echo -n "${add_path}/" | gzip -c | tail -c8 | hexdump -n4 -e '"%u"')" + crc32="$(echo -n "/Songs/${add_path}/" | gzip -c | tail -c8 | hexdump -n4 -e '"%u"')" echo "CACHE INVALIDATION NEEDED FOR ${add_path} : ${crc32}" - rm "~/.openitg/Cache/Songs/${crc32}" + rm "${path_to_song_cache}/${crc32}" fi # The file existed previously, just move that over. diff --git a/config.sh.example b/config.sh.example index ef94084..8d767d5 100644 --- a/config.sh.example +++ b/config.sh.example @@ -6,3 +6,4 @@ path_to_songs="/home/cameron/OpenITG beta 2/Songs" path_to_stats="/home/cameron/Projects/GrooveNet/Stats.jayce.xml" faves_folder="- Favourites - Jayce" external_favourite_naming_scheme="- Favourites - %person%" +path_to_song_cache="/root/.openitg/Cache/Songs" -- 2.11.0