custom 404 ui + playlist enablement fix
This commit is contained in:
parent
c280160e8b
commit
28c28191a2
@ -30,14 +30,21 @@ class PlayerController(ObController):
|
||||
self._app.add_url_rule('/serve/content/<content_type>/<content_id>/<content_location>', 'serve_content_file', self.serve_content_file, methods=['GET'])
|
||||
|
||||
def player(self, playlist_slug_or_id: str = ''):
|
||||
preview_playlist = request.args.get('preview_playlist')
|
||||
preview_content_id = request.args.get('preview_content_id')
|
||||
playlist_slug_or_id = self._get_dynamic_playlist_id(playlist_slug_or_id)
|
||||
|
||||
current_playlist = self._model_store.playlist().get_one_by("(slug = ? OR id = ?) AND enabled = ?", {
|
||||
query = " (slug = ? OR id = ?) "
|
||||
query_args = {
|
||||
"slug": playlist_slug_or_id,
|
||||
"id": playlist_slug_or_id,
|
||||
"enabled": True
|
||||
})
|
||||
}
|
||||
|
||||
if not preview_playlist:
|
||||
query = query + " AND enabled = ? "
|
||||
query_args["enabled"] = True
|
||||
|
||||
current_playlist = self._model_store.playlist().get_one_by(query, query_args)
|
||||
|
||||
if playlist_slug_or_id and not current_playlist:
|
||||
return abort(404)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -65,7 +65,7 @@
|
||||
{% if current_player_group.playlist_id %}
|
||||
<div class="preview-holder">
|
||||
{% set base_url = external_url if external_url else request.scheme ~ '://' ~ request.headers.get('host') %}
|
||||
{% set preview_url = base_url ~ url_for('player_use', playlist_slug_or_id=current_player_group.playlist_id) %}
|
||||
{% set preview_url_iframe = base_url ~ url_for('player_use', playlist_slug_or_id=current_player_group.playlist_id, preview_playlist=1, intro=0, animation=0) %}
|
||||
|
||||
<h4 class="divide">
|
||||
Iframe
|
||||
@ -77,7 +77,7 @@
|
||||
<div class="preview">
|
||||
<button type="button" class="btn btn-pixel node-player-group-preview"
|
||||
title="{{ l.playlist_panel_preview_action }}"
|
||||
data-url="{{ preview_url }}?intro=0&animation=0">
|
||||
data-url="{{ preview_url_iframe }}">
|
||||
<i class="fa fa-play"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
<div class="preview-holder">
|
||||
{% set base_url = external_url if external_url else request.scheme ~ '://' ~ request.headers.get('host') %}
|
||||
{% set preview_url = base_url ~ url_for('player_use', playlist_slug_or_id=current_playlist.slug) %}
|
||||
{% set preview_url_iframe = base_url ~ url_for('player_use', playlist_slug_or_id=current_playlist.slug, preview_playlist=1, intro=0, animation=0) %}
|
||||
|
||||
<h4 class="divide">
|
||||
URL
|
||||
@ -123,7 +124,7 @@
|
||||
<div class="preview">
|
||||
<button type="button" class="btn btn-pixel playlist-preview"
|
||||
title="{{ l.playlist_panel_preview_action }}"
|
||||
data-url="{{ preview_url }}?intro=0&animation=0">
|
||||
data-url="{{ preview_url_iframe }}">
|
||||
<i class="fa fa-play"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user