-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add pause #885
Add pause #885
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
logger.debug(f"Pausing {self.id}") | ||
self.is_paused = True | ||
self.paused_at = datetime.now() | ||
logger.info(f"{self.log_string} paused, is_paused={self.is_paused}, paused_at={self.paused_at}") |
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.
Clean up the log string, the latter attribute logs can be debug level if needed
@@ -17,45 +17,62 @@ def process_event(emitted_by: Service, existing_item: MediaItem | None = None, c | |||
no_further_processing: ProcessedEvent = (None, []) | |||
items_to_submit = [] | |||
|
|||
#TODO - Reindex non-released badly indexed items here | |||
# Skip processing if item is paused | |||
if existing_item and existing_item.is_paused: |
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.
This lines: 20-25 is the only state_transition modification needed, remove the rest.
from program.media.state import States | ||
from program.services.content import Overseerr | ||
from program.symlink import Symlinker | ||
from program.types import Event | ||
|
||
from ..models.shared import MessageResponse | ||
|
||
class StateResponse(BaseModel): |
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.
Thank you for moving these to the top!
} | ||
|
||
@router.post("/{ids}/pause", response_model=PauseResponse, operation_id="pause_items") |
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.
use query parameters if you want to supply multiple ids, path parameters should only provide one.
"""Get all paused media items, optionally filtered by type""" | ||
# Use raw SQL to verify data | ||
sql = "SELECT id, title, type, is_paused, paused_at FROM \"MediaItem\" WHERE is_paused = true" |
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.
use sqlalchemy instead of "raw SQL"
No description provided.