feat: playlist optimizations (#1216)

This commit is contained in:
Markos Gogoulos
2025-03-09 20:44:04 +02:00
committed by GitHub
parent 50e9f3103f
commit 21f76dbb6e
3 changed files with 8 additions and 3 deletions

View File

@ -1312,7 +1312,7 @@ class Playlist(models.Model):
@property
def media_count(self):
return self.media.count()
return self.media.filter(listable=True).count()
def get_absolute_url(self, api=False):
if api:
@ -1359,7 +1359,7 @@ class Playlist(models.Model):
@property
def thumbnail_url(self):
pm = self.playlistmedia_set.first()
pm = self.playlistmedia_set.filter(media__listable=True).first()
if pm and pm.media.thumbnail:
return helpers.url_from_path(pm.media.thumbnail.path)
return None

View File

@ -46,6 +46,11 @@ if (window.MediaCMS.site.devEnv) {
}
function PlayAllLink(props) {
if (!props.media || !props.media.length) {
return <span>{props.children}</span>;
}
let playAllUrl = props.media[0].url;
if (window.MediaCMS.site.devEnv && -1 < playAllUrl.indexOf('view?')) {

File diff suppressed because one or more lines are too long