mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 15:43:28 +02:00
fix errors
This commit is contained in:
@@ -5,7 +5,6 @@ from fastapi import Depends
|
||||
from media_manager.database import DbSessionDependency
|
||||
from media_manager.indexer.repository import IndexerRepository
|
||||
from media_manager.indexer.service import IndexerService
|
||||
from media_manager.tv.service import TvService
|
||||
|
||||
|
||||
def get_indexer_repository(db_session: DbSessionDependency) -> IndexerRepository:
|
||||
|
||||
@@ -74,7 +74,9 @@ class Jackett(GenericIndexer, TorznabMixin):
|
||||
def search_season(
|
||||
self, query: str, show: Show, season_number: int
|
||||
) -> list[IndexerQueryResult]:
|
||||
log.debug(f"Searching for season {season_number} of show {show.title}")
|
||||
return self.search(query=query, is_tv=True)
|
||||
|
||||
def search_movie(self, query: str, movie: Movie) -> list[IndexerQueryResult]:
|
||||
log.debug(f"Searching for movie {movie.title}")
|
||||
return self.search(query=query, is_tv=False)
|
||||
|
||||
@@ -66,8 +66,7 @@ class TorznabMixin:
|
||||
f"Torznab item {item.find('title').text} has no size, skipping."
|
||||
)
|
||||
continue
|
||||
else:
|
||||
size = int(item.find("size").text or "0")
|
||||
size = int(item.find("size").text or "0")
|
||||
|
||||
result = IndexerQueryResult(
|
||||
title=item.find("title").text or "unknown",
|
||||
|
||||
@@ -160,7 +160,7 @@ def add_a_movie(
|
||||
external_id=movie_id, metadata_provider=metadata_provider.name
|
||||
)
|
||||
if not movie:
|
||||
raise NotFoundError
|
||||
raise NotFoundError from ConflictError
|
||||
return movie
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ def get_files_for_import(
|
||||
log.info(f"Importing files from directory {directory}")
|
||||
search_directory = directory
|
||||
else:
|
||||
raise ValueError("Either torrent or directory must be provided.")
|
||||
msg = "Either torrent or directory must be provided."
|
||||
raise ValueError(msg)
|
||||
|
||||
all_files: list[Path] = list_files_recursively(path=search_directory)
|
||||
log.debug(f"Found {len(all_files)} files downloaded by the torrent")
|
||||
|
||||
@@ -155,7 +155,7 @@ def add_a_show(
|
||||
show_id, metadata_provider=metadata_provider.name
|
||||
)
|
||||
if not show:
|
||||
raise NotFoundError
|
||||
raise NotFoundError from MediaAlreadyExistsError
|
||||
return show
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user