exit
fi
-songs_file=$(ls $DIR | grep songs | tail -n1)
+songs_file=$(ls "$DIR" | grep songs | tail -n1)
if [ -z "$songs_file" ]; then
exit
fi
sed -i '1s/.*/<?xml version="1.0" encoding="ISO-8859-1" ?>/' "${path_to_stats}"
-difficulties=(Challenge Edit Hard Medium)
+difficulties=(Challenge Edit Hard Medium Easy)
step_types=("dance-double" "dance-single")
tiers=("1.00" "0.99" "0.98" "0.96" "0.94" "0.92" "0.89" "0.86" "0.83" "0.80" "0.76" "0.72" "0.68" "0.64" "0.60" "0.55")
declare -a null_hashes
- while read -r null; do
- the_path=$(echo "$null" | cut -sd / -f2,3 | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'/\'"'"'/g')
- null_hashes+=("${hash_map[$the_path]}")
- done <<< "$nulls"
+ if ! [ -z "$nulls" ]; then
+ while read -r null; do
+ the_path=$(echo "$null" | cut -sd / -f2,3 | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'/\'"'"'/g')
+ if ! [ -z "${hash_map[$the_path]}" ]; then
+ null_hashes+=("${hash_map[$the_path]}")
+ fi
+ done <<< "$nulls"
+ fi
new_song=false
song_hash=""
fi
if (( $counter % 2 )); then
- d+=($m)
- else
t+=($m)
+ else
+ d+=($m)
fi
counter=$((counter+1))
done <<< "$meta"
# 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
- writeout=""
+ writeout="${me_highscore_name}"
for fuck in "${!mmeta[@]}"; do
the_score=$(echo ${mmeta[$fuck]} | cut -sd : -f1)
the_scorer=$(echo ${mmeta[$fuck]} | cut -sd : -f2)
# but probably it's fine
for fuck in "${!all_song_hashes[@]}"; do
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\" \
-o \"SONG:${fuck}\" -n \
-o \"STEPTYPES\" -n \
if [[ ${i:0:4} = "SONG" ]]; then
if [ "$no_dump" = false ]; then
for j in "${!jjj_types[@]}"; do
- writeout="${writeout}\n${jjj_hash}:${jjj_types[$j]}::${jjj_diffs[$j]}:${jjj_scores[$j]}"
+ writeout="${writeout}\n${jjj_hash}:${jjj_diffs[$j]}::${jjj_types[$j]}:${jjj_scores[$j]}"
done
else
writeout="${writeout}\n${jjj_hash}:NODATA"
hash_map["$hash"]+="$path"
done <<< "$song_paths"
+ bros=("$me_highscore_name")
if find "${DIR}"/*.scores.txt -type f -print -quit 2>/dev/null | grep -q .; then
while read -d $'\0' file; do
basename=$(basename "$file")
# in the push command, null nodes get written to scores.txt as hash:NODATA
# so the next time apply runs, we know that they had already been copied over, and we don't have to run
# xmlstarlet again
- null_files["("$(echo $i | cut -sd : -f1)")"]+="$person"
+
+ # TODO: This should only run when looking at the scores file for $me
+ # Then later on when we process the pranks, unset any hashes that turn out to have a score elsewhere
+ # before finally adding the null nodes
+ null_files[$(echo $i | cut -sd : -f1)]+="$person"
else
song_score=$(echo $i | rev | cut -sd : -f1 | rev)
song_steps_type=$(echo $i | rev | cut -sd : -f2 | rev)
# only try find files for which there is actually nothing in scores.txt
if [ "$had_score" = false ] && [ -z "${null_files[${hash}]}" ]; then
+ echo "$hash had no score and is not in nulls"
song="${hash_map[${hash}]}"
+ song=$(echo $song | sed 's/`/\\\`/g')
xmlstarlet_orphans_cmd="$xmlstarlet_orphans_cmd -i \"//SongScores//Song[@Dir=\\\"Songs/${song}/\\\"]//Steps//HighScore[1]//PercentDP\" \
-o \"SONG:${hash}\" -n \
-o \"STEPTYPES\" -n \
source "$DIR/config.sh"
date=$(date +%s)
-for f in ${DIR}/*.scores.txt; do
+for f in "${DIR}"/*.scores.txt; do
base=$(basename "$f" | cut -sd . -f1,2)
mv -- "$f" "${DIR}/${base}.${date}.txt"
done
-for f in ${DIR}/*.favourites.txt; do
+for f in "${DIR}"/*.favourites.txt; do
base=$(basename "$f" | cut -sd . -f1,2)
mv -- "$f" "${DIR}/${base}.${date}.txt"
done
scp groovenet@cameron1729.xyz:/mnt/media/GrooveNet/*.txt "$DIR"
-for f in ${DIR}/*.scores.txt; do
+for f in "${DIR}"/*.scores.txt; do
base=$(basename "$f" | cut -sd . -f1,2)
backed_up_file="${base}.${date}.txt"
if [ -f "${DIR}/$backed_up_file" ]; then
fi
done
-for f in ${DIR}/*.favourites.txt; do
+for f in "${DIR}"/*.favourites.txt; do
base=$(basename "$f" | cut -sd . -f1,2)
backed_up_file="${base}.${date}.txt"
if [ -f "${DIR}/$backed_up_file" ]; then