Delete cache entries for favourites on creation
authorCameron Ball <cameron@moodle.com>
Tue, 2 Apr 2019 07:31:01 +0000 (15:31 +0800)
committerCameron Ball <cameron@moodle.com>
Tue, 2 Apr 2019 07:36:40 +0000 (15:36 +0800)
FaveSync.sh
SongSync.sh
config.sh.example

index 048e674..4e04c19 100755 (executable)
@@ -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
index 228da8c..76ab323 100755 (executable)
@@ -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.
index ef94084..8d767d5 100644 (file)
@@ -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"