feat(main): main
This commit is contained in:
@@ -41,6 +41,10 @@ class MediaSourceIn(BaseModel):
|
||||
uri: str
|
||||
is_active: bool = True
|
||||
scan_interval_minutes: Optional[int] = None
|
||||
min_video_length_seconds: Optional[int] = None
|
||||
max_video_length_seconds: Optional[int] = None
|
||||
min_repeat_gap_hours: Optional[int] = None
|
||||
max_age_days: Optional[int] = None
|
||||
|
||||
class MediaSourceOut(BaseModel):
|
||||
id: int
|
||||
@@ -50,6 +54,10 @@ class MediaSourceOut(BaseModel):
|
||||
uri: str
|
||||
is_active: bool
|
||||
scan_interval_minutes: Optional[int]
|
||||
min_video_length_seconds: Optional[int]
|
||||
max_video_length_seconds: Optional[int]
|
||||
min_repeat_gap_hours: Optional[int]
|
||||
max_age_days: Optional[int]
|
||||
last_scanned_at: Optional[datetime]
|
||||
created_at: datetime
|
||||
|
||||
@@ -140,6 +148,23 @@ def delete_source(request, source_id: int):
|
||||
source.delete()
|
||||
return 204, None
|
||||
|
||||
@router.put("/{source_id}", response=MediaSourceOut)
|
||||
def update_source(request, source_id: int, payload: MediaSourceIn):
|
||||
"""Update an existing media source."""
|
||||
source = get_object_or_404(MediaSource, id=source_id)
|
||||
source.name = payload.name
|
||||
source.source_type = payload.source_type
|
||||
source.uri = payload.uri
|
||||
source.library_id = payload.library_id
|
||||
source.is_active = payload.is_active
|
||||
source.scan_interval_minutes = payload.scan_interval_minutes
|
||||
source.min_video_length_seconds = payload.min_video_length_seconds
|
||||
source.max_video_length_seconds = payload.max_video_length_seconds
|
||||
source.min_repeat_gap_hours = payload.min_repeat_gap_hours
|
||||
source.max_age_days = payload.max_age_days
|
||||
source.save()
|
||||
return source
|
||||
|
||||
|
||||
@router.post("/{source_id}/sync", response=SyncResult)
|
||||
def trigger_sync(request, source_id: int, max_videos: Optional[int] = None):
|
||||
|
||||
Reference in New Issue
Block a user