3 Commits

Author SHA1 Message Date
Gitea CI
25ed12fdf9 Bump version: 0.1.2 → 0.1.3 2025-07-04 14:24:50 +00:00
d29938bcf5 .
Merge branch 'master' of https://git.theprivateserver.de/KomSuite/KomSuite-NyaaPy
2025-07-04 16:20:13 +02:00
df256f5be2 refactor: do not download torrent file to identify contents 2025-07-04 16:17:17 +02:00
2 changed files with 7 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
[project]
name = "komsuite-nyaapy"
version = "0.1.2"
version = "0.1.3"
description = "A rewritten hard fork of the original NyaaPy library."
license = "MIT"
readme = "README.md"
@@ -20,7 +20,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.bumpversion]
current_version = "0.1.2"
current_version = "0.1.3"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"

View File

@@ -7,6 +7,7 @@ import regex
from typing import Optional
import loguru
import sys
import requests
log = loguru.logger
log.remove()
@@ -66,10 +67,11 @@ class Torrent:
@property
def get_contents(self):
os.system(f"wget {self.download_url}> /dev/null 2>&1")
with open(f"{self.download_url.split('/')[-1]}", "rb") as f:
data = bencodepy.decode(f.read())
resp = requests.get(self.download_url, timeout=15)
resp.raise_for_status() # raises for HTTP 4xx/5xx
# 2. Decode directly from bytes
data = bencodepy.decode(resp.content)
info = data[b"info"]
filetypes: list[str] = []
@@ -120,7 +122,6 @@ class Torrent:
else:
self.volumes = [0]
# log.debug("Filetypes: {}, Volumes: {}".format(self.filetypes, self.volumes)) #! enable for debug
os.remove(f"{self.download_url.split('/')[-1]}")
class TorrentSite(Enum):