Add YouTube thumbnail support

Fixes #359
This commit is contained in:
rubenwardy
2024-06-07 06:25:32 +01:00
parent ee83a7b5ce
commit 5bd97598a8
6 changed files with 67 additions and 7 deletions

View File

@@ -392,6 +392,19 @@ class Package(db.Model):
def donate_url_actual(self):
return self.donate_url or self.author.donate_url
@property
def video_thumbnail_url(self):
from app.utils.url import get_youtube_id
if self.video_url is None:
return None
id_ = get_youtube_id(self.video_url)
if id_:
return url_for("thumbnails.youtube", id_=id_)
return None
enable_game_support_detection = db.Column(db.Boolean, nullable=False, default=True)
translations = db.relationship("PackageTranslation", back_populates="package",