summaryrefslogtreecommitdiff
path: root/src/ampache/models.py
blob: 9508b2efef54d2fa7cd1c6ec8582eb70b03e41d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
The data structures of the ampache API (songs, artists, albums, etc).
"""
from dataclasses import dataclass
import datetime


@dataclass
class AuthToken:
    expires: datetime.datetime
    auth: str

    def __str__(self):
        return f"Expires: {self.expires}\nToken: {self.auth}"


@dataclass
class Song:
    song_id: str
    title: str
    album: str
    artist: str

    def __str__(self):
        return f"{self.title} by {self.artist}"


@dataclass
class Error:
    code: int
    message: str

    def __str__(self):
        return f"{self.message} with code {self.code}"