From d597208cbbcc212d0de00501dce2deea3d9b5025 Mon Sep 17 00:00:00 2001 From: PhotoNomad0 Date: Sat, 21 Sep 2024 10:19:01 -0400 Subject: [PATCH] tweaked to only output html --- scripts/latest/getLatestTcore.py | 82 ++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/scripts/latest/getLatestTcore.py b/scripts/latest/getLatestTcore.py index 4d4a023d4a..d3cbd82004 100644 --- a/scripts/latest/getLatestTcore.py +++ b/scripts/latest/getLatestTcore.py @@ -1,11 +1,17 @@ + +""" + +taken from SoftwareUpdateDialogContainer.js into getLatestTcore.js and converted with chatGPT +then modified to get the links for all installer formats +and the output tweak to generate html + +""" + import json import requests import re from packaging import version -################################################### -# taken from SoftwareUpdateDialogContainer.js into getLatestTcore.js and converted with chatGPT - def get_update_asset(response, installed_version, os_arch, os_platform): fallback_platform = None fallback_update = None @@ -192,27 +198,6 @@ def getStr(key): return keyToText.get(key, key) -##################################################### -# Captured html from the web page: -""" -

-Full install -
-"Windows: " -x64 - | -x86 -
-"MacOS: " - x64 - | -Universal -
-"Linux: " -x64 - | -ARM64 -""" def json_to_html(json_data, key): html = f'\n

\n{getStr(key)}\n' @@ -238,8 +223,10 @@ def json_to_html(json_data, key): 'lite': lite_installers, 'max': max_installers } -json_data = json.dumps(installers, indent=4) -print(json_data) + +# for json output uncomment +# json_data = json.dumps(installers, indent=4) +# print(json_data) html = json_to_html(max_installers, 'max') print (html) @@ -281,3 +268,46 @@ def json_to_html(json_data, key): } } """ + +##################################################### +# html output is in this format: +""" +

+Full Install +
+"Windows: " +x64 +" | " +x86 +
+"MacOS: " +x64 +" | " +Universal +
+"Linux: " +x64 +" | " +ARM64 +

+ + +

+Minimal Install +
+"Windows: " +x64 +" | " +x86 +
+"MacOS: " +x64 +" | " +Universal +
+"Linux: " +x64 +" | " +ARM64 +

+"""