Index additional channel art, #build

Changed:
- Download channel tv art to filesystem
- [API] Added channel tv art urls
This commit is contained in:
simon 2023-04-05 23:20:48 +07:00
commit bde2cd4586
5 changed files with 21 additions and 6 deletions

View File

@ -64,7 +64,7 @@ class SearchProcess:
"channel_last_refresh": date_str,
"channel_banner_url": f"{art_base}_banner.jpg",
"channel_thumb_url": f"{art_base}_thumb.jpg",
"channel_tvart_url": False,
"channel_tvart_url": f"{art_base}_tvart.jpg",
}
)

View File

@ -81,6 +81,9 @@ class ThumbManagerBase:
"banner": os.path.join(
app_root, "static/img/default-channel-banner.jpg"
),
"art": os.path.join(
app_root, "static/img/default-channel-art.jpg"
),
}
img_raw = Image.open(default_map[self.item_type])
@ -149,9 +152,10 @@ class ThumbManager(ThumbManagerBase):
def download_channel_art(self, urls, skip_existing=False):
"""pass tuple of channel thumbnails"""
channel_thumb, channel_banner = urls
channel_thumb, channel_banner, channel_tv = urls
self._download_channel_thumb(channel_thumb, skip_existing)
self._download_channel_banner(channel_banner, skip_existing)
self._download_channel_tv(channel_tv, skip_existing)
def _download_channel_thumb(self, channel_thumb, skip_existing):
"""download channel thumbnail"""
@ -180,6 +184,16 @@ class ThumbManager(ThumbManagerBase):
img_raw = self.download_raw(channel_banner)
img_raw.convert("RGB").save(banner_path)
def _download_channel_tv(self, channel_tv, skip_existing):
"""download channel tv art"""
art_path = os.path.join(self.CHANNEL_DIR, self.item_id + "_tvart.jpg")
self.item_type = "tvart"
if skip_existing and os.path.exists(art_path):
return
img_raw = self.download_raw(channel_tv)
img_raw.convert("RGB").save(art_path)
def download_playlist_thumb(self, url, skip_existing=False):
"""pass thumbnail url"""
thumb_path = os.path.join(self.PLAYLIST_DIR, f"{self.item_id}.jpg")

View File

@ -240,6 +240,7 @@ class YoutubeChannel(YouTubeItem):
urls = (
self.json_data["channel_thumb_url"],
self.json_data["channel_banner_url"],
self.json_data["channel_tvart_url"],
)
ThumbManager(self.youtube_id, item_type="channel").download(urls)

View File

@ -1,11 +1,11 @@
beautifulsoup4==4.12.0
celery==5.2.7
Django==4.1.7
django-auth-ldap==4.1.0
Django==4.2
django-auth-ldap==4.2.0
django-cors-headers==3.14.0
djangorestframework==3.14.0
Pillow==9.4.0
redis==4.5.3
Pillow==9.5.0
redis==4.5.4
requests==2.28.2
ryd-client==0.0.6
uWSGI==2.0.21

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB