aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-10-04 20:08:24 -0400
committerBobby <[email protected]>2024-10-04 20:08:24 -0400
commit8d62522b9663eaf02c9ccb9f48cac4b79bbd39b1 (patch)
treee900717b84ec9b9fef00b567a1956c2e7246c4fa
parent84cf5588b43a78cde30dddf18235c494fc1f346f (diff)
downloadyugen-8d62522b9663eaf02c9ccb9f48cac4b79bbd39b1.tar.xz
yugen-8d62522b9663eaf02c9ccb9f48cac4b79bbd39b1.zip
prepare read and move detail route to anime
-rw-r--r--detail/urls.py5
-rw-r--r--detail/views.py2
-rw-r--r--read/__init__.py0
-rw-r--r--read/admin.py3
-rw-r--r--read/apps.py6
-rw-r--r--read/migrations/__init__.py0
-rw-r--r--read/models.py3
-rw-r--r--read/tests.py3
-rw-r--r--read/views.py3
-rw-r--r--templates/detail/detail.html2
-rw-r--r--templates/home/index.html2
-rw-r--r--templates/partials/mangacard_render.html2
-rw-r--r--templates/watch/watch.html2
-rw-r--r--watch/views.py10
-rw-r--r--yugen/settings.py6
-rw-r--r--yugen/urls.py2
16 files changed, 36 insertions, 15 deletions
diff --git a/detail/urls.py b/detail/urls.py
index 7f172ad..9897835 100644
--- a/detail/urls.py
+++ b/detail/urls.py
@@ -4,6 +4,7 @@ from . import views
app_name = "detail"
urlpatterns = [
- path('', views.index, name='index'),
- path('/<int:anime_id>', views.detail, name='detail'),
+ path('anime', views.index, name='index'),
+ path('manga', views.index, name='index'),
+ path('anime/<int:anime_id>', views.anime, name='anime'),
]
diff --git a/detail/views.py b/detail/views.py
index 5e89355..fddbbde 100644
--- a/detail/views.py
+++ b/detail/views.py
@@ -5,7 +5,7 @@ from watch.utils import attach_episode_metadata, get_anime_data, get_anime_seaso
def index(request):
return redirect("home:index")
-def detail(request, anime_id):
+def anime(request, anime_id):
anime_data = get_anime_data(anime_id, provider="zoro")
if "status" in anime_data and anime_data["status"] != "Not yet aired":
diff --git a/read/__init__.py b/read/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/read/__init__.py
diff --git a/read/admin.py b/read/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/read/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/read/apps.py b/read/apps.py
new file mode 100644
index 0000000..f4c6a0a
--- /dev/null
+++ b/read/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class ReadConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "read"
diff --git a/read/migrations/__init__.py b/read/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/read/migrations/__init__.py
diff --git a/read/models.py b/read/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/read/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/read/tests.py b/read/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/read/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/read/views.py b/read/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/read/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/templates/detail/detail.html b/templates/detail/detail.html
index dead21e..5f0e0c9 100644
--- a/templates/detail/detail.html
+++ b/templates/detail/detail.html
@@ -279,7 +279,7 @@
<div class="flex flex-row gap-2 mt-4 overflow-x-auto no-scrollbar swiper seasonSwiper">
<div class="swiper-wrapper">
{% for season in seasons %}
- <a href="{% url "detail:detail" season.id %}" class="group rounded-lg aspect-video h-48 relative flex-shrink-0 overflow-hidden swiper-slide
+ <a href="{% url "detail:anime" season.id %}" class="group rounded-lg aspect-video h-48 relative flex-shrink-0 overflow-hidden swiper-slide
{% if season.title.romaji == anime.title.romaji %}border-4 border-{{ user.preferences.accent_colour }}-600{% endif %}">
<div class="absolute inset-0 bg-center bg-cover transition-transform group-hover:scale-110" style="background-image: url('{% if season.bannerImage %}{{ season.bannerImage }}{% else %}{{ season.coverImage }}{% endif %}')"></div>
<div class="absolute inset-0 bg-{{ user.preferences.accent_colour }}-600 opacity-0 group-hover:opacity-30 transition-opacity"></div>
diff --git a/templates/home/index.html b/templates/home/index.html
index 04b3da5..9eb9113 100644
--- a/templates/home/index.html
+++ b/templates/home/index.html
@@ -59,7 +59,7 @@
</div>
</div>
<div class="flex flex-row w-full lg:w-1/2 gap-2 lg:justify-end items-end">
- <a href="{% url "detail:detail" anime.id %}" class="bg-white bg-opacity-10 text-white text-sm font-bold py-3 px-6 rounded-full flex items-center gap-2">
+ <a href="{% url "detail:anime" anime.id %}" class="bg-white bg-opacity-10 text-white text-sm font-bold py-3 px-6 rounded-full flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"/>
</svg>
diff --git a/templates/partials/mangacard_render.html b/templates/partials/mangacard_render.html
index 88f0b8f..a62ff3e 100644
--- a/templates/partials/mangacard_render.html
+++ b/templates/partials/mangacard_render.html
@@ -1,6 +1,6 @@
{% for manga in data %}
<div class="w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/6 text-gray-500 p-1 sm:p-2 mb-4 hover:text-white flex flex-col">
- <a href="#">
+ <a href="{{ manga.id }}">
<div class="relative pt-[140%]">
<img loading="lazy" src="{{ manga.coverImage.large }}" alt="{{ manga.title.english }}" class="absolute top-0 left-0 w-full h-full rounded-lg object-cover"/>
</div>
diff --git a/templates/watch/watch.html b/templates/watch/watch.html
index 2133fcc..3d2e4f3 100644
--- a/templates/watch/watch.html
+++ b/templates/watch/watch.html
@@ -291,7 +291,7 @@
<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" height="1.5rem" width="1.5rem" xmlns="http://www.w3.org/2000/svg"><path d="M8.273 7.247v8.423l-2.103-.003v-5.216l-2.03 2.404-1.989-2.458-.02 5.285H.001L0 7.247h2.203l1.865 2.545 2.015-2.546 2.19.001zm8.628 2.069l.025 6.335h-2.365l-.008-2.871h-2.8c.07.499.21 1.266.417 1.779.155.381.298.751.583 1.128l-1.705 1.125c-.349-.636-.622-1.337-.878-2.082a9.296 9.296 0 0 1-.507-2.179c-.085-.75-.097-1.471.107-2.212a3.908 3.908 0 0 1 1.161-1.866c.313-.293.749-.5 1.1-.687.351-.187.743-.264 1.107-.359a7.405 7.405 0 0 1 1.191-.183c.398-.034 1.107-.066 2.39-.028l.545 1.749H14.51c-.593.008-.878.001-1.341.209a2.236 2.236 0 0 0-1.278 1.92l2.663.033.038-1.81h2.309zm3.992-2.099v6.627l3.107.032-.43 1.775h-4.807V7.187l2.13.03z"></path></svg>
</a>
</div>
- <a href="{% url "detail:detail" anime.id %}" class="bg-{{ user.preferences.accent_colour }}-600 hover:bg-{{ user.preferences.accent_colour }}-700 text-white text-xs sm:text-sm font-bold py-1 px-2 sm:py-2 sm:px-4 rounded-lg flex flex-row items-center justify-center gap-1 w-full">
+ <a href="{% url "detail:anime" anime.id %}" class="bg-{{ user.preferences.accent_colour }}-600 hover:bg-{{ user.preferences.accent_colour }}-700 text-white text-xs sm:text-sm font-bold py-1 px-2 sm:py-2 sm:px-4 rounded-lg flex flex-row items-center justify-center gap-1 w-full">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-4">
<path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" />
</svg>
diff --git a/watch/views.py b/watch/views.py
index 08cb13a..c343fa8 100644
--- a/watch/views.py
+++ b/watch/views.py
@@ -17,7 +17,7 @@ def watch(request, anime_id, episode=None):
preload_request = request.GET.get("preload") == "true"
if not episode and request.user.preferences.default_watch_page == "detail" and not forward_detail:
- return redirect("detail:detail", anime_id=anime_id)
+ return redirect("detail:anime", anime_id=anime_id)
provider = "gogo" if request.user.preferences.default_provider == "gogoanime" else "zoro"
provider = request.GET.get("provider", provider)
@@ -37,7 +37,7 @@ def watch(request, anime_id, episode=None):
anime_data = get_anime_data(anime_id, provider=provider, dub=dub)
if anime_data and "status" in anime_data and anime_data["status"] == "Not yet aired":
- return redirect("detail:detail", anime_id=anime_id)
+ return redirect("detail:anime", anime_id=anime_id)
episodes = anime_data["episodes"]
if len(episodes) == 0:
@@ -132,7 +132,7 @@ def watch(request, anime_id, episode=None):
# forward_detail = request.GET.get("forward") == "detail"
# preload_request = request.GET.get("preload") == "true"
# if not episode and request.user.preferences.default_watch_page == "detail" and not forward_detail:
- # return redirect("detail:detail", anime_id=anime_id)
+ # return redirect("detail:anime", anime_id=anime_id)
# anime_fetched, provider, gogodub = get_anime_data(anime_id)
# provider = provider.decode() if isinstance(provider, bytes) else provider
@@ -141,7 +141,7 @@ def watch(request, anime_id, episode=None):
# if not anime_fetched:
# provider = "gogo"
# if anime_fetched and "status" in anime_fetched and anime_fetched["status"] == "Not yet aired":
- # return redirect("detail:detail", anime_id=anime_id)
+ # return redirect("detail:anime", anime_id=anime_id)
# forced_update = request.GET.get("refresh") == "true"
@@ -216,7 +216,7 @@ def watch(request, anime_id, episode=None):
# gogodub = True if mode == "dub" else False
# anime_fetched, provider, gogodub = get_anime_data(anime_id, provider="gogo", gogodub=gogodub)
# if anime_fetched and "status" in anime_fetched and anime_fetched["status"] == "Not yet aired":
- # return redirect("detail:detail", anime_id=anime_id)
+ # return redirect("detail:anime", anime_id=anime_id)
# episodes, m = get_anime_episodes_gogo(anime_id, mode)
# if episodes:
# attach_episode_metadata(anime_fetched, episodes)
diff --git a/yugen/settings.py b/yugen/settings.py
index 5371efb..8049ad5 100644
--- a/yugen/settings.py
+++ b/yugen/settings.py
@@ -52,10 +52,12 @@ INSTALLED_APPS = [
"django.contrib.messages",
"django.contrib.staticfiles",
"corsheaders",
- "homepage",
"authentication",
- "watch",
+ "detail",
+ "homepage",
+ "read",
"user_profile",
+ "watch",
]
MIDDLEWARE = [
diff --git a/yugen/urls.py b/yugen/urls.py
index 087a745..5095db5 100644
--- a/yugen/urls.py
+++ b/yugen/urls.py
@@ -21,8 +21,8 @@ from django.conf.urls.static import static
urlpatterns = [
path("", include("homepage.urls", namespace="home")),
+ path("", include("detail.urls", namespace="detail")),
path("watch", include("watch.urls", namespace="watch")),
- path("detail", include("detail.urls", namespace="detail")),
path("profile", include("user_profile.urls", namespace="profile")),
path("auth", include("authentication.urls", namespace="auth")),
path("admin/", admin.site.urls),