diff --git a/app/common/static/styles/_colours.scss b/app/common/static/styles/_colours.scss index a71d43f..153cf92 100644 --- a/app/common/static/styles/_colours.scss +++ b/app/common/static/styles/_colours.scss @@ -10,7 +10,7 @@ $background-colour: $colour-near-white; $text-colour: $colour-near-black; $header-background-colour: $colour-red; -$header-text-colour: $colour-white; +$header-text-colour: $colour-near-white; $nav-background-colour: $colour-near-black; $nav-text-colour: $colour-near-white; @@ -18,10 +18,10 @@ $nav-link-background-hover-colour: $colour-orange; $main-button-background-colour: $colour-light-blue; $main-button-background-hover-colour: $colour-orange; -$main-button-text-colour: $colour-white; +$main-button-text-colour: $colour-near-white; $footer-background-colour: $colour-red; -$footer-text-colour: $colour-white; +$footer-text-colour: $colour-near-white; $footer-link-colour: $colour-near-black; $footer-link-hover-colour: $colour-orange; @@ -32,6 +32,11 @@ $form-select-border-colour: $colour-light-blue; $form-error-background-colour: $colour-red; $form-error-text-colour: $colour-near-white; $form-help-text-colour: $colour-light-blue; +$form-delete-button-background-colour: $colour-red; + +$collection-no-items-text-colour: $colour-light-blue; +$collection-background-hover-colour: $colour-orange; +$collection-text-hover-colour: $colour-near-white; $box-error-background-colour: $colour-red; -$box-error-text-colour: $colour-white; +$box-error-text-colour: $colour-near-white; diff --git a/app/common/static/styles/_forms.scss b/app/common/static/styles/_forms.scss index f0bfc6e..03a73cd 100644 --- a/app/common/static/styles/_forms.scss +++ b/app/common/static/styles/_forms.scss @@ -39,3 +39,10 @@ select { border: 2px $form-select-border-colour solid; height: initial !important; } + +.delete-button { + background-color: $form-delete-button-background-colour !important; + &:hover { + background-color: $main-button-background-hover-colour !important; + } +} diff --git a/app/common/static/styles/_helpers.scss b/app/common/static/styles/_helpers.scss index 082ef8a..ee6a139 100644 --- a/app/common/static/styles/_helpers.scss +++ b/app/common/static/styles/_helpers.scss @@ -10,6 +10,10 @@ strong { margin-bottom: 0 !important; } +.margin-bottom { + margin-bottom: 20px !important; +} + .errors { background-color: $box-error-background-colour; border-radius: 2px; diff --git a/app/common/static/styles/_template.scss b/app/common/static/styles/_template.scss index 3bddd0f..d81429a 100644 --- a/app/common/static/styles/_template.scss +++ b/app/common/static/styles/_template.scss @@ -64,19 +64,34 @@ main { h1 { margin: 0; - padding: 0; + padding: 0 0 0.5rem 0; font-size: 2rem; } .btn { width: 100%; - background-color: $main-button-background-colour !important; + background-color: $main-button-background-colour; color: $main-button-text-colour !important; i { font-size: 0.9rem; } &:hover { - background-color: $main-button-background-hover-colour !important; + background-color: $main-button-background-hover-colour; + } + } + + .collection { + .collection-item { + display: block; + } + a.collection-item { + &:hover { + background-color: $collection-background-hover-colour !important; + color: $collection-text-hover-colour !important; + } + } + .no-items { + color: $collection-no-items-text-colour; } } diff --git a/app/sync/migrations/0003_auto_20201127_0838.py b/app/sync/migrations/0003_auto_20201127_0838.py new file mode 100644 index 0000000..b8f364e --- /dev/null +++ b/app/sync/migrations/0003_auto_20201127_0838.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2020-11-27 08:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0002_auto_20201126_0504'), + ] + + operations = [ + migrations.AlterField( + model_name='source', + name='key', + field=models.CharField(db_index=True, help_text='Source key, such as exact YouTube channel name or playlist ID', max_length=100, unique=True, verbose_name='key'), + ), + ] diff --git a/app/sync/migrations/0004_remove_source_url.py b/app/sync/migrations/0004_remove_source_url.py new file mode 100644 index 0000000..6c18299 --- /dev/null +++ b/app/sync/migrations/0004_remove_source_url.py @@ -0,0 +1,17 @@ +# Generated by Django 3.1.3 on 2020-11-28 03:11 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0003_auto_20201127_0838'), + ] + + operations = [ + migrations.RemoveField( + model_name='source', + name='url', + ), + ] diff --git a/app/sync/models.py b/app/sync/models.py index 09c155b..5e1e29c 100644 --- a/app/sync/models.py +++ b/app/sync/models.py @@ -1,4 +1,5 @@ import uuid +from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ @@ -59,6 +60,16 @@ class Source(models.Model): (FALLBACK_NEXT_HD, _('Get next best HD media instead')), ) + ICONS = { + SOURCE_TYPE_YOUTUBE_CHANNEL: '', + SOURCE_TYPE_YOUTUBE_PLAYLIST: '', + } + + URLS = { + SOURCE_TYPE_YOUTUBE_CHANNEL: 'https://www.youtube.com/{key}', + SOURCE_TYPE_YOUTUBE_PLAYLIST: 'https://www.youtube.com/playlist?list={key}', + } + uuid = models.UUIDField( _('uuid'), primary_key=True, @@ -87,15 +98,11 @@ class Source(models.Model): default=SOURCE_TYPE_YOUTUBE_CHANNEL, help_text=_('Source type') ) - url = models.URLField( - _('url'), - db_index=True, - help_text=_('URL of the source') - ) key = models.CharField( _('key'), max_length=100, db_index=True, + unique=True, help_text=_('Source key, such as exact YouTube channel name or playlist ID') ) name = models.CharField( @@ -162,6 +169,22 @@ class Source(models.Model): verbose_name = _('Source') verbose_name_plural = _('Sources') + @property + def icon(self): + return self.ICONS.get(self.source_type) + + @property + def url(self): + url = self.URLS.get(self.source_type) + return url.format(key=self.key) + + @property + def directory_path(self): + if self.source_profile == self.SOURCE_PROFILE_AUDIO: + return settings.SYNC_AUDIO_ROOT / self.directory + else: + return settings.SYNC_VIDEO_ROOT / self.directory + def get_media_thumb_path(instance, filename): fileid = str(instance.uuid) diff --git a/app/sync/templates/sync/source.html b/app/sync/templates/sync/source.html new file mode 100644 index 0000000..3b3b3c3 --- /dev/null +++ b/app/sync/templates/sync/source.html @@ -0,0 +1,86 @@ +{% extends 'base.html' %} + +{% block headtitle %}Source - {{ source.name }}{% endblock %} + +{% block content %} +
+ {{ source.get_source_type_display }} |
+ {{ source.name }} |
+ {{ source.key }} |
+ {{ source.directory }} |
+ {{ source.created|date:'Y-m-d H-I-S' }} |
+ {% if source.last_crawl %}{{ source.last_crawl|date:'Y-m-d H-I-S' }}{% else %}Never{% endif %} |
+ {{ source.get_source_profile_display }} |
+ {% if source.prefer_60fps %}{% else %}{% endif %} |
+ {% if source.prefer_hdr %}{% else %}{% endif %} |
+ {{ source.get_output_format_display }} |
+ {{ source.get_fallback_display }} |
+ After {{ source.days_to_keep }} days |
+ No, keep forever |
+ {{ source.uuid }} |