mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 07:28:53 -05:00
feat: playlist optimizations (#1216)
This commit is contained in:
parent
50e9f3103f
commit
21f76dbb6e
@ -1312,7 +1312,7 @@ class Playlist(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def media_count(self):
|
def media_count(self):
|
||||||
return self.media.count()
|
return self.media.filter(listable=True).count()
|
||||||
|
|
||||||
def get_absolute_url(self, api=False):
|
def get_absolute_url(self, api=False):
|
||||||
if api:
|
if api:
|
||||||
@ -1359,7 +1359,7 @@ class Playlist(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def thumbnail_url(self):
|
def thumbnail_url(self):
|
||||||
pm = self.playlistmedia_set.first()
|
pm = self.playlistmedia_set.filter(media__listable=True).first()
|
||||||
if pm and pm.media.thumbnail:
|
if pm and pm.media.thumbnail:
|
||||||
return helpers.url_from_path(pm.media.thumbnail.path)
|
return helpers.url_from_path(pm.media.thumbnail.path)
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -46,6 +46,11 @@ if (window.MediaCMS.site.devEnv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PlayAllLink(props) {
|
function PlayAllLink(props) {
|
||||||
|
|
||||||
|
if (!props.media || !props.media.length) {
|
||||||
|
return <span>{props.children}</span>;
|
||||||
|
}
|
||||||
|
|
||||||
let playAllUrl = props.media[0].url;
|
let playAllUrl = props.media[0].url;
|
||||||
|
|
||||||
if (window.MediaCMS.site.devEnv && -1 < playAllUrl.indexOf('view?')) {
|
if (window.MediaCMS.site.devEnv && -1 < playAllUrl.indexOf('view?')) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user