3 DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4 source "$DIR/config.sh"
10 songs_file
=$
(ls "$DIR" |
grep songs |
tail -n1
)
12 if [ -z
"$songs_file" ]; then
16 if [ "$1" = "apply" ]; then
17 if [ -f
"$DIR"/footspeed.txt
]; then
18 IFS
=$
'\n' read -d
'' -r
-a lines
< "$DIR"/footspeed.txt
20 rm -rf
"$path_to_songs/$footspeed_folder"
21 mkdir
"$path_to_songs/$footspeed_folder"
24 for i
in "${lines[@]}"; do
25 if [ -z
"${song_paths[$i]}" ]; then
26 song_paths
["$i"]+=$
(grep $i "${DIR}/${songs_file}" | cut
-sd
/ -f5-6
)
30 for song_path
in "${song_paths[@]}"; do
32 just_song
=$
(echo "$song_path" | cut
-sd
/ -f2
)
33 original_folder
=$
(echo "$song_path" | cut
-sd
/ -f1
)
34 crc32
="$(echo -n "/Songs
/${footspeed_folder}/${just_song}/" | gzip -c | tail -c8 | hexdump -n4 -e '"%u
"')"
36 echo "${just_song} -> footspeed"
37 echo -e
"\t${path_to_song_cache}/${crc32}"
39 #rm "${path_to_song_cache}/${crc32}"
40 ln -s
"$path_to_songs/$song_path" "$path_to_songs/$footspeed_folder/$original_folder - $just_song"
41 done <<< "$song_paths"
44 if [ -f
"$DIR"/stamina.txt
]; then
45 IFS
=$
'\n' read -d
'' -r
-a lines
< "$DIR"/stamina.txt
47 rm -rf
"$path_to_songs/$stamina_folder"
48 mkdir
"$path_to_songs/$stamina_folder"
51 for i
in "${lines[@]}"; do
52 if [ -z
"${song_paths[$i]}" ]; then
53 song_paths
["$i"]+=$
(grep $i "${DIR}/${songs_file}" | cut
-sd
/ -f5-6
)
57 for song_path
in "${song_paths[@]}"; do
59 just_song
=$
(echo $song_path | cut
-sd
/ -f2
)
60 original_folder
=$
(echo "$song_path" | cut
-sd
/ -f1
)
61 crc32
="$(echo -n "/Songs
/${stamina_folder}/${just_song}/" | gzip -c | tail -c8 | hexdump -n4 -e '"%u
"')"
63 echo "${just_song} -> stamina"
64 echo -e
"\t${path_to_song_cache}/${crc32}"
66 #rm "${path_to_song_cache}/${crc32}"
67 ln -s
"$path_to_songs/$song_path" "$path_to_songs/$stamina_folder/$original_folder - $just_song"
68 done <<< "$song_paths"