Skip to content

Commit

Permalink
Add support for aac tagging with id3format (exaile#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
luzip665 committed Apr 10, 2023
1 parent 004617a commit e16fa3f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
13 changes: 12 additions & 1 deletion xl/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from xl.metadata._base import BaseFormat, CoverImage, NotWritable, NotReadable

from xl.metadata import (
aac,
aiff,
ape,
asf,
Expand All @@ -55,7 +56,7 @@
formats = {
# fmt: off
'669' : mod.ModFormat,
'aac' : mp4.MP4Format,
'aac' : [mp4.MP4Format, aac.AACFormat],
'ac3' : None,
'aif' : aiff.AIFFFormat,
'aifc' : aiff.AIFFFormat,
Expand Down Expand Up @@ -134,6 +135,16 @@ def get_format(loc: str) -> Optional[BaseFormat]:
if formatclass is None:
formatclass = DummyFormat

# Some file types can be more than one format
# So check each possible format
if type(formatclass) is list:
for klass in formatclass:
try:
return klass(loc)
except:
continue
return None

try:
return formatclass(loc)
except NotReadable:
Expand Down
36 changes: 36 additions & 0 deletions xl/metadata/aac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (C) 2023 luzip665
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# The developers of the Exaile media player hereby grant permission
# for non-GPL compatible GStreamer and Exaile plugins to be used and
# distributed together with GStreamer and Exaile. This permission is
# above and beyond the permissions granted by the GPL license by which
# Exaile is covered. If you modify this code, you may extend this
# exception to your version of the code, but you are not obligated to
# do so. If you do not wish to do so, delete this exception statement
# from your version.
import logging

logger = logging.getLogger(__name__)

from xl.metadata._id3 import ID3Format
from mutagen import id3


class AACFormat(ID3Format):
MutagenType = id3.ID3FileType
pass

0 comments on commit e16fa3f

Please sign in to comment.