refactoring

This commit is contained in:
2025-02-11 11:19:52 -05:00
parent 5ee99664f3
commit 650c12d073
11 changed files with 287 additions and 234 deletions

View File

@ -11,6 +11,8 @@ import asyncio
import regex
import music_tag
from . import radio_util
from .constructors import ValidRadioNextRequest, ValidRadioReshuffleRequest, ValidRadioQueueShiftRequest,\
ValidRadioQueueRemovalRequest, ValidRadioSongRequest, RadioException
from uuid import uuid4 as uuid
from typing import Optional
from pydantic import BaseModel
@ -24,58 +26,7 @@ double_space = regex.compile(r'\s{2,}')
TODO:
minor refactoring/type annotations/docstrings
"""
class RadioException(Exception):
pass
class ValidRadioSongRequest(BaseModel):
"""
- **key**: API Key
- **artist**: artist to search
- **song**: song to search
- **artistsong**: may be used IN PLACE OF artist/song to perform a combined/string search in the format "artist - song"
- **alsoSkip**: Whether to skip immediately to this track [not implemented]
"""
key: str
artist: str | None = None
song: str | None = None
artistsong: str | None = None
alsoSkip: bool = False
class ValidRadioNextRequest(BaseModel):
"""
- **key**: API Key
- **skipTo**: UUID to skip to [optional]
"""
key: str
skipTo: str|None = None
class ValidRadioReshuffleRequest(ValidRadioNextRequest):
"""
- **key**: API Key
"""
class ValidRadioQueueShiftRequest(BaseModel):
"""
- **key**: API Key
- **uuid**: UUID to shift
- **next**: Play next if true, immediately if false, default False
"""
key: str
uuid: str
next: bool = False
class ValidRadioQueueRemovalRequest(BaseModel):
"""
- **key**: API Key
- **uuid**: UUID to remove
"""
key: str
uuid: str