Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25ed12fdf9 | ||
|
d29938bcf5
|
|||
|
df256f5be2
|
@@ -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}"
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user