Skip to content

Commit 11afd93

Browse files
committed
v4.0.5
1 parent 02b0061 commit 11afd93

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
# autocue changelog
22

3+
### 2024-07-02 – v4.0.5
4+
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:
6+
```
7+
2024/07/02 16:03:27 [autocue:2] Error while processing autocue: error(kind="json",message="Parsing error: json value cannot be parsed as type {duration: float, _}",positions="at autocue.liq, line 814 char 6 - line 826 char 10")
8+
```
9+
- `cue_file` now outputs the same duration for both tag reading and full analysis mode.
10+
- `cue_file` will not anymore write a `duration` tag to files. That was a newly introduced bug in v4.0.4.
11+
12+
313
### 2024-07-01 – v4.0.4
414

515
- Allow to override results via JSON even _after_ having done a fresh analysis (automatic or forced), for ultimate flexibility when using `cue_file` for pre-processing. You can now add fades, ramp or hook points, or do other calculations and feed the results into `cue_file` for tagging. **Use with care**, because some values are dependent on others. In any case, `cue_file` will ever _only_ write tags beginning with `liq_` and (if requested) `replaygain_`.
616
- Prevent some strange errors that could happen when piping something into `cue_file` and JSON input was not `stdin`. We now use `ffmpeg -nostdin` to prevent it reading input that was meant for `cue_file`.
717
- Don’t write _all_ `liq_*` tags (could have side effects), but only those _known_ (see `cue_file --help` for current list).
818
- Streamlined tag conversion code a little.
919

20+
1021
### 2024-06-18 – v4.0.3
1122

1223
- Changed default of `-x`/`--extra` and `settings.autocue.cue_file.overlay_longtail` from `-15.0` LU to `-12.0` LU, requested by @RM-FM and the community. Together with the `-d`/`--drop` default change from `60.0` to `40.0`, this makes for a "tighter" playout and doesn’t lose too much of long or sustained endings.

autocue.cue_file.liq

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# 2024-06-18 - Moonbase59 - v4.0.3 - Changed overlay_longtail from -15 to -12,
3939
# most people seem to want transitions a bit tighter
4040
# 2024-07-01 - Moonbase59 - v4.0.4 - Sync with cue_file version
41+
# 2024-07-02 - Moonbase59 - v4.0.5 - Sync with cue_file version
4142

4243
# Lots of debugging output for AzuraCast in this, will be removed eventually.
4344

@@ -51,7 +52,7 @@ let settings.autocue.cue_file.version =
5152
settings.make(
5253
description=
5354
"Software version of autocue.cue_file. Should coincide with `cue_file`.",
54-
"4.0.4"
55+
"4.0.5"
5556
)
5657

5758
# Internal only! Not a user setting.

cue_file

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@
6363
# errors when piping something to cue_file
6464
# - streamline tag conversion code a little
6565
# - only write known tags, not all `liq_*`
66+
# 2024-07-02 Moonbase59 - v4.0.5 Fix minor bugs with file duration
6667
#
6768
# Originally based on an idea and some code by John Warburton (@Warblefly):
6869
# https://github.com/Warblefly/TrackBoundaries
6970
# Some collaborative work with RM-FM (@RM-FM): Sustained ending analysis.
7071

7172
__author__ = 'Matthias C. Hormann'
72-
__version__ = '4.0.4'
73+
__version__ = '4.0.5'
7374

7475
import os
7576
import sys
@@ -356,10 +357,10 @@ def read_tags(
356357
tags_found = {**tags_in_stream, **tags_in_format, **tags_in_json}
357358
# eprint(json.dumps(tags_found, indent=2, sort_keys=True))
358359

359-
# add duration of stream #0
360+
# add duration of stream #0 if it exists and can be converted to float
360361
try:
361-
tags_found["duration"] = result['streams'][0]['duration']
362-
except KeyError:
362+
tags_found["duration"] = float(result['streams'][0]['duration'])
363+
except (KeyError, ValueError):
363364
try:
364365
# we might have a video duration (.mka) like "00:07:01.117000000",
365366
# ignore
@@ -903,6 +904,10 @@ def write_tags(filename, tags={}, replaygain=False):
903904
tags_new.pop(k, None)
904905
del tags_new["R128_TRACK_GAIN"]
905906

907+
# Never write "duration" to tags
908+
if "duration" in tags_new:
909+
del tags_new["duration"]
910+
906911
# eprint(replaygain, temp, json.dumps(tags_new, indent=2))
907912

908913
if MUTAGEN_AVAILABLE and filename.suffix.casefold() in mp4_ext:
@@ -1223,6 +1228,9 @@ if args.force or not skip_analysis:
12231228
# allow to override even the analysis results
12241229
if args.json:
12251230
result = override_from_JSON(result, tags_json)
1231+
# override duration, seems ffprobe can be more exact
1232+
if "duration" in tags_found:
1233+
result["duration"] = tags_found["duration"]
12261234
else:
12271235
result = add_missing(tags_found, args.target, args.blankskip, args.noclip)
12281236

0 commit comments

Comments
 (0)