diff --git a/program/migrations/0091_radiosettings_host_image_aspect_ratio_and_more.py b/program/migrations/0091_radiosettings_host_image_aspect_ratio_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..c6032dfccbcfc74eccfa8c131c18b2ab14a5fcbb --- /dev/null +++ b/program/migrations/0091_radiosettings_host_image_aspect_ratio_and_more.py @@ -0,0 +1,70 @@ +# Generated by Django 4.2.13 on 2024-06-03 16:43 + +import program.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0090_alter_playlist_options"), + ] + + operations = [ + migrations.AddField( + model_name="radiosettings", + name="host_image_aspect_ratio", + field=program.models.ImageAspectRadioField( + choices=[("1:1", "1:1"), ("16:9", "16:9")], default="1:1", max_length=4 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="host_image_shape", + field=program.models.ImageShapeField( + choices=[("rect", "rect"), ("round", "round")], default="round", max_length=5 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="note_image_aspect_ratio", + field=program.models.ImageAspectRadioField( + choices=[("1:1", "1:1"), ("16:9", "16:9")], default="16:9", max_length=4 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="note_image_shape", + field=program.models.ImageShapeField( + choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="show_image_aspect_ratio", + field=program.models.ImageAspectRadioField( + choices=[("1:1", "1:1"), ("16:9", "16:9")], default="16:9", max_length=4 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="show_image_shape", + field=program.models.ImageShapeField( + choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="show_logo_aspect_ratio", + field=program.models.ImageAspectRadioField( + choices=[("1:1", "1:1"), ("16:9", "16:9")], default="1:1", max_length=4 + ), + ), + migrations.AddField( + model_name="radiosettings", + name="show_logo_shape", + field=program.models.ImageShapeField( + choices=[("rect", "rect"), ("round", "round")], default="rect", max_length=5 + ), + ), + ] diff --git a/program/models.py b/program/models.py index 6a58ae8dfd78afb6e82dbe409a37b0463ebf9132..7e1d38b672f3f459bf5bf56508220bd40789647d 100644 --- a/program/models.py +++ b/program/models.py @@ -526,13 +526,43 @@ class Playlist(models.Model): ] +class ImageAspectRadioField(models.CharField): + def __init__(self, *args, **kwargs): + kwargs["choices"] = [ + ("1:1", "1:1"), + ("16:9", "16:9"), + ] + kwargs["max_length"] = 4 + + super().__init__(*args, **kwargs) + + +class ImageShapeField(models.CharField): + def __init__(self, *args, **kwargs): + kwargs["choices"] = [ + ("rect", "rect"), + ("round", "round"), + ] + kwargs["max_length"] = 5 + + super().__init__(*args, **kwargs) + + class RadioSettings(models.Model): cba_api_key = models.CharField(blank=True, max_length=64, verbose_name="CBA API key") cba_domains = models.JSONField( blank=True, default=list, help_text="JSON array of strings", verbose_name="CBA domains" ) fallback_show = models.ForeignKey(Show, blank=True, null=True, on_delete=models.CASCADE) + host_image_aspect_ratio = ImageAspectRadioField(default="1:1") + host_image_shape = ImageShapeField(default="round") line_in_channels = models.JSONField(blank=True, default=dict, help_text="JSON key/value pairs") + note_image_aspect_ratio = ImageAspectRadioField(default="16:9") + note_image_shape = ImageShapeField(default="rect") + show_image_aspect_ratio = ImageAspectRadioField(default="16:9") + show_image_shape = ImageShapeField(default="rect") + show_logo_aspect_ratio = ImageAspectRadioField(default="1:1") + show_logo_shape = ImageShapeField(default="rect") station_logo = models.ForeignKey(Image, blank=True, null=True, on_delete=models.CASCADE) station_name = models.CharField(max_length=256, unique=True) station_website = models.URLField()