コード例 #1
0
    # Look at listsongpack.py and imitate what it's doing for each song pack.
    # Make a logger for this script.
    jsonsToWrite = []
    totalTime = 0.0
    print(">>> parsesongsfolder.py: MAKE: Making JSONs for the song packs.")
    try:
        for songPack in songPacks:
            songPackDir = os.path.join(songsDirectory,songPack)
            if os.path.isdir(songPackDir):
                try:

                    # Parse the stepfile information for the song pack.
                    print(">>> parsesongsfolder.py: MAKE: Making JSON for Song Pack '" + songPack + "'.")
                    start = time.time()
                    pack = SongPack(songPackDir)
                    pack.retrieveSongFolders() # Initialize search fields and list of folders in batch directory.
                    pack.constructStepfiles(); pack.parseStepfiles() # Make the stepfile objects and parse them.

                    # Get the Song Array (has dictionaries for each chart) from the SongPack object and save it.
                    packName = pack.getPackName()
                    songs = pack.getSongs()
                    jsonsToWrite.append(songs)
                    end = time.time()
                    elapsed = end - start
                    totalTime += elapsed
                    print(">>> parsesongsfolder.py: MAKE: Made JSON. Time Elapsed: " + str(round(elapsed,3)) + " seconds.")
                    
                except:
                    print(">>> parsesongsfolder.py: MAKE: {0}: {1}".format(sys.exc_info()[0].__name__,
                                                                 str(sys.exc_info()[1])))
コード例 #2
0
ファイル: listsongpack.py プロジェクト: Dossar/SongpackParser
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.
    """