diff --git a/README.md b/README.md index 858eb10..e381a1d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ To use it just launch the executable file (if available for your os) or type "py If you have any issues make a gitlab issue. There may be bugs. ## Roadmap +* improve the single-song actions to make them more persistant * modify restore_ogmusic so it is able to restore only the last change. Maybe config files will be needed for this. * make it so that if "you press apply music and then replace song" it checks for that and doesn't allow the "replaced song" to be reverted back to original. * "now playing" text diff --git a/mmm-nsf-changer.py b/mmm-nsf-changer.py index 8f7f9e3..ce031dd 100644 --- a/mmm-nsf-changer.py +++ b/mmm-nsf-changer.py @@ -75,7 +75,7 @@ def get_original_songs(megamaker_folder): window.write_event_value('-THREAD DONE-', True) return True -app_version = "v1.3" +app_version = "v2.0" def check_if_new_version(): response = requests.get("https://gitlab.com/api/v4/projects/51771052/repository/tags") newest_version = response.json()[0]["name"] @@ -297,7 +297,7 @@ title = [ change_all = [ [sg.Button("Mute All"), sg.Button("Apply Music"), sg.Button("Restore Music")], - [sg.Button("Apply as Boss Music"), sg.Button("Apply as Level Music"), sg.Button("Mute Level Music"), sg.Button("Mute Boss Music")] + [sg.Checkbox("Boss Music", default=True, key="-BOSS-"), sg.Checkbox("Level Music", default=True, key="-LEVEL-")] ] change_one = [ @@ -326,8 +326,11 @@ while True: window.set_icon(icon) window.refresh() if event in (sg.WINDOW_CLOSED,"Exit"): - sg.user_settings_set_entry('-INPUT_NSF-', values['-IN-']) - sg.user_settings_set_entry('-MEGAMAKER_FOLDER-', values['-OUT-']) + try: + sg.user_settings_set_entry('-INPUT_NSF-', values['-IN-']) + sg.user_settings_set_entry('-MEGAMAKER_FOLDER-', values['-OUT-']) + except TypeError: + pass break window.Element('_IMAGE_').UpdateAnimation(gif, time_between_frames=100) if running: @@ -347,23 +350,18 @@ while True: if event == "About": sg.popup(how_to_use) if event == "Mute All": - create_mute_file(mute_nsf) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"]): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"]): - sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") - if event == "Mute Boss Music": - create_mute_file(mute_nsf) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=boss_music()): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=boss_music()): - sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") - if event == "Mute Level Music": - create_mute_file(mute_nsf) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=level_music()): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=level_music()): - sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") + if values["-BOSS-"] == True or values["-LEVEL-"] == True: + if values["-BOSS-"] == True and values["-LEVEL-"] == True: + whitelist = [] + elif values["-BOSS-"] == True: + whitelist = boss_music() + elif values["-LEVEL-"] == True: + whitelist = level_music() + create_mute_file(mute_nsf) + if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=whitelist): + restore_ogmusic(values["-OUT-"]) + if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=whitelist): + sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") if event == "Replace Song": if values["-DROPDOWN-"] == "": sg.popup_error('Please select which Output NSF File to replace. If not, use "Replace *All* NSF Music".') @@ -379,24 +377,24 @@ while True: else: window["-LAST-CHANGED-"].update("") if event == "Apply Music": - if not nsf_changer(values["-IN-"], values["-OUT-"]): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(values["-IN-"], values["-OUT-"]): - sg.popup_error("MegaMaker folder is not valid or definitions out of date.") + if values["-BOSS-"] == True or values["-LEVEL-"] == True: + if values["-BOSS-"] == True and values["-LEVEL-"] == True: + whitelist = [] + elif values["-BOSS-"] == True: + whitelist = boss_music() + elif values["-LEVEL-"] == True: + whitelist = level_music() + + if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=whitelist): + restore_ogmusic(values["-OUT-"]) + if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=whitelist): + sg.popup_error("MegaMaker folder is not valid or definitions out of date.") + else: + sg.popup("None of the checkboxes are active.") if event == "Restore Music": # Needs testing # sg.popup_error("DOESNT WORK EITHER HAHAHAHAHAHAA") if not restore_ogmusic(values["-OUT-"]): sg.popup_error("Already Restored or wrong Mega Man Maker folder.") - if event == "Apply as Boss Music": - if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=boss_music()): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=boss_music()): - sg.popup_error("MegaMaker folder is not valid or definitions out of date.") - if event == "Apply as Level Music": - if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=level_music()): - restore_ogmusic(values["-OUT-"]) - if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=level_music()): - sg.popup_error("MegaMaker folder is not valid or definitions out of date.") if event == "Download and Restore Music": sg.popup_yes_no("WARNING: This will erase all custom songs.\nDo you want to continue?", location=window.current_location()) window["-LAST-CHANGED-"].update("")