#132 | #121: backoffice / dev-1.0-121 (#131)

cfr #121

Co-authored-by: Christophe Siraut <d@tobald.eu.org>
Co-authored-by: bkfox <thomas bkfox net>
Co-authored-by: Thomas Kairos <thomas@bkfox.net>
Reviewed-on: rc/aircox#131
Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
This commit is contained in:
2024-04-28 22:02:09 +02:00
committed by Thomas Kairos
parent 1e17a1334a
commit 55123c386d
348 changed files with 124397 additions and 17879 deletions

View File

@ -1,11 +1,8 @@
import os
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from filer.fields.image import FilerImageField
from aircox.conf import settings
__all__ = ("Station", "StationQuerySet", "Port")
@ -32,13 +29,6 @@ class Station(models.Model):
name = models.CharField(_("name"), max_length=64)
slug = models.SlugField(_("slug"), max_length=64, unique=True)
# FIXME: remove - should be decided only by Streamer controller + settings
path = models.CharField(
_("path"),
help_text=_("path to the working directory"),
max_length=256,
blank=True,
)
default = models.BooleanField(
_("default station"),
default=False,
@ -67,7 +57,7 @@ class Station(models.Model):
max_length=2048,
null=True,
blank=True,
help_text=_("Audio streams urls used by station's player. One url " "a line."),
help_text=_("Audio streams urls used by station's player. One url a line."),
)
default_cover = FilerImageField(
on_delete=models.SET_NULL,
@ -76,6 +66,14 @@ class Station(models.Model):
blank=True,
related_name="+",
)
music_stream_title = models.CharField(
_("Music stream's title"),
max_length=64,
default=_("Music stream"),
)
legal_label = models.CharField(
_("Legal label"), max_length=64, blank=True, default="", help_text=_("Displayed at the bottom of pages.")
)
objects = StationQuerySet.as_manager()
@ -88,12 +86,6 @@ class Station(models.Model):
return self.name
def save(self, make_sources=True, *args, **kwargs):
if not self.path:
self.path = os.path.join(
settings.CONTROLLERS_WORKING_DIR,
self.slug.replace("-", "_"),
)
if self.default:
qs = Station.objects.filter(default=True)
if self.pk is not None: