Exemplo n.º 1
0
    # 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])))
            else:
                continue # This means it wasn't a directory
Exemplo n.º 2
0
    # 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