echo -e "${last_tags_removed}${new_nodes}\n</SongScores>\n</Stats>" > "${path_to_stats}"
fi
-if [ "$1" = "push" ]; then
- if find "${DIR}"/*.favourites.txt -type f -print -quit 2>/dev/null | grep -q .; then
- echo "$me_highscore_name" > "${DIR}/$me.scores.txt"
- find "${DIR}"/*.favourites.txt -type f -print0 | while read -d $'\0' file; do
- file=$(basename "$file")
-
- IFS=$'\n' read -d '' -r -a lines < "${DIR}/$file"
- unmodded_person="${file%.*.*}"
- person="${file%.*.*}"
- if [ "$person" = "$me" ]; then
- persons_folder="$faves_folder"
- else
- person="$(tr '[:lower:]' '[:upper:]' <<< ${person:0:1})${person:1}"
- persons_folder=${external_favourite_naming_scheme/\%person\%/$person}
- fi
-
- xpaths=""
- for i in "${lines[@]}"; do
- just_song=$(echo $i | cut -sd / -f2)
- just_song=${just_song/\`/\\\`}
- song_dir="Songs/$persons_folder/$just_song/"
-
- for d in "${difficulties[@]}"; do
- my_score_xpath='(//SongScores//Song[@Dir=\"'"$song_dir"'\"]//Steps[@Difficulty=\"'"$d"'\" and @StepsType=\"dance-single\"]//Name[text()=\"EVNT\" or text()=\"'"$me_highscore_name"'\"]/following-sibling::PercentDP)[1]'
- highest_score_name_xpath='(//SongScores//Song[@Dir=\"'"$song_dir"'\"]//Steps[@Difficulty=\"'"$d"'\" and @StepsType=\"dance-single\"]//Name)[1]'
- xpaths="-o \"$unmodded_person/$just_song:\" -v \"$my_score_xpath\" -o \":\" -v \"$highest_score_name_xpath\" -o \":$d\" -n $xpaths"
- done
- done
-
- cmd="xmlstarlet sel -T -t $xpaths \"${path_to_stats}\""
- result=$(eval "$cmd")
-
- IFS=$'\n' read -d '' -r -a array <<< "$result"
- for i in "${array[@]}"; do
- echo "$i" >> "${DIR}/$me.scores.txt"
- done
- done
- fi
- scp "$DIR/$me.scores.txt" groovenet@cameron1729.xyz:/mnt/media/GrooveNet
-fi
-
if [ "$1" = "pull" ]; then
scp groovenet@cameron1729.xyz:/mnt/media/GrooveNet/* "$DIR"
fi