Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dennis Lee Bieber
On Mon, 6 Jun 2022 12:37:47 +0200, Dave  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 
>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. 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.) 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.

... 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
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dave
Thanks! That fixed it!

> On 6 Jun 2022, at 18:46, MRAB  wrote:
> 
> On 2022-06-06 11:37, Dave wrote:
>> 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
>> import eyed3.mp3
>> myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
>> myTitle = myID3.tag.title
>> myArtist = myID3.tag.artist
>> myAlbum = myID3.tag.album
>> myAlbumArtist = myID3.tag.album_artist
>> myComposer = myID3.tag.composer
>> myPublisher = myID3.tag.publisher
>> myGenre = myID3.tag.genre.name
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> When I run this, I get the following error:
>>   File "/Documents/Python/Test1/main.py", line 94, in 
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
>> Any help or suggestion greatly appreciated.
> That line should be:
> 
> myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
> 
> Also remember that some attributes might be None, e.g. 'myID3.tag.genre' 
> might be None.
> 
> Another point: it's probably not worth importing the submodules of 'eyed3'; 
> you're not gaining anything from it.
> -- 
> https://mail.python.org/mailman/listinfo/python-list 
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread MRAB

On 2022-06-06 11:37, Dave wrote:

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
import eyed3.mp3
myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
myTitle = myID3.tag.title
myArtist = myID3.tag.artist
myAlbum = myID3.tag.album
myAlbumArtist = myID3.tag.album_artist
myComposer = myID3.tag.composer
myPublisher = myID3.tag.publisher
myGenre = myID3.tag.genre.name
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

When I run this, I get the following error:

   File "/Documents/Python/Test1/main.py", line 94, in 
 myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
AttributeError: 'Mp3AudioFile' object has no attribute 'id3'


Any help or suggestion greatly appreciated.


That line should be:

myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

Also remember that some attributes might be None, e.g. 'myID3.tag.genre' 
might be None.


Another point: it's probably not worth importing the submodules of 
'eyed3'; you're not gaining anything from it.

--
https://mail.python.org/mailman/listinfo/python-list


Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dave
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
import eyed3.mp3
myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
myTitle = myID3.tag.title
myArtist = myID3.tag.artist
myAlbum = myID3.tag.album
myAlbumArtist = myID3.tag.album_artist
myComposer = myID3.tag.composer
myPublisher = myID3.tag.publisher
myGenre = myID3.tag.genre.name
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

When I run this, I get the following error:

  File "/Documents/Python/Test1/main.py", line 94, in 
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
AttributeError: 'Mp3AudioFile' object has no attribute 'id3'


Any help or suggestion greatly appreciated.

All the Best
Dave

-- 
https://mail.python.org/mailman/listinfo/python-list