From 5a45cadaf00cdc35aaa9ae6a69a80c9b8b55e530 Mon Sep 17 00:00:00 2001
From: albacodina <48245111+albacodina@users.noreply.github.com>
Date: Wed, 11 Dec 2024 13:35:03 +0100
Subject: [PATCH] TTK-27401: Only show dynamic track if it exists (#688)
* TTK-27401: Only show dynamic track if it exists
* TTK-27401: Add dynamic tag to show tracks
---
config/packages/encoder.yaml | 2 +-
.../WebTVBundle/Resources/views/Misc/tracks.html.twig | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/config/packages/encoder.yaml b/config/packages/encoder.yaml
index c584846b4..168d2c8e5 100644
--- a/config/packages/encoder.yaml
+++ b/config/packages/encoder.yaml
@@ -83,7 +83,7 @@ pumukit_encoder:
wizard: true
master: false
nocheckduration: false
- tags: html5 podcast
+ tags: html5 podcast dynamic
target: PUCHPODCAST
format: m3u8
codec: h264
diff --git a/src/Pumukit/WebTVBundle/Resources/views/Misc/tracks.html.twig b/src/Pumukit/WebTVBundle/Resources/views/Misc/tracks.html.twig
index 1a4725646..438931a74 100644
--- a/src/Pumukit/WebTVBundle/Resources/views/Misc/tracks.html.twig
+++ b/src/Pumukit/WebTVBundle/Resources/views/Misc/tracks.html.twig
@@ -15,7 +15,10 @@
{% else %}
{% set tracks = object.getFilteredTracksWithTags(['display'], [], [], []) %}
- {% for track in tracks | filter(track => not track.isHide()) %}
+ {% set dynamic_quality_tracks = tracks | filter(track => track.tags().containsTag('dynamic')) %}
+ {% set filtered_tracks = (dynamic_quality_tracks | length > 0) ? dynamic_quality_tracks : tracks %}
+
+ {% for track in filtered_tracks | filter(track => not track.isHide()) %}
{% if magic_url is defined %}
{% set url_track = url('pumukit_webtv_multimediaobject_magicindex', {secret: object.secret, 'track_id': track.id}) %}
{% else %}
@@ -39,7 +42,8 @@
{% endif %}
{% endapply %}
- ({{ track.language()|language_name|capitalize }})
+ ({{ track.language()|language_name|capitalize }})
+
{% endfor %}
{% endif %}