Help with Python/Eyed3 MusicCDIdFrame method

Dennis Lee Bieber wlfraed at ix.netcom.com
Mon Jun 6 13:35:00 EDT 2022


On Mon, 6 Jun 2022 12:37:47 +0200, Dave <dave at looktowindward.com> declaimed
the following:
>Hi,
>>I’m trying to get the ID3 tags of an mp3 file. I trying to use the MusicCDIdFrame
> method but I can’t seem to get it right. Here is a code snippet:
>>> import eyed3
>import eyed3.id3
>import eyed3.id3.frames
>import eyed3.id3.apple

	As I understand the documentation, The last is Apple
specific/non-standard information...
https://eyed3.readthedocs.io/en/latest/eyed3.id3.html
"""
eyed3.id3.apple module
Here lies Apple frames, all of which are non-standard. All of these would
have been standard user text frames by anyone not being a bastard, on
purpose.
"""
{I'm not thrilled by the documentation -- it is basically a collection on
one-line doc-strings with absolutely no hints as to proper usage}
> File "/Documents/Python/Test1/main.py", line 94, in <module>
> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>AttributeError: 'Mp3AudioFile' object has no attribute 'id3'

"""
 eyed3.core.load(path, tag_version=None)[source]
 Loads the file identified by path and returns a concrete type of
eyed3.core.AudioFile. If path is not a file an IOError is raised. None is
returned when the file type (i.e. mime-type) is not recognized. The
following AudioFile types are supported:
 eyed3.mp3.Mp3AudioFile - For mp3 audio files.
 eyed3.id3.TagFile - For raw ID3 data files.
"""
	eyed3.id3.xxxx would appear to be specific to non-MP3 data files.
	So... I'd try the interactive environment and check each layer...
		dir(myID3)
(based upon the error, there will not be a "id3" key; so try
dir(myID3.xxxx) for each key you do find).
>>>Any help or suggestion greatly appreciated.
>
	Given this bit of source code from the documentation...
def initTag(self, version=id3.ID3_DEFAULT_VERSION):
 """Add a id3.Tag to the file (removing any existing tag if one
exists).
 """
 self.tag = id3.Tag()
 self.tag.version = version
 self.tag.file_info = id3.FileInfo(self.path)
 return self.tag
... you probably need to be looking at 
		myID3.tag.xxxx
... try
		dir(myID3.tag)
and see what all may appear...
	IOW: the ID3 information has already been parsed into separate "tag"
fields.
-- 
	Wulfraed Dennis Lee Bieber AF6VN
	wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /