Repos / pytaku / 59dad87784
commit 59dad87784c375b971e04a1afda10dac1c2c6253
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Mon Aug 10 23:15:38 2020 +0700
ofc I messed up the thumbnails
diff --git a/src/mangoapi/base_site.py b/src/mangoapi/base_site.py
index 23f97ee..afa801d 100644
--- a/src/mangoapi/base_site.py
+++ b/src/mangoapi/base_site.py
@@ -24,6 +24,10 @@ def search_title(self, query):
def title_cover(self, title_id, cover_ext):
pass
+ @abstractmethod
+ def title_thumbnail(self, title_id):
+ pass
+
@abstractmethod
def title_source_url(self, title_id):
pass
diff --git a/src/mangoapi/mangadex.py b/src/mangoapi/mangadex.py
index ff9c5b1..cc56e68 100644
--- a/src/mangoapi/mangadex.py
+++ b/src/mangoapi/mangadex.py
@@ -98,6 +98,9 @@ def login(self, username, password):
def title_cover(self, title_id, cover_ext):
return f"https://mangadex.org/images/manga/{title_id}.{cover_ext}"
+ def title_thumbnail(self, title_id):
+ return f"https://mangadex.org/images/manga/{title_id}.large.jpg"
+
def title_source_url(self, title_id):
return f"https://mangadex.org/manga/{title_id}"
diff --git a/src/mangoapi/mangasee.py b/src/mangoapi/mangasee.py
index 07b3524..8abaa99 100644
--- a/src/mangoapi/mangasee.py
+++ b/src/mangoapi/mangasee.py
@@ -1,9 +1,9 @@
import json
import re
-import apsw
import requests
+import apsw
from mangoapi.base_site import Site
regexes = {
@@ -120,6 +120,9 @@ def search_title(self, query):
]
def title_cover(self, title_id, cover_ext):
+ return self.title_thumbnail(title_id)
+
+ def title_thumbnail(self, title_id):
return f"https://cover.mangabeast01.com/cover/{title_id}.jpg"
def title_source_url(self, title_id):
diff --git a/src/pytaku/main.py b/src/pytaku/main.py
index fc182a4..38b2754 100644
--- a/src/pytaku/main.py
+++ b/src/pytaku/main.py
@@ -33,6 +33,7 @@
search_title_all_sites,
title_cover,
title_source_url,
+ title_thumbnail,
)
config.load()
@@ -57,7 +58,7 @@ def home_view():
def follows_view():
titles = get_followed_titles(session["user"]["id"])
for title in titles:
- title["cover"] = title_cover(title["site"], title["id"], title["cover_ext"])
+ title["thumbnail"] = title_thumbnail(title["site"], title["id"])
return render_template("follows.html", titles=titles)
diff --git a/src/pytaku/source_sites.py b/src/pytaku/source_sites.py
index 71a0d98..ebfd3ba 100644
--- a/src/pytaku/source_sites.py
+++ b/src/pytaku/source_sites.py
@@ -42,6 +42,10 @@ def title_cover(site_name, title_id, cover_ext):
return _get_site(site_name).title_cover(title_id, cover_ext)
+def title_thumbnail(site_name, title_id):
+ return _get_site(site_name).title_thumbnail(title_id)
+
+
def title_source_url(site_name, title_id):
return _get_site(site_name).title_source_url(title_id)
diff --git a/src/pytaku/templates/follows.html b/src/pytaku/templates/follows.html
index ec88dde..957bb24 100644
--- a/src/pytaku/templates/follows.html
+++ b/src/pytaku/templates/follows.html
@@ -75,7 +75,7 @@
<div>
<a href="{{ title_url }}">
<img class="cover"
- src="{{ title['cover'] }}"
+ src="{{ title['thumbnail'] }}"
alt="{{ title['name'] }}" />
</a>
</div>