Skip to content

Commit

Permalink
fix: fixed replace torrents
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Oct 20, 2024
1 parent 3fcaecf commit 8db6541
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controllers/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/program/downloaders/alldebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/program/downloaders/realdebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 8db6541

Please sign in to comment.