From 4c780a89f77b7f02e1eb47ffd16b8143d284ee5d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 03:44:48 +0000 Subject: [PATCH 1/5] Initial plan From 975cac8b7b6bc5079f9fe1e85e71b11a60252529 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 03:50:13 +0000 Subject: [PATCH 2/5] Update ttsdk_downloader to auto-detect latest SDK version Co-authored-by: ChrisDuffley <64235743+ChrisDuffley@users.noreply.github.com> --- tools/ttsdk_downloader.py | 68 +++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/tools/ttsdk_downloader.py b/tools/ttsdk_downloader.py index 1e2c1b3..e92faa2 100755 --- a/tools/ttsdk_downloader.py +++ b/tools/ttsdk_downloader.py @@ -18,7 +18,6 @@ url = "https://bearware.dk/teamtalksdk" - def get_url_suffix_from_platform() -> str: machine = platform.machine() if sys.platform == "win32": @@ -42,21 +41,50 @@ def get_url_suffix_from_platform() -> str: def download() -> None: - headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'} + headers = { + 'User-Agent': ( + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/58.0.3029.110 Safari/537.3' + ) + } r = requests.get(url, headers=headers) page = bs4.BeautifulSoup(r.text, features="html.parser") - # The last tested version series is v5.15x + # Automatically detect the latest SDK version from the website versions = page.find_all("li") - version = [i for i in versions if "5.18" in i.text][-1].a.get("href")[0:-1] + + # Extract all version links (v5.x format) + version_candidates = [] + for item in versions: + if item.a and item.a.get("href"): + href = item.a.get("href") + # Look for version patterns like "v5.19", "v5.18", etc. + if href.startswith("v5.") and "/" in href: + version_candidates.append(href[0:-1]) # Remove trailing / + + if not version_candidates: + sys.exit( + "No TeamTalk SDK versions found on the download page. " + "Please check the URL or try again later." + ) + + # Use the latest version (last one in the list) + version = version_candidates[-1] + print(f"Detected latest SDK version: {version}") + download_url = ( url + "/" + version + "/" - + "tt5sdk_{v}_{p}.7z".format(v=version, p=get_url_suffix_from_platform()) + + "tt5sdk_{v}_{p}.7z".format( + v=version, p=get_url_suffix_from_platform() + ) ) print("Downloading from " + download_url) - downloader.download_file(download_url, os.path.join(os.getcwd(), "ttsdk.7z")) + downloader.download_file( + download_url, os.path.join(os.getcwd(), "ttsdk.7z") + ) def extract() -> None: @@ -66,31 +94,44 @@ def extract() -> None: shutil.rmtree(os.path.join(os.getcwd(), "ttsdk")) os.mkdir(os.path.join(os.getcwd(), "ttsdk")) patoolib.extract_archive( - os.path.join(os.getcwd(), "ttsdk.7z"), outdir=os.path.join(os.getcwd(), "ttsdk") + os.path.join(os.getcwd(), "ttsdk.7z"), + outdir=os.path.join(os.getcwd(), "ttsdk") ) + def move() -> None: - path = os.path.join(os.getcwd(), "ttsdk", os.listdir(os.path.join(os.getcwd(), "ttsdk"))[0]) + path = os.path.join( + os.getcwd(), "ttsdk", + os.listdir(os.path.join(os.getcwd(), "ttsdk"))[0] + ) libraries = ["TeamTalk_DLL", "TeamTalkPy"] - dest_dir = os.path.join(os.getcwd(), os.pardir) if os.path.basename(os.getcwd()) == "tools" else os.getcwd() + dest_dir = ( + os.path.join(os.getcwd(), os.pardir) + if os.path.basename(os.getcwd()) == "tools" + else os.getcwd() + ) for library in libraries: try: os.rename( - os.path.join(path, "Library", library), os.path.join(dest_dir, library) + os.path.join(path, "Library", library), + os.path.join(dest_dir, library) ) except OSError: shutil.rmtree(os.path.join(dest_dir, library)) os.rename( - os.path.join(path, "Library", library), os.path.join(dest_dir, library) + os.path.join(path, "Library", library), + os.path.join(dest_dir, library) ) try: os.rename( - os.path.join(path, "License.txt"), os.path.join(dest_dir, "TTSDK_license.txt") + os.path.join(path, "License.txt"), + os.path.join(dest_dir, "TTSDK_license.txt") ) except FileExistsError: os.remove(os.path.join(dest_dir, "TTSDK_license.txt")) os.rename( - os.path.join(path, "License.txt"), os.path.join(dest_dir, "TTSDK_license.txt") + os.path.join(path, "License.txt"), + os.path.join(dest_dir, "TTSDK_license.txt") ) @@ -112,5 +153,6 @@ def install() -> None: print("cleaned.") print("Installed, exiting.") + if __name__ == "__main__": install() From 3be512a420cd0edb1a3faee795a8f9a4872f6cee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 03:52:43 +0000 Subject: [PATCH 3/5] Improve version detection with proper semantic sorting Co-authored-by: ChrisDuffley <64235743+ChrisDuffley@users.noreply.github.com> --- tools/ttsdk_downloader.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tools/ttsdk_downloader.py b/tools/ttsdk_downloader.py index e92faa2..78e0da6 100755 --- a/tools/ttsdk_downloader.py +++ b/tools/ttsdk_downloader.py @@ -2,6 +2,7 @@ import bs4 import patoolib +import re import requests import os @@ -53,14 +54,23 @@ def download() -> None: # Automatically detect the latest SDK version from the website versions = page.find_all("li") - # Extract all version links (v5.x format) + # Extract all version links (vX.Y format) + version_pattern = re.compile(r'^v(\d+)\.(\d+)([a-z]?)/$') version_candidates = [] for item in versions: if item.a and item.a.get("href"): href = item.a.get("href") - # Look for version patterns like "v5.19", "v5.18", etc. - if href.startswith("v5.") and "/" in href: - version_candidates.append(href[0:-1]) # Remove trailing / + # Look for version patterns like "v5.19/", "v5.18a/", etc. + match = version_pattern.match(href) + if match: + # Store (major, minor, suffix, full_version) for sorting + major = int(match.group(1)) + minor = int(match.group(2)) + suffix = match.group(3) or '' + full_version = href[0:-1] # Remove trailing / + version_candidates.append( + (major, minor, suffix, full_version) + ) if not version_candidates: sys.exit( @@ -68,8 +78,10 @@ def download() -> None: "Please check the URL or try again later." ) - # Use the latest version (last one in the list) - version = version_candidates[-1] + # Sort by major, minor, then suffix (alphabetically) + version_candidates.sort(key=lambda x: (x[0], x[1], x[2])) + # Get the latest version (last after sorting) + version = version_candidates[-1][3] print(f"Detected latest SDK version: {version}") download_url = ( From f9a53fbd182cfcc835da89fb10b1d5eebd60a30e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 03:54:09 +0000 Subject: [PATCH 4/5] Fix version sorting to prioritize stable releases Co-authored-by: ChrisDuffley <64235743+ChrisDuffley@users.noreply.github.com> --- tools/ttsdk_downloader.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/ttsdk_downloader.py b/tools/ttsdk_downloader.py index 78e0da6..a57de02 100755 --- a/tools/ttsdk_downloader.py +++ b/tools/ttsdk_downloader.py @@ -54,13 +54,13 @@ def download() -> None: # Automatically detect the latest SDK version from the website versions = page.find_all("li") - # Extract all version links (vX.Y format) - version_pattern = re.compile(r'^v(\d+)\.(\d+)([a-z]?)/$') + # Extract all version links (vX.Y or vX.Y format) + # Matches: v5.19/, v5.18a/, v6.0beta/, v5.19-rc1/, etc. + version_pattern = re.compile(r'^v(\d+)\.(\d+)([a-z0-9\-]*)/$') version_candidates = [] for item in versions: if item.a and item.a.get("href"): href = item.a.get("href") - # Look for version patterns like "v5.19/", "v5.18a/", etc. match = version_pattern.match(href) if match: # Store (major, minor, suffix, full_version) for sorting @@ -68,8 +68,12 @@ def download() -> None: minor = int(match.group(2)) suffix = match.group(3) or '' full_version = href[0:-1] # Remove trailing / + # For sorting: empty suffix (stable) should sort last + # Use a tuple where stable versions have ('', 1) and + # pre-release versions have (suffix, 0) + is_stable = 1 if suffix == '' else 0 version_candidates.append( - (major, minor, suffix, full_version) + (major, minor, is_stable, suffix, full_version) ) if not version_candidates: @@ -78,10 +82,10 @@ def download() -> None: "Please check the URL or try again later." ) - # Sort by major, minor, then suffix (alphabetically) - version_candidates.sort(key=lambda x: (x[0], x[1], x[2])) + # Sort by major, minor, stability (stable last), then suffix + version_candidates.sort(key=lambda x: (x[0], x[1], x[2], x[3])) # Get the latest version (last after sorting) - version = version_candidates[-1][3] + version = version_candidates[-1][4] print(f"Detected latest SDK version: {version}") download_url = ( From 4bc7774d89c7e20c3d6b6f32b0960db7ddc53709 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 03:55:36 +0000 Subject: [PATCH 5/5] Clarify version sorting comments Co-authored-by: ChrisDuffley <64235743+ChrisDuffley@users.noreply.github.com> --- tools/ttsdk_downloader.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/ttsdk_downloader.py b/tools/ttsdk_downloader.py index a57de02..aa3f373 100755 --- a/tools/ttsdk_downloader.py +++ b/tools/ttsdk_downloader.py @@ -68,9 +68,9 @@ def download() -> None: minor = int(match.group(2)) suffix = match.group(3) or '' full_version = href[0:-1] # Remove trailing / - # For sorting: empty suffix (stable) should sort last - # Use a tuple where stable versions have ('', 1) and - # pre-release versions have (suffix, 0) + # For sorting: stable versions (no suffix) get is_stable=1, + # pre-releases get is_stable=0. When sorted ascending, + # stable versions come after pre-releases for same major.minor is_stable = 1 if suffix == '' else 0 version_candidates.append( (major, minor, is_stable, suffix, full_version) @@ -82,7 +82,9 @@ def download() -> None: "Please check the URL or try again later." ) - # Sort by major, minor, stability (stable last), then suffix + # Sort by: major (asc), minor (asc), stability (asc: 0=pre-release, + # 1=stable), suffix (asc). This ensures stable releases are picked + # over pre-releases for the same major.minor version. version_candidates.sort(key=lambda x: (x[0], x[1], x[2], x[3])) # Get the latest version (last after sorting) version = version_candidates[-1][4]