From 1bfb912d09d1108e42ae2d0fabef5a8d51d9228b Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 8 Nov 2021 14:52:46 +0700 Subject: [PATCH] basic routes and template for playlist page --- tubearchivist/home/templates/home/base.html | 3 + .../home/templates/home/playlist.html | 55 +++++++++++++++++++ tubearchivist/home/urls.py | 2 + tubearchivist/home/views.py | 22 ++++++++ 4 files changed, 82 insertions(+) create mode 100644 tubearchivist/home/templates/home/playlist.html diff --git a/tubearchivist/home/templates/home/base.html b/tubearchivist/home/templates/home/base.html index 3d80142..6606913 100644 --- a/tubearchivist/home/templates/home/base.html +++ b/tubearchivist/home/templates/home/base.html @@ -39,6 +39,9 @@ + + + diff --git a/tubearchivist/home/templates/home/playlist.html b/tubearchivist/home/templates/home/playlist.html new file mode 100644 index 0000000..4b8add9 --- /dev/null +++ b/tubearchivist/home/templates/home/playlist.html @@ -0,0 +1,55 @@ +{% extends "home/base.html" %} +{% load static %} +{% block content %} +
+

Playlists

+
+
+
+ {% if running == "subscribing" %} +

Subscribing in progress, refresh.

+ {% else %} + add-icon +

Subscribe to Playlist

+
+
+ {% csrf_token %} + {{ subscribe_form }} + +
+
+ {% endif %} +
+
+
+ search-icon +

Search your Playlists

+
+ +
+
+
+
+ Show only subscribed playlists: +
+ + + +
+
+
+ grid view + list view +
+
+{% endblock content %} \ No newline at end of file diff --git a/tubearchivist/home/urls.py b/tubearchivist/home/urls.py index 85bc0ba..1884b18 100644 --- a/tubearchivist/home/urls.py +++ b/tubearchivist/home/urls.py @@ -11,6 +11,7 @@ from home.views import ( DownloadView, HomeView, LoginView, + PlaylistView, SettingsView, VideoView, process, @@ -44,4 +45,5 @@ urlpatterns = [ login_required(VideoView.as_view()), name="video", ), + path("playlist/", login_required(PlaylistView.as_view()), name="playlist"), ] diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index fe2e2db..528c972 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -541,6 +541,28 @@ class ChannelView(View): return redirect("channel", permanent=True) +class PlaylistView(View): + """resolves to /playlist/ + show all playlists indexed + """ + + def get(self, request): + """handle http get requests""" + view_config = self.read_config(user_id=request.user.id) + context = {"title": "Playlists", "colors": view_config["colors"]} + return render(request, "home/playlist.html", context) + + @staticmethod + def read_config(user_id): + """read config file""" + config_handler = AppConfig(user_id) + view_config = { + "es_url": config_handler.config["application"]["es_url"], + "colors": config_handler.colors, + } + return view_config + + class VideoView(View): """resolves to /video// display details about a single video