Fix max_res and user JSON serialization

This commit is contained in:
Pavle Portic 2022-10-30 00:34:25 +02:00
parent 2d25012600
commit 0bd40a67cb
Signed by: TheEdgeOfRage
GPG Key ID: 66AD4BA646FBC0D2
2 changed files with 9 additions and 7 deletions

View File

@ -19,8 +19,10 @@ class HttpClient:
resp.raise_for_status()
def register(self) -> None:
user = User(username=self.auth.username, password=self.auth.password)
resp = requests.post(url=f'{self.base_url}/fetch', json=user)
resp = requests.post(url=f'{self.base_url}/register', json={
'username': self.auth.username,
'password': self.auth.password,
})
resp.raise_for_status()
def subscribe_to_channel(self, channel_id: str) -> None:

View File

@ -9,14 +9,14 @@ class Configuration:
username: str
password: str
api_url: str = 'https://ytrssil.theedgeofrage.com'
max_res: Literal['480', '720', '1080', '1440', '2160'] = '1440'
max_resolution: Literal['480', '720', '1080', '1440', '2160'] = '1440'
@property
def mpv_options(self) -> list[str]:
return [
'--no-terminal',
f'--ytdl-format=bestvideo[height<=?{self.max_res}]+bestaudio/best',
]
return ['--no-terminal', (
'--ytdl-format=bestvideo[height<=?'
f'{self.max_resolution}]+bestaudio/best'
)]
def load_config() -> Configuration: