2021-04-27 10:07:17 +01:00
|
|
|
import json
|
|
|
|
import base64
|
|
|
|
import hashlib
|
|
|
|
from collections import OrderedDict
|
|
|
|
from quart import url_for
|
|
|
|
from typing import NamedTuple, Optional, List, Dict
|
2021-04-27 10:13:04 +01:00
|
|
|
from sqlite3 import Row
|
2021-04-27 10:07:17 +01:00
|
|
|
|
2021-04-28 12:04:47 +01:00
|
|
|
|
2021-04-27 10:07:17 +01:00
|
|
|
class Jukebox(NamedTuple):
|
2021-04-28 12:04:47 +01:00
|
|
|
id: str
|
2021-04-29 22:38:57 +01:00
|
|
|
user: str
|
2021-04-28 12:04:47 +01:00
|
|
|
title: str
|
2021-04-27 10:07:17 +01:00
|
|
|
wallet: str
|
2021-06-01 21:19:41 +01:00
|
|
|
inkey: str
|
2021-04-28 12:04:47 +01:00
|
|
|
sp_user: str
|
|
|
|
sp_secret: str
|
2021-04-29 00:40:58 +01:00
|
|
|
sp_access_token: str
|
|
|
|
sp_refresh_token: str
|
2021-04-28 12:04:47 +01:00
|
|
|
sp_device: str
|
|
|
|
sp_playlists: str
|
|
|
|
price: int
|
2021-05-03 23:22:40 +01:00
|
|
|
profit: int
|
2021-04-27 10:07:17 +01:00
|
|
|
|
|
|
|
@classmethod
|
2021-04-28 12:04:47 +01:00
|
|
|
def from_row(cls, row: Row) -> "Jukebox":
|
|
|
|
return cls(**dict(row))
|
2021-06-01 16:50:06 +01:00
|
|
|
|
2021-06-07 14:24:04 +01:00
|
|
|
|
2021-06-01 16:50:06 +01:00
|
|
|
class JukeboxPayment(NamedTuple):
|
|
|
|
payment_hash: str
|
2021-06-07 14:24:04 +01:00
|
|
|
juke_id: str
|
2021-06-01 16:50:06 +01:00
|
|
|
song_id: str
|
|
|
|
paid: bool
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_row(cls, row: Row) -> "JukeboxPayment":
|
2021-06-07 14:24:04 +01:00
|
|
|
return cls(**dict(row))
|