From 8db6541f5820f52ebb8550b81010e28bf9be589a Mon Sep 17 00:00:00 2001 From: Spoked Date: Sun, 20 Oct 2024 14:56:06 -0400 Subject: [PATCH] fix: fixed replace torrents --- src/controllers/items.py | 6 +++--- src/program/downloaders/alldebrid.py | 2 +- src/program/downloaders/realdebrid.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controllers/items.py b/src/controllers/items.py index c8c548f6..458cb68f 100644 --- a/src/controllers/items.py +++ b/src/controllers/items.py @@ -382,7 +382,7 @@ class SetTorrentRDResponse(BaseModel): ) def add_torrent(request: Request, id: int, magnet: str) -> SetTorrentRDResponse: torrent_id = "" - downloader: Downloader = request.app.program.services.get(Downloader) + downloader: Downloader = request.app.program.services.get(Downloader).service try: torrent_id = downloader.add_torrent_magnet(magnet) except Exception: @@ -463,7 +463,7 @@ def set_torrent_rd(request: Request, id: int, torrent_id: str) -> SetTorrentRDRe # reset episodes if it's a season if item.type == "season": - logger.debug(f"Resetting episodes for {item.title}") + logger.debug(f"Resetting episodes for {item.log_string}") for episode in item.episodes: reset_item_to_scraped(episode) @@ -495,7 +495,7 @@ def set_torrent_rd(request: Request, id: int, torrent_id: str) -> SetTorrentRDRe return { "success": True, - "message": f"Set torrent for {item.title} to {torrent_id}", + "message": f"Set torrent for {item.log_string} to {torrent_id}", "item_id": item._id, "torrent_id": torrent_id, } diff --git a/src/program/downloaders/alldebrid.py b/src/program/downloaders/alldebrid.py index e8ad0c14..4640a993 100644 --- a/src/program/downloaders/alldebrid.py +++ b/src/program/downloaders/alldebrid.py @@ -152,7 +152,7 @@ def get_torrent_info(self, torrent_id: DebridTorrentId) -> dict: return get_status(torrent_id) -def walk_alldebrid_files(files: list[dict]) -> (str, int): +def walk_alldebrid_files(files: list[dict]) -> (str, int): # type: ignore """Walks alldebrid's `files` nested dicts and returns (filename, filesize) for each file, discarding path information""" dirs = [] for f in files: diff --git a/src/program/downloaders/realdebrid.py b/src/program/downloaders/realdebrid.py index 90737258..46d19ea9 100644 --- a/src/program/downloaders/realdebrid.py +++ b/src/program/downloaders/realdebrid.py @@ -165,10 +165,10 @@ def delete_torrent_with_infohash(self, infohash: str): if id: delete_torrent(id) - def add_torrent_magnet(magnet: str) -> str: + def add_torrent_magnet(self, magnet: str) -> str: return add_torrent_magnet(magnet) - def get_torrent_info(id: str) -> dict: + def get_torrent_info(self, id: str) -> dict: return torrent_info(id)