mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-07-20 16:45:32 +00:00
feat: playlist optimizations (#1216)
This commit is contained in:
@ -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
|
||||
|
@ -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
Reference in New Issue
Block a user