Don't duplicate NODATA in scores.txt
authorCameron Ball <cameron@cameron1729.xyz>
Sat, 6 Jul 2019 07:47:06 +0000 (15:47 +0800)
committerCameron Ball <cameron@cameron1729.xyz>
Sat, 6 Jul 2019 07:47:06 +0000 (15:47 +0800)
ScoreSync.sh

index 874f1c3..abe5ed1 100755 (executable)
@@ -153,6 +153,7 @@ if [ "$1" = "push" ]; then
         # if someone else has the score on it add it to writeout with NODATA
         # if it is in null nodes (need to write code for this) add it to writeout with NODATA
         # all_song_hashes should now have the information we need to retrieve the song from elsewhere in stats.xml
+        declare -A nodatas
         writeout="${me_highscore_name}"
         for fuck in "${!mmeta[@]}"; do
             the_score=$(echo ${mmeta[$fuck]} | cut -sd : -f1)
@@ -162,7 +163,10 @@ if [ "$1" = "push" ]; then
             if [ "$the_scorer" = "$me_highscore_name" ] || [ "$the_scorer" = "EVNT" ]; then
                 writeout="$writeout\n${fuck}:${the_score}"
             else
-                writeout="$writeout\n${just_hash}:NODATA"
+                if [ -z "${nodatas["${just_hash}"]}" ]; then
+                    writeout="$writeout\n${just_hash}:NODATA"
+                    nodatas["${just_hash}"]="${just_hash}"
+                fi
             fi
             unset all_song_hashes["$just_hash"]
             #echo "$fuck $the_score $the_scorer"