diff --git a/tubesync/common/static/styles/fontawesome/_icons.scss b/tubesync/common/static/styles/fontawesome/_icons.scss index 598cfc9..3a2e629 100644 --- a/tubesync/common/static/styles/fontawesome/_icons.scss +++ b/tubesync/common/static/styles/fontawesome/_icons.scss @@ -65,6 +65,7 @@ readers do not read off random characters that represent icons */ .#{$fa-css-prefix}-arrows-alt-h:before { content: fa-content($fa-var-arrows-alt-h); } .#{$fa-css-prefix}-arrows-alt-v:before { content: fa-content($fa-var-arrows-alt-v); } .#{$fa-css-prefix}-artstation:before { content: fa-content($fa-var-artstation); } +.#{$fa-css-prefix}-arrow-rotate-right:before { content: fa-content($fa-var-arrow-rotate-right); } .#{$fa-css-prefix}-assistive-listening-systems:before { content: fa-content($fa-var-assistive-listening-systems); } .#{$fa-css-prefix}-asterisk:before { content: fa-content($fa-var-asterisk); } .#{$fa-css-prefix}-asymmetrik:before { content: fa-content($fa-var-asymmetrik); } diff --git a/tubesync/common/static/styles/fontawesome/_variables.scss b/tubesync/common/static/styles/fontawesome/_variables.scss index 5cbff1d..d9eb587 100644 --- a/tubesync/common/static/styles/fontawesome/_variables.scss +++ b/tubesync/common/static/styles/fontawesome/_variables.scss @@ -80,6 +80,7 @@ $fa-var-arrow-right: \f061; $fa-var-arrow-up: \f062; $fa-var-arrows-alt: \f0b2; $fa-var-arrows-alt-h: \f337; +$fa-var-arrow-rotate-right: \f01e; $fa-var-arrows-alt-v: \f338; $fa-var-artstation: \f77a; $fa-var-assistive-listening-systems: \f2a2; diff --git a/tubesync/common/static/styles/tubesync.scss b/tubesync/common/static/styles/tubesync.scss index a2caba3..cdf89ec 100644 --- a/tubesync/common/static/styles/tubesync.scss +++ b/tubesync/common/static/styles/tubesync.scss @@ -17,3 +17,13 @@ html { visibility: visible; opacity: 1; } + +.flex-collection-container { + display: flex !important; + align-items: center; +} + +.flex-grow { + flex-grow: 1; +} + \ No newline at end of file diff --git a/tubesync/sync/templates/sync/sources.html b/tubesync/sync/templates/sync/sources.html index d00a567..0c9a2ee 100644 --- a/tubesync/sync/templates/sync/sources.html +++ b/tubesync/sync/templates/sync/sources.html @@ -24,15 +24,18 @@
{% for source in sources %} - - {{ source.icon|safe }} {{ source.name }} ({{ source.get_source_type_display }} "{{ source.key }}")
- {{ source.format_summary }}
- {% if source.has_failed %} - Source has permanent failures - {% else %} - {{ source.media_count }} media items, {{ source.downloaded_count }} downloaded{% if source.delete_old_media and source.days_to_keep > 0 %}, keeping {{ source.days_to_keep }} days of media{% endif %} - {% endif %} -
+ + + {{ source.icon|safe }} {{ source.name }} ({{ source.get_source_type_display }} "{{ source.key }}")
+ {{ source.format_summary }}
+ {% if source.has_failed %} + Source has permanent failures + {% else %} + {{ source.media_count }} media items, {{ source.downloaded_count }} downloaded{% if source.delete_old_media and source.days_to_keep > 0 %}, keeping {{ source.days_to_keep }} days of media{% endif %} + {% endif %} +
+ +
{% empty %} You haven't added any sources. {% endfor %} diff --git a/tubesync/sync/templates/sync/tasks.html b/tubesync/sync/templates/sync/tasks.html index 0491222..58e37f5 100644 --- a/tubesync/sync/templates/sync/tasks.html +++ b/tubesync/sync/templates/sync/tasks.html @@ -66,7 +66,7 @@ {% for task in scheduled %} {{ task }}
- {% if task.instance.index_schedule %}Scheduled to run {{ task.instance.get_index_schedule_display|lower }}.
{% endif %} + {% if task.instance.index_schedule and task.repeat > 0 %}Scheduled to run {{ task.instance.get_index_schedule_display|lower }}.
{% endif %} Task will run {% if task.run_now %}immediately{% else %}at {{ task.run_at|date:'Y-m-d H:i:s' }}{% endif %}
{% empty %} diff --git a/tubesync/sync/urls.py b/tubesync/sync/urls.py index bfe73b7..6655837 100644 --- a/tubesync/sync/urls.py +++ b/tubesync/sync/urls.py @@ -28,6 +28,10 @@ urlpatterns = [ ValidateSourceView.as_view(), name='validate-source'), + path('source-sync-now/', + SourcesView.as_view(), + name='source-sync-now'), + path('source-add', AddSourceView.as_view(), name='add-source'), diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 8d29c7e..912dd22 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -4,7 +4,7 @@ from base64 import b64decode import pathlib import sys from django.conf import settings -from django.http import FileResponse, Http404, HttpResponseNotFound +from django.http import FileResponse, Http404, HttpResponseNotFound, HttpResponseRedirect from django.views.generic import TemplateView, ListView, DetailView from django.views.generic.edit import (FormView, FormMixin, CreateView, UpdateView, DeleteView) @@ -96,8 +96,27 @@ class SourcesView(ListView): paginate_by = settings.SOURCES_PER_PAGE messages = { 'source-deleted': _('Your selected source has been deleted.'), + 'source-refreshed': _('The source has been scheduled to be synced now.') } + def get(self, *args, **kwargs): + if args[0].path.startswith("/source-sync-now/"): + sobj = Source.objects.get(pk=kwargs["pk"]) + if sobj is None: + return HttpResponseNotFound() + + verbose_name = _('Index media from source "{}" once') + index_source_task( + str(sobj.pk), + queue=str(sobj.pk), + repeat=0, + verbose_name=verbose_name.format(sobj.name)) + url = reverse_lazy('sync:sources') + url = append_uri_params(url, {'message': 'source-refreshed'}) + return HttpResponseRedirect(url) + else: + return super().get(self, *args, **kwargs) + def __init__(self, *args, **kwargs): self.message = None super().__init__(*args, **kwargs)