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
kind: Namespace
metadata:
name: calibre-system
---
# Custom Metadata Providers ConfigMap
# Contains Hungarian metadata providers: moly.hu and libri.hu
apiVersion: v1
kind: ConfigMap
metadata:
@@ -282,19 +278,27 @@ data:
return None
def _parse_cover(self, root) -> Optional[str]:
cover_nodes = root.xpath('(//*[@class="coverbox"]//a/@href)[1]')
if cover_nodes:
cover_url = cover_nodes[0]
if not cover_url.startswith('http'):
cover_url = self.BASE_URL + cover_url
return cover_url
# Best quality: og:image meta tag
og_img = root.xpath('//meta[@property="og:image"]/@content')
if og_img:
return og_img[0]
img_nodes = root.xpath('//*[@class="coverbox"]//img/@src')
if img_nodes:
img_url = img_nodes[0]
# Fallback: img tags with "cover" in src
cover_imgs = root.xpath('//img[contains(@src, "cover")]/@src')
if cover_imgs:
img_url = cover_imgs[0]
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
# 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
def _parse_publisher(self, root) -> Optional[str]: