Skip to content

Commit

Permalink
refactor: update container and show file data models for improved str…
Browse files Browse the repository at this point in the history
…ucture
  • Loading branch information
davidemarcoli committed Dec 9, 2024
1 parent 8a5e849 commit 18c5a77
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/routers/secure/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ class SessionResponse(BaseModel):

class ContainerFile(BaseModel):
"""Individual file entry in a container"""
file_id: int
filename: str
filesize: Optional[int] = None

ContainerMap: TypeAlias = Dict[str, ContainerFile]

class Container(RootModel[ContainerMap]):
class Container(BaseModel):
"""
Root model for container mapping file IDs to file information.
Expand All @@ -76,11 +77,12 @@ class Container(RootModel[ContainerMap]):
}
}
"""
root: ContainerMap
infohash: str
files: List[ContainerFile]

SeasonEpisodeMap: TypeAlias = Dict[int, Dict[int, ContainerFile]]

class ShowFileData(RootModel[SeasonEpisodeMap]):
class ShowFileData(BaseModel):
"""
Root model for show file data that maps seasons to episodes to file data.
Expand All @@ -95,8 +97,8 @@ class ShowFileData(RootModel[SeasonEpisodeMap]):
}
}
"""

root: SeasonEpisodeMap
infohash: str
files: SeasonEpisodeMap

class ScrapingSession:
def __init__(self, id: str, item_id: str, magnet: str):
Expand Down

0 comments on commit 18c5a77

Please sign in to comment.