Esempio n. 1
0
def regenerateMusicList(initFileJsonTree):
    if 'MusicList' not in initFileJsonTree:
        return None

    gamefolder = os.path.join(current_project.settings["gamefolder"])

    if(initFileJsonTree != None):
        songs = os.path.join(gamefolder, fifl.MUSIC)
        mp3list = [f for f in listdir(songs) if os.path.isfile(os.path.join(songs, f)) and f.endswith(".mp3")]
        ogglist = [f for f in listdir(songs) if os.path.isfile(os.path.join(songs, f)) and f.endswith(".ogg")]
        wavlist = [f for f in listdir(songs) if os.path.isfile(os.path.join(songs, f)) and f.endswith(".wav")]
        originalMusicList = initFileJsonTree["MusicList"]

        filelist = mp3list + ogglist + wavlist
        MusicList = {}
        for file in filelist:
            [filewoext, ext ] = os.path.splitext(file)
            if hasattr(MusicList, filewoext):
                MusicList[filewoext][ext[1:]] = file
            else:
                MusicList[filewoext] = {}
                MusicList[filewoext][ext[1:]] = file

        if(write_file.isJsonEqual(MusicList,originalMusicList) == False):
            initFileJsonTree["MusicList"] = []
            initFileJsonTree["MusicList"] = MusicList
            return initFileJsonTree

    return None
Esempio n. 2
0
 def isEqual(self, objToCompare):
     self.updateJsonTree()
     return write_file.isJsonEqual(self.jsonTree, objToCompare.jsonTree)
Esempio n. 3
0
 def isEqual(self, objToCompare):
     self.updateJsonTree()
     return write_file.isJsonEqual(self.jsonTree,objToCompare.jsonTree)