/
listsongpack.py
58 lines (46 loc) · 1.68 KB
/
listsongpack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python3
from containers.songpack import SongPack
import pprint
import json
import os
# MAIN
# C:\dev\cs_site\site_idea\Sexuality Violation
if __name__ == "__main__":
# Create prettyprinter object
pp = pprint.PrettyPrinter(indent=4)
# Create Batch Object with user specified directory.
print(">>> listsongpack.py looks through a song pack directory and retrieves song "
"information from it including chart information.")
songPackPath = (input(">>> Input full path to directory of Song Pack Folder: ")).strip()
pack = SongPack(songPackPath)
# Initialize search fields and list of folders in batch directory.
print(">>> Getting list of folders in song pack directory.")
pack.retrieveSongFolders()
print(pack)
# Make the stepfile objects and parse them.
print(">>> Constructing Simfile Objects and parsing them.")
pack.constructStepfiles()
pack.parseStepfiles()
print(pack)
"""
The following would be for checking each Stepfile object.
"""
# for stepfile in pack.getStepfiles():
# pp.pprint(stepfile.getSongDict())
"""
The following would be for checking the SongPack object.
"""
# pp.pprint(pack.getSongs())
"""
Try to get the Song Dictionary from the SongPack object and then write it out
to a file, similar to JSON stuff.
"""
print(">>> Writing JSON file for song pack.")
packName = pack.getPackName()
songs = pack.getSongs()
outFilePath = os.path.join(songPackPath, packName + ".json")
with open(outFilePath, 'w') as outFile:
json.dump(songs, outFile, indent=4)
outFile.close()
print(">>> Successfully wrote JSON file.")
# NOPE