mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
a6fe6f4014
commit
caf3d57374
1 changed files with 20 additions and 17 deletions
|
|
@ -22,49 +22,50 @@ def threaded(func):
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def play_sound(sound):
|
def play_sound(sound):
|
||||||
with bs.get_foreground_host_activity().context:
|
with bs.get_foreground_host_activity().context:
|
||||||
bs.getsound(sound).play()
|
bs.getsound(sound).play()
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def fetch_update():
|
def fetch_update():
|
||||||
url = 'https://ballistica.net/downloads'
|
url = 'https://ballistica.net/downloads'
|
||||||
try:
|
try:
|
||||||
response = urllib.request.urlopen(url)
|
response = urllib.request.urlopen(url)
|
||||||
web_content = response.read().decode('utf-8')
|
web_content = response.read().decode('utf-8')
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
match = re.search(r'<td class="onlydesktop">(\d+)</td>', web_content)
|
match = re.search(r'<td class="onlydesktop">(\d+)</td>', web_content)
|
||||||
if match:
|
if match:
|
||||||
latest_build_number = match.group(1)
|
latest_build_number = match.group(1)
|
||||||
current_build_number = babase.app.env.engine_build_number
|
current_build_number = babase.app.env.engine_build_number
|
||||||
if latest_build_number == current_build_number:
|
if latest_build_number == current_build_number:
|
||||||
return
|
return
|
||||||
|
|
||||||
pattern = r'<a\s+href=["\']([^"\']+\.(?:apk|tar\.gz|dmg|zip))["\']'
|
pattern = r'<a\s+href=["\']([^"\']+\.(?:apk|tar\.gz|dmg|zip))["\']'
|
||||||
|
|
||||||
# Find all matches in the HTML content
|
# Find all matches in the HTML content
|
||||||
matches = re.findall(pattern, web_content)
|
matches = re.findall(pattern, web_content)
|
||||||
|
|
||||||
download_links = []
|
download_links = []
|
||||||
|
|
||||||
for link in matches:
|
for link in matches:
|
||||||
# Skip navigation links
|
# Skip navigation links
|
||||||
if link.startswith(('?', '/', 'old/')):
|
if link.startswith(('?', '/', 'old/')):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Create full URL if needed
|
# Create full URL if needed
|
||||||
if not link.startswith('http'):
|
if not link.startswith('http'):
|
||||||
full_url = url + link
|
full_url = url + link
|
||||||
else:
|
else:
|
||||||
full_url = link
|
full_url = link
|
||||||
|
|
||||||
download_links.append(full_url)
|
download_links.append(full_url)
|
||||||
|
|
||||||
|
|
||||||
build = babase.app.env.gui
|
build = babase.app.env.gui
|
||||||
bs_platform = babase.app.classic.platform
|
bs_platform = babase.app.classic.platform
|
||||||
mash = machine().lower()
|
mash = machine().lower()
|
||||||
if bs_platform.lower() == 'linux':
|
if bs_platform.lower() == 'linux':
|
||||||
if mash in ("x86_64", "amd64"):
|
if mash in ("x86_64", "amd64"):
|
||||||
|
|
@ -76,13 +77,14 @@ def fetch_update():
|
||||||
bs_platform = "Mac_x86_64"
|
bs_platform = "Mac_x86_64"
|
||||||
elif mash in ("aarch64", "arm64"):
|
elif mash in ("aarch64", "arm64"):
|
||||||
bs_platform = "Mac_Arm64"
|
bs_platform = "Mac_Arm64"
|
||||||
|
|
||||||
for link in download_links:
|
for link in download_links:
|
||||||
link_lower = link.lower()
|
link_lower = link.lower()
|
||||||
extension = link.replace('https://files.ballistica.net/bombsquad/builds/', '')
|
extension = link.replace('https://files.ballistica.net/bombsquad/builds/', '')
|
||||||
if build:
|
if build:
|
||||||
if not ('server' in link_lower) and bs_platform.lower() in link_lower:
|
if not ('server' in link_lower) and bs_platform.lower() in link_lower:
|
||||||
babase.screenmessage("A new BombSquad version is available...\nRedirecting to download page", (0.21, 1.0, 0.20))
|
babase.screenmessage(
|
||||||
|
"A new BombSquad version is available...\nRedirecting to download page", (0.21, 1.0, 0.20))
|
||||||
sound_sequence = [
|
sound_sequence = [
|
||||||
("drumRoll", 0),
|
("drumRoll", 0),
|
||||||
("fanfare", 0),
|
("fanfare", 0),
|
||||||
|
|
@ -110,8 +112,9 @@ def fetch_update():
|
||||||
time.sleep(4)
|
time.sleep(4)
|
||||||
webbrowser.open(f'https://ballistica.net/downloads#:~:text={extension}')
|
webbrowser.open(f'https://ballistica.net/downloads#:~:text={extension}')
|
||||||
except:
|
except:
|
||||||
print(f"{GREEN}Download the latest version using this official link-> {LIGHT_BLUE}{link}{RESET}")
|
print(
|
||||||
|
f"{GREEN}Download the latest version using this official link-> {LIGHT_BLUE}{link}{RESET}")
|
||||||
|
|
||||||
|
|
||||||
# ba_meta export babase.Plugin
|
# ba_meta export babase.Plugin
|
||||||
class bybrostos(babase.Plugin):
|
class bybrostos(babase.Plugin):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue