diff --git a/plugins/utilities/discord_richpresence.py b/plugins/utilities/discord_richpresence.py index 46dbb57..94a09a5 100644 --- a/plugins/utilities/discord_richpresence.py +++ b/plugins/utilities/discord_richpresence.py @@ -1250,4 +1250,4 @@ class DiscordRP(babase.Plugin): self.rpc_thread.presence() except Exception as e: # raise (e) - pass \ No newline at end of file + pass diff --git a/test/auto_apply_plugin_metadata.py b/test/auto_apply_plugin_metadata.py index 58633fb..031a64b 100644 --- a/test/auto_apply_plugin_metadata.py +++ b/test/auto_apply_plugin_metadata.py @@ -2,18 +2,19 @@ import ast import json import sys + def update_plugin_json(plugin_info, category): name = next(iter(plugin_info)) details = plugin_info[name] - - with open(f"{category}.json",'r+') as file: + + with open(f"{category}.json", 'r+') as file: data = json.load(file) try: # Check if plugin is already in the json data['plugins'][name] plugman_version = int(next(iter(data["plugins"][name]["versions"])).replace('.', '')) current_version = int(next(iter(details["versions"])).replace('.', '')) - # `or` In case another change was made on the plugin while still on pr + # `or` In case another change was made on the plugin while still on pr if current_version > plugman_version or current_version == plugman_version: data[name][details]["versions"][next(iter(details["versions"]))] = None elif current_version < plugman_version: @@ -21,17 +22,18 @@ def update_plugin_json(plugin_info, category): except KeyError: data["plugins"][name] = details file.seek(0) - json.dump(data, file, indent = 2, ensure_ascii=False) - # Ensure old content is removed + json.dump(data, file, indent=2, ensure_ascii=False) + # Ensure old content is removed file.truncate() - + + def extract_ba_plugman(plugins: str) -> dict | list: for plugin in plugins: if "plugins/" in plugin: # Split the path and get the part after 'plugins/' parts = plugin.split("plugins/")[1].split("/") category = parts[0] # First part after plugins/ - + with open(plugin, "r") as f: tree = ast.parse(f.read()) @@ -45,8 +47,8 @@ def extract_ba_plugman(plugins: str) -> dict | list: break else: raise ValueError(f"Variable ba_plugman not found.") - + + if __name__ == "__main__": plugins = sys.argv extract_ba_plugman(plugins) - \ No newline at end of file