From 2d95fc52bbcafbab07025740bd9094a72d6ba248 Mon Sep 17 00:00:00 2001 From: Moonbase59 Date: Mon, 5 Aug 2024 08:05:01 +0200 Subject: [PATCH] Fix JSON override if `liq_cue_file` is true --- CHANGELOG.md | 5 +++++ autocue.cue_file.liq | 3 ++- cue_file | 14 +++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1916ec0..70f205c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # autocue changelog +### 2024-08-05 - v4.1.1 + +- Fix situation where supplied JSON data could still overwrite `cue_file` results even if a file’s `liq_cue_file` tag was set to `true`, meaning the `cue_file` results should be preferred in any case. +- For freshly generated/downloaded news or time announcements, this could lead to erroneous cut-offs or loudness jumps in case AzuraCast’s media checker hadn’t yet picked up the new data. It would then overwrite the actual file data with stored values from the database. + ### 2024-07-05 – v4.1.0 #### New features diff --git a/autocue.cue_file.liq b/autocue.cue_file.liq index d54faad..7c30365 100644 --- a/autocue.cue_file.liq +++ b/autocue.cue_file.liq @@ -49,6 +49,7 @@ # - not set = default (metadata can override cue_file) # - false = don’t autocue (still use metadata if present) # - true = cue_file results override metadata +# 2024-08-05 - Moonbase59 - v4.1.1 Sync with cue_file version # Lots of debugging output for AzuraCast in this, will be removed eventually. @@ -62,7 +63,7 @@ let settings.autocue.cue_file.version = settings.make( description= "Software version of autocue.cue_file. Should coincide with `cue_file`.", - "4.1.0" + "4.1.1" ) # Internal only! Not a user setting. diff --git a/cue_file b/cue_file index 7460c54..b960bbb 100755 --- a/cue_file +++ b/cue_file @@ -68,13 +68,14 @@ # 2024-07-05 Moonbase59 - v4.1.0 Add `liq_cue_file` to known tags, so we can # forbid external processes to call us again and # possibly deliver outdated metadata to us. +# 2024-08-05 Moonbase59 - v4.1.1 Fix JSON overriding if `liq_cue_file` is true # # 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.1.0' +__version__ = '4.1.1' import os import sys @@ -304,9 +305,12 @@ def override_from_JSON(tags, tags_json={}): # get tags in JSON override file tags_in_json = convert_tags(tags_json) - # unify, right overwrites left if key in both - # tags_found = tags_in_stream | tags_in_format | tags_in_json - tags = {**tags, **tags_in_json} + # do NOT overwrite from JSON if `liq_cue_file` is true + if "liq_cue_file" in tags and tags["liq_cue_file"] == True: + pass + else: + # unify, right overwrites left if key in both + tags = {**tags, **tags_in_json} return tags @@ -1230,7 +1234,7 @@ if args.force or not skip_analysis: nice=args.nice, noclip=args.noclip ) - # allow to override even the analysis results + # allow to override even the analysis results (not if `liq_cue_file=true`) if args.json: result = override_from_JSON(result, tags_json) # override duration, seems ffprobe can be more exact