sane-tag-music: support opus, aac (limited)

This commit is contained in:
Colin 2023-12-07 16:54:03 +00:00
parent 8c98e38053
commit bbe8f4a852

View File

@ -11,6 +11,7 @@ import logging
import os.path
import mutagen.easyid3
import mutagen.flac
import mutagen.oggopus
import mutagen.oggvorbis
logger = logging.getLogger(__name__)
@ -230,12 +231,19 @@ class AudioFile:
_base, ext = os.path.splitext(path_)
try:
# TODO: handle:
# - .m4a
# - .wav
# - .wma
if ext == '.flac':
self.muta = mutagen.flac.Open(path_)
elif ext == '.mp3':
elif ext in ['.aac', '.mp3']:
# TODO: this seems to only read tags, and not create them?
self.muta = mutagen.easyid3.EasyID3(path_)
elif ext == '.ogg':
self.muta = mutagen.oggvorbis.OggVorbis(path_)
elif ext == '.opus':
self.muta = mutagen.oggopus.OggOpus(path_)
else:
logger.debug(f"no metadata handler for {path_}")
except Exception as e: