# TODO: Technically these queries are not quite specific enough. They could find scores left by players other than the machine owner
# but probably it's fine
for fuck in "${!all_song_hashes[@]}"; do
- # TODO: After the initial apply and push, running this a second time should result in way less shit in "fuck" - only stuff faved that session should be here
- echo "$fuck"
pathh=$(cat "${DIR}/${songs_file}" | grep $fuck | cut -sd / -f5,6 )
pathh=$(echo $pathh | sed 's/`/\\\`/g')
xmlstarlet_orphans_cmd="$xmlstarlet_orphans_cmd -i \"//SongScores//Song[@Dir=\\\"Songs/${pathh}/\\\"]//Steps//HighScore[1]//PercentDP\" \
--break"
done
- scores_living_elsewhere=$(eval "xmlstarlet sel -t $xmlstarlet_orphans_cmd -o \"SONG\" \"${path_to_stats}\"")
- IFS=$'\n' read -rd '' -a scores_elsewhere <<<"$scores_living_elsewhere"
-
- declare -a jjj_types
- declare -a jjj_diffs
- declare -a jjj_scores
- past_steptypes=false
- past_difficulties=false
- past_scores=false
- no_dump=false
- for i in "${scores_elsewhere[@]}"; do
- if [[ ${i:0:4} = "SONG" ]]; then
- if [ "$no_dump" = false ]; then
- for j in "${!jjj_types[@]}"; do
- writeout="${writeout}\n${jjj_hash}:${jjj_diffs[$j]}::${jjj_types[$j]}:${jjj_scores[$j]}"
- done
- else
- writeout="${writeout}\n${jjj_hash}:NODATA"
- fi
+ if ! [ -z "$xmlstarlet_orphans_cmd" ]; then
+ scores_living_elsewhere=$(eval "xmlstarlet sel -t $xmlstarlet_orphans_cmd -o \"SONG\" \"${path_to_stats}\"")
+ IFS=$'\n' read -rd '' -a scores_elsewhere <<<"$scores_living_elsewhere"
- jjj_types=()
- jjj_diffs=()
- jjj_scores=()
- past_steptypes=false
- past_difficulties=false
- past_scores=false
- no_dump=false
- jjj_hash=$(echo $i | cut -sd ':' -f2)
- continue
- fi
+ declare -a jjj_types
+ declare -a jjj_diffs
+ declare -a jjj_scores
+ past_steptypes=false
+ past_difficulties=false
+ past_scores=false
+ no_dump=false
+ for i in "${scores_elsewhere[@]}"; do
+ if [[ ${i:0:4} = "SONG" ]]; then
+ if [ "$no_dump" = false ]; then
+ for j in "${!jjj_types[@]}"; do
+ writeout="${writeout}\n${jjj_hash}:${jjj_diffs[$j]}::${jjj_types[$j]}:${jjj_scores[$j]}"
+ done
+ else
+ writeout="${writeout}\n${jjj_hash}:NODATA"
+ fi
- if [ "$i" = "NOSCORES" ]; then
- no_dump=true
- continue
- fi
+ jjj_types=()
+ jjj_diffs=()
+ jjj_scores=()
+ past_steptypes=false
+ past_difficulties=false
+ past_scores=false
+ no_dump=false
+ jjj_hash=$(echo $i | cut -sd ':' -f2)
+ continue
+ fi
- if [ "$i" = "STEPTYPES" ]; then
- past_steptypes=true
- continue
- fi
+ if [ "$i" = "NOSCORES" ]; then
+ no_dump=true
+ continue
+ fi
- if [ "$i" = "DIFFICULTIES" ]; then
- past_difficulties=true
- continue
- fi
+ if [ "$i" = "STEPTYPES" ]; then
+ past_steptypes=true
+ continue
+ fi
- if [ "$i" = "SCORES" ]; then
- past_scores=true
- continue
- fi
+ if [ "$i" = "DIFFICULTIES" ]; then
+ past_difficulties=true
+ continue
+ fi
- if [ "$past_scores" = true ]; then
- jjj_scores+=("$i")
- continue
- fi
+ if [ "$i" = "SCORES" ]; then
+ past_scores=true
+ continue
+ fi
- if [ "$past_difficulties" = true ]; then
- jjj_diffs+=("$i");
- continue
- fi
+ if [ "$past_scores" = true ]; then
+ jjj_scores+=("$i")
+ continue
+ fi
- if [ "$past_steptypes" = true ]; then
- jjj_types+=("$i")
- continue
- fi
- done
+ if [ "$past_difficulties" = true ]; then
+ jjj_diffs+=("$i");
+ continue
+ fi
+
+ if [ "$past_steptypes" = true ]; then
+ jjj_types+=("$i")
+ continue
+ fi
+ done
+ fi
echo -e "$writeout" > "${DIR}/$me.scores.txt"
scp "$DIR/$me.scores.txt" groovenet@cameron1729.xyz:/mnt/media/GrooveNet
fi