2020-09-28 18:31:57 +02:00
|
|
|
from peewee import CharField, BooleanField, DateTimeField, ForeignKeyField
|
2018-02-05 21:44:37 +01:00
|
|
|
|
|
|
|
from basemodel import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class Channel(BaseModel):
|
|
|
|
shortname = CharField(unique=True, max_length=5)
|
|
|
|
stationname = CharField()
|
2018-02-08 15:40:00 +01:00
|
|
|
has_data = BooleanField()
|
|
|
|
primary_color = CharField(max_length=7)
|
2018-02-08 15:44:07 +01:00
|
|
|
secondary_color = CharField(max_length=7)
|
2018-02-05 21:44:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Song(BaseModel):
|
|
|
|
artist = CharField(max_length=150)
|
|
|
|
title = CharField(max_length=150)
|
|
|
|
show = BooleanField()
|
2018-02-15 21:02:51 +01:00
|
|
|
spotify_data = BooleanField(null=True)
|
|
|
|
preview_url = CharField(null=True)
|
2018-02-15 21:45:43 +01:00
|
|
|
spotify_url = CharField(null=True)
|
|
|
|
image_small = CharField(null=True)
|
|
|
|
image_large = CharField(null=True)
|
2020-02-06 17:57:50 +01:00
|
|
|
background_color = CharField(null=True, max_length=6)
|
|
|
|
alternative_color = CharField(null=True, max_length=6)
|
|
|
|
text_color = CharField(null=True, max_length=6)
|
2018-02-05 21:44:37 +01:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
indexes = ((("artist", "title"), True),)
|
|
|
|
|
|
|
|
|
|
|
|
class Play(BaseModel):
|
|
|
|
song = ForeignKeyField(Song)
|
|
|
|
channel = ForeignKeyField(Channel)
|
|
|
|
time = DateTimeField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
indexes = ((("time", "channel"), True),)
|