diff --git a/plugins/utilities.json b/plugins/utilities.json index 737c4fb..d0a5c7e 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -1842,6 +1842,25 @@ "md5sum": "ce2767d38676fda5be07d1608b80b5bb" } } + }, + "update_notifier": { + "description": "Notifies when a new update is available", + "external_url": "", + "authors": [ + { + "name": "brostosjoined", + "email": "", + "discord": "brostos" + } + ], + "versions": { + "1.0.0": { + "api_version": 9, + "commit_sha": "4aca367", + "released_on": "27-05-2025", + "md5sum": "3ad8036b3491588bdc8a002803f2df58" + } + } } } } \ No newline at end of file diff --git a/plugins/utilities/update_notifier.py b/plugins/utilities/update_notifier.py new file mode 100644 index 0000000..3a86783 --- /dev/null +++ b/plugins/utilities/update_notifier.py @@ -0,0 +1,127 @@ +# ba_meta require api 9 + +#! Crafted by brostos + +from platform import machine +import threading +import time +import urllib.request +import re + +import babase +import bauiv1 as bui +import bascenev1 as bs + + +def threaded(func): + def wrapper(*args, **kwargs): + thread = threading.Thread( + target=func, args=args, kwargs=kwargs, name=func.__name__ + ) + thread.start() + + return wrapper + + +def play_sound(sound): + with bs.get_foreground_host_activity().context: + bs.getsound(sound).play() + + +@threaded +def fetch_update(): + url = 'https://ballistica.net/downloads' + try: + response = urllib.request.urlopen(url) + web_content = response.read().decode('utf-8') + except: + return + + match = re.search(r'