Skip to content

Commit

Permalink
fix: correct type hint for incomplete_retries in StatsResponse (#839)
Browse files Browse the repository at this point in the history
refactor: implement composite key generation for MediaItem

- Changed MediaItem ID type from int to str to support composite keys.
- Added a method to generate composite keys using item type and trakt_id.
- Updated related functions and methods to handle the new ID type.
- Modified database queries and relationships to accommodate string IDs.
- Adjusted API endpoints and event management to work with composite keys.

# Conflicts:
#	src/program/services/indexers/trakt.py

refactor: update ID handling to use strings instead of integers across modules

fix: correct type hint for incomplete_retries in StatsResponse

Also add episode and season types to composites.
  • Loading branch information
iPromKnight authored Nov 2, 2024
1 parent 2a0291c commit f91ffec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/program/services/indexers/trakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ def _add_seasons_to_show(show: Show, imdb_id: str):
show.add_season(season_item)


def _assign_item_type(item_type):
if item_type == "movie":
return "movie"
return "show"


def _map_item_from_data(data, item_type: str, show_genres: List[str] = None) -> Optional[MediaItem]:
"""Map trakt.tv API data to MediaItemContainer."""
if item_type not in ["movie", "show", "season", "episode"]:
Expand All @@ -152,7 +146,7 @@ def _map_item_from_data(data, item_type: str, show_genres: List[str] = None) ->
"country": getattr(data, "country", None),
"language": getattr(data, "language", None),
"requested_at": datetime.now(),
"type": _assign_item_type(item_type),
"type": item_type,
}

item["is_anime"] = (
Expand Down
2 changes: 1 addition & 1 deletion src/routers/secure/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class StatsResponse(BaseModel):
total_episodes: int
total_symlinks: int
incomplete_items: int
incomplete_retries: dict[int, int] = Field(
incomplete_retries: dict[str, int] = Field(
description="Media item log string: number of retries"
)
states: dict[States, int]
Expand Down

0 comments on commit f91ffec

Please sign in to comment.