From 1e31ff29b8138cd423f6d9cda1cf787b7abc697e Mon Sep 17 00:00:00 2001 From: Moonbase59 Date: Sat, 8 Jun 2024 21:29:48 +0200 Subject: [PATCH] =?UTF-8?q?v2.0.3=20=E2=80=93=20Fix=20ffmpeg=20treating=20?= =?UTF-8?q?`.ogg`=20with=20cover=20as=20video?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autocue.cue_file.liq | 3 ++- cue_file | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/autocue.cue_file.liq b/autocue.cue_file.liq index 8013851..7cfa038 100644 --- a/autocue.cue_file.liq +++ b/autocue.cue_file.liq @@ -17,6 +17,7 @@ # - Changed `liq_true_peak` to `liq_true_peak_db`, # add new `liq_true_peak` (linear, like RG) # 2024-06-05 - Moonbase59 - v2.0.2 Initial display of version, at log level 2. +# 2024-06-08 - Moonbase59 - v2.0.3 Sync version number with cue_file # Lots of debugging output for AzuraCast in this, will be removed eventually. @@ -30,7 +31,7 @@ let settings.autocue.cue_file.version = settings.make( description= "Software version of autocue.cue_file. Should coincide with `cue_file`.", - "2.0.2" + "2.0.3" ) let settings.autocue.cue_file.path = diff --git a/cue_file b/cue_file index 465b852..48bcbc8 100755 --- a/cue_file +++ b/cue_file @@ -33,12 +33,13 @@ # - v2.0.1 Fix `liq_true_peak` reading when it still # contains ` dBFS` from v1.2.3. # 2024-06-05 Moonbase59 - No change, just version number. +# 2024-06-08 Moonbase59 - v2.0.3 Fix ffmpeg treating `.ogg` with cover as video # # Originally based on an idea and some code by John Warburton (@Warblefly): # https://github.com/Warblefly/TrackBoundaries __author__ = 'Matthias C. Hormann' -__version__ = '2.0.2' +__version__ = '2.0.3' import os import tempfile @@ -58,6 +59,7 @@ try: import mutagen.mp4 import mutagen.aiff import mutagen.wave + import mutagen.oggvorbis MUTAGEN_AVAILABLE = True except ImportError: MUTAGEN_AVAILABLE = False @@ -80,7 +82,7 @@ NICE = False # use Linux/MacOS nice? safe_ext = [ ".mp3", # ID3 ".flac", ".spx", ".opus", # Vorbis Comment - ".ogg", ".oga", ".ogv", # Vorbis Comment + ".oga", ".ogv", # Vorbis Comment ".wma", ".wmv", ".asf", # ASF/WMA tags ] @@ -89,6 +91,9 @@ safe_ext = [ # MP4-like files using Apple iTunes-type tags mp4_ext = [".m4a", ".m4b", ".m4p", ".m4v", ".m4r", ".mp4", ".alac"] +# Ogg Vorbis files using VorbisComment tags +ogg_ext = [".ogg"] + # ID3v2 file types id3_ext = [".mp2", ".m2a"] @@ -110,6 +115,7 @@ ape_ext = [ if MUTAGEN_AVAILABLE: # Add the file types we can't tag safely.with ffmpeg safe_ext.extend(mp4_ext) + safe_ext.extend(ogg_ext) safe_ext.extend(id3_ext) safe_ext.extend(aiff_ext) safe_ext.extend(ape_ext) @@ -711,6 +717,15 @@ def write_tags(filename, tags={}, replaygain=False): t[k] = v t.save(filename) + elif MUTAGEN_AVAILABLE and filename.suffix.casefold() in ogg_ext: + # Ogg file types using VorbisComment tags + f = mutagen.oggvorbis.OggVorbis(filename) + if f.tags is None: + f.add_tags() + for k, v in tags_new.items(): + f[k] = v + f.save(filename) + elif MUTAGEN_AVAILABLE and filename.suffix.casefold() in aiff_ext: # AIFF with ID3 tags needs special handling f = mutagen.aiff.AIFF(filename)