Closed davidemarcoli closed 1 week ago
The changes introduce a new exception class, InvalidFileSizeException
, and a new result class, DownloadCachedStreamResult
, to the Downloader
class in src/program/services/downloaders/__init__.py
. The download_cached_stream
method now returns an instance of this class. The run
method has been updated to validate file sizes using the new validate_filesize
method. Additionally, the FileFinder
class in src/program/services/downloaders/shared.py
has been refactored to use global variables for file size limits and modularize validation logic. Default values for minimum file sizes in DownloadersModel
have been updated to enforce non-negative constraints.
File Path | Change Summary |
---|---|
src/program/services/downloaders/__init__.py |
Added InvalidFileSizeException and DownloadCachedStreamResult . Updated download_cached_stream to return DownloadCachedStreamResult . Introduced validate_filesize and _get_item_media_type methods. Modified update_item_attributes for media type validation. |
src/program/services/downloaders/shared.py |
Refactored FileFinder class to use global variables for file size limits. Added functions for file size validation and centralized checks. |
src/program/settings/models.py |
Updated default values for movie_filesize_mb_min and episode_filesize_mb_min from -1 to 0 in DownloadersModel . |
src/program/media/__init__.py |
Expanded imports to include ShowMediaType , MovieMediaType , and MediaType . |
src/program/media/item.py |
Introduced enumerations ShowMediaType , MovieMediaType , and MediaType . Updated MediaItem subclasses to use these enumerations instead of strings. |
src/program/utils/request.py |
Removed logging for rate limits and request failures in _request . Updated handle_response to raise RateLimitExceeded exception and added type hints. |
src/program/services/scrapers/__init__.py |
Modified scrape method to convert keys in service_results to lowercase for consistency. |
Downloader
class, while the retrieved PR focuses on integrating dependency injection across various services, including the Downloader
. This connection suggests that the changes in the main PR may benefit from the dependency injection framework established in the retrieved PR.In the burrow where files do play,
New checks for sizes come to stay.
Movies and shows, now fit just right,
Validations shine, oh what a sight!
A hop, a skip, through code we glide,
With size checks strong, we take great pride! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Don't remove it again @Gaisberg! 😡
Pull Request Check List
Resolves: #issue-number-here
Description:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor