-
-
Notifications
You must be signed in to change notification settings - Fork 58
Refactor code #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor code #325
Conversation
# Conflicts: # media_manager/movies/service.py # media_manager/tv/service.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the codebase by standardizing configuration usage and improving exception handling. Key changes include renaming AllEncompassingConfig to MediaManagerConfig, updating exception types from generic errors to specific HTTP-oriented exceptions, removing the valkey dependency, and reorganizing router endpoints with improved documentation.
Key Changes
- Renamed
AllEncompassingConfigtoMediaManagerConfigthroughout the codebase - Updated exception handling to use
ConflictErrorinstead ofMediaAlreadyExists/generic exceptions - Removed
valkeyandprowlarr-pydependencies - Updated dependency versions (fastapi, starlette, pillow, fastapi-users)
- Refactored TV service methods to accept domain objects instead of IDs
- Reorganized and documented TV router endpoints
Reviewed changes
Copilot reviewed 37 out of 39 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updated dependency versions and removed prowlarr-py |
| metadata_relay/uv.lock | Updated lock file with new dependency versions |
| metadata_relay/pyproject.toml | Removed valkey dependency |
| media_manager/tv/service.py | Refactored methods to accept Show/Season objects instead of IDs, updated config references |
| media_manager/tv/router.py | Reorganized endpoints with better structure and added docstrings |
| media_manager/tv/repository.py | Changed exception from MediaAlreadyExists to ConflictError |
| media_manager/torrent/utils.py | Updated config class references |
| media_manager/torrent/manager.py | Updated config class references |
| media_manager/torrent/download_clients/* | Updated config class references across all clients |
| media_manager/scheduler.py | New scheduler setup file added |
| media_manager/notification/* | Updated config class references across notification providers |
| media_manager/movies/repository.py | Changed exception from ValueError to ConflictError |
| media_manager/metadataProvider/tmdb.py | Updated config class reference |
| media_manager/config.py | Renamed AllEncompassingConfig to MediaManagerConfig |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import media_manager.movies.router as movies_router | ||
| import media_manager.tv.router as tv_router | ||
| from media_manager.notification.router import router as notification_router | ||
| import logging |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'logging' is imported with both 'import' and 'import from'.
Module 'media_manager.logging' is imported with both 'import' and 'import from'.
| from apscheduler.schedulers.background import BackgroundScheduler | ||
| from apscheduler.triggers.cron import CronTrigger | ||
| from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore | ||
| import media_manager.database |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'media_manager.database' is imported with both 'import' and 'import from'.
| @@ -0,0 +1,73 @@ | |||
| import logging | |||
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module 'logging' imports itself.
The module 'media_manager.logging' imports itself.
This pull request makes several significant improvements to the codebase, focusing on standardizing configuration usage, enhancing exception handling, and introducing new utilities for logging and filesystem checks. The main changes include replacing the old
AllEncompassingConfigwith the newMediaManagerConfigthroughout the project, expanding and refactoring the exception hierarchy for better error handling, and adding new modules for logging and filesystem validation.Configuration Standardization:
AllEncompassingConfigwithMediaManagerConfigacross the codebase to unify and clarify configuration management. This affects files in authentication, indexer, and service modules, as well as Alembic migrations.Exception Handling Improvements:
MediaManagerExceptionbase class and several specific exceptions for common HTTP error scenarios (e.g.,BadRequestError,UnauthorizedError,ForbiddenError,ConflictError,UnprocessableEntityError). Updated exception handlers to match these new classes and return appropriate HTTP status codes.