fix: f-string; return None for Kali, NixOS rel_ver

This commit is contained in:
Jeffrey Serio 2025-01-30 13:13:27 -06:00
parent 8673778501
commit 6bfe0ee048
3 changed files with 10 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.venv
dist
uv.lock

View File

@ -1,6 +1,6 @@
[project]
name = "qbt-helper"
version = "0.2"
version = "0.3"
authors = [
{ name="Jeffrey Serio", email="hyperreal@fedoraproject.org" },
]

View File

@ -57,10 +57,12 @@ def get_torrents_from_html(webpage_url: str, torrent_substring: str) -> list:
urls = []
for link in soup.find_all("a"):
if torrent_substring in link.get("href"):
url = f"{webpage_url}/{link.get("href")}"
url = f"{webpage_url}/{link.get('href')}"
response = requests.get(url)
if response.status_code == 200:
urls.append(url)
else:
exit(f"Error verifying the URL: {url}")
return urls
@ -276,7 +278,10 @@ def get_tails_urls(rel_ver: str):
def selection_prompt(distro_selection: str) -> tuple:
choice = Prompt.ask("Enter 'a' to add; 'r' to remove.")
if distro_selection != "Kali Linux" and distro_selection != "NixOS":
rel_ver = Prompt.ask(f"Enter a release version for {distro_selection}")
else:
rel_ver = None
return (choice, rel_ver)
@ -371,7 +376,7 @@ def main():
case "Kali Linux":
match action[0]:
case "a":
add_torrents(get_kali_urls(action[1]), conn_info)
add_torrents(get_kali_urls(), conn_info)
case "r":
remove_torrents("kali-linux", conn_info)
case _: