fix: f-string; return None for Kali, NixOS rel_ver
This commit is contained in:
parent
8673778501
commit
6bfe0ee048
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
.venv
|
.venv
|
||||||
dist
|
dist
|
||||||
|
uv.lock
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "qbt-helper"
|
name = "qbt-helper"
|
||||||
version = "0.2"
|
version = "0.3"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Jeffrey Serio", email="hyperreal@fedoraproject.org" },
|
{ name="Jeffrey Serio", email="hyperreal@fedoraproject.org" },
|
||||||
]
|
]
|
||||||
|
@ -57,10 +57,12 @@ def get_torrents_from_html(webpage_url: str, torrent_substring: str) -> list:
|
|||||||
urls = []
|
urls = []
|
||||||
for link in soup.find_all("a"):
|
for link in soup.find_all("a"):
|
||||||
if torrent_substring in link.get("href"):
|
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)
|
response = requests.get(url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
urls.append(url)
|
urls.append(url)
|
||||||
|
else:
|
||||||
|
exit(f"Error verifying the URL: {url}")
|
||||||
|
|
||||||
return urls
|
return urls
|
||||||
|
|
||||||
@ -276,7 +278,10 @@ def get_tails_urls(rel_ver: str):
|
|||||||
|
|
||||||
def selection_prompt(distro_selection: str) -> tuple:
|
def selection_prompt(distro_selection: str) -> tuple:
|
||||||
choice = Prompt.ask("Enter 'a' to add; 'r' to remove.")
|
choice = Prompt.ask("Enter 'a' to add; 'r' to remove.")
|
||||||
rel_ver = Prompt.ask(f"Enter a release version for {distro_selection}")
|
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)
|
return (choice, rel_ver)
|
||||||
|
|
||||||
|
|
||||||
@ -371,7 +376,7 @@ def main():
|
|||||||
case "Kali Linux":
|
case "Kali Linux":
|
||||||
match action[0]:
|
match action[0]:
|
||||||
case "a":
|
case "a":
|
||||||
add_torrents(get_kali_urls(action[1]), conn_info)
|
add_torrents(get_kali_urls(), conn_info)
|
||||||
case "r":
|
case "r":
|
||||||
remove_torrents("kali-linux", conn_info)
|
remove_torrents("kali-linux", conn_info)
|
||||||
case _:
|
case _:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user