From 8cf961382bc3ec648fc095dbf6b0ba97fd7f6fe4 Mon Sep 17 00:00:00 2001 From: VerstreuteSeele Date: Fri, 13 Jan 2023 13:48:40 +0100 Subject: [PATCH] Optimized playlist creator --- scripts/FlipperPlaylist.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/FlipperPlaylist.py b/scripts/FlipperPlaylist.py index b77fcbb8b..90d0a4899 100644 --- a/scripts/FlipperPlaylist.py +++ b/scripts/FlipperPlaylist.py @@ -1,21 +1,22 @@ # Flipper Zero SUB-GHZ Playlist Generator import os +from easygui import fileopenbox, diropenbox - -def windows(): - folder_path = str(input("Enter the path for the folder: ")) +def main(): + folder_path = diropenbox("Select the folder with Subghz files", "Subghz selector") + output_path = diropenbox("Select your output location", "Output location") playlist_name = str(input("Enter a name for the playlist: ")) - playlist_file = open((r"C:\Users\\fisch\\Downloads\\" + playlist_name.lower() + ".txt"), "w") + playlist_file = open((output_path + playlist_name.lower() + ".txt"), "w") playlist_file.write("# " + playlist_name + "\n") for root, dirs, files in os.walk(folder_path, topdown=True): for file in files: if file.endswith(".sub"): file_path = os.path.join(root, file) file_path = file_path.replace("\\", "/") - file_path = file_path.replace("E:", "ext") + file_path = file_path.replace(f"{folder_path.split(':')[0]}:", "ext") playlist_file.write(f"sub: {file_path}\n") playlist_file.close() print("Done!") - -windows() \ No newline at end of file +if __name__ == '__main__': + main() \ No newline at end of file