diff --git a/CHANGELOG.md b/CHANGELOG.md index 11f1950..0c3bfdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # autocue changelog +### 2024-07-04 – v4.0.6 + +- Make `duration` non-overridable by existing metadata or annotations. + - The real file duration is not a tag, but determined otherwise. + - If such a tag is found, it is typically unusable, incorrect or in a different format. + - AzuraCast might annotate the duration from an earlier version of the file, because the media scan is only done once in a while. With frequently changing files of the same name, like syndicated news or time announcements, this could be problematic. + ### 2024-07-02 – v4.0.5 - Fixed a situation where `cue_file` would read a string duration from ffprobe for audio stream \#0, which led to an error in the AzuraCast log like this: diff --git a/autocue.cue_file.liq b/autocue.cue_file.liq index 3d086ea..69a6ad8 100644 --- a/autocue.cue_file.liq +++ b/autocue.cue_file.liq @@ -39,6 +39,8 @@ # most people seem to want transitions a bit tighter # 2024-07-01 - Moonbase59 - v4.0.4 - Sync with cue_file version # 2024-07-02 - Moonbase59 - v4.0.5 - Sync with cue_file version +# 2024-07-04 - Moonbase59 - v4.0.6 - Make duration non-overridable, i.e., +# it’s ALWAYS taken from the cue_file result. # Lots of debugging output for AzuraCast in this, will be removed eventually. @@ -52,7 +54,7 @@ let settings.autocue.cue_file.version = settings.make( description= "Software version of autocue.cue_file. Should coincide with `cue_file`.", - "4.0.5" + "4.0.6" ) # Internal only! Not a user setting. @@ -204,6 +206,15 @@ let settings.autocue.cue_file.use_json_metadata = true ) +let settings.autocue.cue_file.ignored_overrides = + settings.make( + description= + 'List of cue_file results that cannot be overridden by existing \ + metadata or annotations. One such field is `duration`, as it is not \ + a tag, and determined otherwise.', + ['duration'] + ) + stdlib_metadata = metadata # metadata.json.stringify only exports a limited set, use our own @@ -450,21 +461,6 @@ def cue_file(~request_metadata, ~file_metadata, filename) = end end - # # Handle annotated `liq_blankskip`, the ultimate switch - # # Pre-v3.0.0 compatibility: Check for true/false (now float) - # if list.assoc.mem("liq_blankskip", meta) then - # b = meta["liq_blankskip"] - # if b == "true" then - # blankskip := blankskip() - # elsif b == "false" then - # blankskip := 0.0 - # else - # blankskip := float_of_string(default=0.0, b) - # end - # m := list.assoc.remove("liq_blankskip", m()) - # m := list.add(("liq_blankskip", string.float(decimal_places=2, blankskip())), m()) - # end - # Handle annotated `liq_blankskip`, the ultimate switch # Pre-v3.0.0 compatibility: Check for true/false (now float) if list.assoc.mem("liq_blankskip", meta) then @@ -642,13 +638,19 @@ def cue_file(~request_metadata, ~file_metadata, filename) = ) # only use calculated values if not already annotated in AzuraCast - # so we don't overwrite manually set values in the database + # so we don't overwrite manually set values in the database, + # except for non-overridable values like `duration`, which are + # ALWAYS taken from the cue_file result. result := list.fold( fun(res, entry) -> if list.assoc.mem(fst(entry), res) then - res + if list.mem(fst(entry), settings.autocue.cue_file.ignored_overrides()) then + [...list.assoc.remove(fst(entry), res), entry] # take cue_file result + else + res # take existing metadata + end else - [...res, entry] + [...res, entry] # append new metadata end, m(), result() diff --git a/cue_file b/cue_file index bab04ad..bbd476c 100755 --- a/cue_file +++ b/cue_file @@ -64,13 +64,14 @@ # - streamline tag conversion code a little # - only write known tags, not all `liq_*` # 2024-07-02 Moonbase59 - v4.0.5 Fix minor bugs with file duration +# 2024-07-04 Moonbase59 - v4.0.6 Sync version with autocue.cue_file.liq # # Originally based on an idea and some code by John Warburton (@Warblefly): # https://github.com/Warblefly/TrackBoundaries # Some collaborative work with RM-FM (@RM-FM): Sustained ending analysis. __author__ = 'Matthias C. Hormann' -__version__ = '4.0.5' +__version__ = '4.0.6' import os import sys