cover fix

This commit is contained in:
2026-01-26 08:14:42 +01:00
parent e4c94ac85a
commit 4855860487
+18 -14
View File
@@ -1,13 +1,9 @@
--- ---
# Calibre-Web-Automated - All-in-one eBook library solution
# Namespace
apiVersion: v1 apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: calibre-system name: calibre-system
--- ---
# Custom Metadata Providers ConfigMap
# Contains Hungarian metadata providers: moly.hu and libri.hu
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@@ -282,19 +278,27 @@ data:
return None return None
def _parse_cover(self, root) -> Optional[str]: def _parse_cover(self, root) -> Optional[str]:
cover_nodes = root.xpath('(//*[@class="coverbox"]//a/@href)[1]') # Best quality: og:image meta tag
if cover_nodes: og_img = root.xpath('//meta[@property="og:image"]/@content')
cover_url = cover_nodes[0] if og_img:
if not cover_url.startswith('http'): return og_img[0]
cover_url = self.BASE_URL + cover_url
return cover_url
img_nodes = root.xpath('//*[@class="coverbox"]//img/@src') # Fallback: img tags with "cover" in src
if img_nodes: cover_imgs = root.xpath('//img[contains(@src, "cover")]/@src')
img_url = img_nodes[0] if cover_imgs:
img_url = cover_imgs[0]
if not img_url.startswith('http'): if not img_url.startswith('http'):
img_url = self.BASE_URL + img_url img_url = "https:" + img_url if img_url.startswith('//') else self.BASE_URL + img_url
return img_url return img_url
# Last resort: content section images
content_imgs = root.xpath('//*[@id="content"]//img/@src')
if content_imgs:
img_url = content_imgs[0]
if not img_url.startswith('http'):
img_url = "https:" + img_url if img_url.startswith('//') else self.BASE_URL + img_url
return img_url
return None return None
def _parse_publisher(self, root) -> Optional[str]: def _parse_publisher(self, root) -> Optional[str]: