From e3a4f7f86174eff6eddd94accbd869482b8ba06d Mon Sep 17 00:00:00 2001 From: Laptop Date: Sat, 21 Dec 2024 22:22:22 +0200 Subject: [PATCH] add warning on track page if only a snippet is available --- lib/sc/track.go | 4 +++- templates/track.templ | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/sc/track.go b/lib/sc/track.go index f620987..b50f1d4 100644 --- a/lib/sc/track.go +++ b/lib/sc/track.go @@ -48,7 +48,9 @@ type Track struct { type TrackPolicy string const ( - PolicyBlock TrackPolicy = "BLOCK" + PolicyBlock TrackPolicy = "BLOCK" // not available (in your country) + PolicySnip TrackPolicy = "SNIP" // 30-second snippet available + PolicyAllow TrackPolicy = "ALLOW" // all good ) type Protocol string diff --git a/templates/track.templ b/templates/track.templ index f8d1a5c..579e59b 100644 --- a/templates/track.templ +++ b/templates/track.templ @@ -81,6 +81,12 @@ templ TrackPlayer(prefs cfg.Preferences, track sc.Track, stream string, displayE } } + if track.Policy == sc.PolicySnip { +
+

Only a 30-second snippet is available.

+
+ } + if *prefs.ShowAudio {
if audioPref == cfg.AudioBest {