I am not sure if this is the right forum, but since I am using
wxPython, I'll start here. Apologies in advance if I'm posting in the
wrong area.
I've been using the Mutagen library (http://code.google.com/p/
mutagen/) to interrogate and fix irregularties in my music library.
The one thing I would like to do, though is display imbedded album
artwork. I know there are any number of tools that will display
artwork, but there's nothing like rolling your own. Through Mutagen,
I have found the metadata bytestream that has the artwork information,
but I have no idea what to do with it now that I have it. Is there a
way of populating a wxImage or wxBitMap with information from a data
stream?
I am not sure if this is the right forum, but since I am using
wxPython, I'll start here. Apologies in advance if I'm posting in the
wrong area.
I've been using the Mutagen library (Google Code Archive - Long-term storage for Google Code Project Hosting.
mutagen/) to interrogate and fix irregularties in my music library.
The one thing I would like to do, though is display imbedded album
artwork. I know there are any number of tools that will display
artwork, but there's nothing like rolling your own. Through Mutagen,
I have found the metadata bytestream that has the artwork information,
but I have no idea what to do with it now that I have it. Is there a
way of populating a wxImage or wxBitMap with information from a data
stream?
Thanks!
Funny you should ask as I have already done this is my soon-to-be-
released wxPython-based mp3 player, although I used eye3D rather than
mutagen because I liked its interface better. Anyway, just use a
variable to hold the album's cover data that is returned from mutagen.
I don't know the syntax for the lib, but here's an psuedo-example:
cover = mutagen.GetCover(someMp3)
Here's how you do the wx stuff:
# note that you need to import cStringIO
img = wx.ImageFromStream(cStringIO.StringIO(cover))
self.albumCoverCtrl = wx.StaticBitmap(self, wx.ID_ANY,
wx.BitmapFromImage(img))
Usually, I start out with a blank album cover since I don't always
know if my mp3 will have cover art data. I use
"wx.EmptyImage(100,100)" to do that, but hope to replace that with
some kind of "image not found" bitmap.
I hope that answers your questions.
···
On Jun 29, 3:42 pm, edoxtator <e.doxta...@gmail.com> wrote:
Thanks very much-- I will have a look at the eye3D toolkit and have a look at your suggestion. I thought there was some sort of CString magic, but I had no idea where to go with it.
-Doc
···
On Wed, Jun 30, 2010 at 9:00 AM, Mike Driscoll kyosohma@gmail.com wrote:
mutagen/) to interrogate and fix irregularties in my music library.
The one thing I would like to do, though is display imbedded album
artwork. I know there are any number of tools that will display
artwork, but there’s nothing like rolling your own. Through Mutagen,
I have found the metadata bytestream that has the artwork information,
but I have no idea what to do with it now that I have it. Is there a
way of populating a wxImage or wxBitMap with information from a data
stream?
Thanks!
Funny you should ask as I have already done this is my soon-to-be-
released wxPython-based mp3 player, although I used eye3D rather than
mutagen because I liked its interface better. Anyway, just use a
variable to hold the album’s cover data that is returned from mutagen.
I don’t know the syntax for the lib, but here’s an psuedo-example:
Usually, I start out with a blank album cover since I don’t always
know if my mp3 will have cover art data. I use
“wx.EmptyImage(100,100)” to do that, but hope to replace that with
This topic is probably a bit stale, but I thought I’d finally get back to it and implement your suggestion. I played around a bit, and came up with the following. It’s not genius, nor is it fault-tolerant, but it delivers what I need. Thanks again, everyone for your help.
Show first embedded image in FLAC metadata
argv[1]=path to filename
Program is not fault-tolerant, make sure you’re passing in a valid FLAC file name
Must have wx and mutagen libraries installed
import wx
import mutagen.flac as FLAC
import cStringIO
import sys
class ShowImage(wx.Frame):
def init(self, file):
myFrame = wx.Frame.init(self, None)
Thanks very much-- I will have a look at the eye3D toolkit and have a look at your suggestion. I thought there was some sort of CString magic, but I had no idea where to go with it.
-Doc
On Wed, Jun 30, 2010 at 9:00 AM, Mike Driscoll kyosohma@gmail.com wrote:
mutagen/) to interrogate and fix irregularties in my music library.
The one thing I would like to do, though is display imbedded album
artwork. I know there are any number of tools that will display
artwork, but there’s nothing like rolling your own. Through Mutagen,
I have found the metadata bytestream that has the artwork information,
but I have no idea what to do with it now that I have it. Is there a
way of populating a wxImage or wxBitMap with information from a data
stream?
Thanks!
Funny you should ask as I have already done this is my soon-to-be-
released wxPython-based mp3 player, although I used eye3D rather than
mutagen because I liked its interface better. Anyway, just use a
variable to hold the album’s cover data that is returned from mutagen.
I don’t know the syntax for the lib, but here’s an psuedo-example:
Usually, I start out with a blank album cover since I don’t always
know if my mp3 will have cover art data. I use
“wx.EmptyImage(100,100)” to do that, but hope to replace that with
Mutagen is a much more complete, documented and useful package than
EyeD3 in which development has been abandoned and practical examples
are terribly incomplete. Using Mutagen is a breeze compared to using
EyeD3.
I hope you know that the state of music file tag definition is in a
state of mass confusion. Mutagen helps to alleviate this problem by
having methods that convert old format tags into modern ones.
As for handling embedded images, since you have successfully extracted
the artwork image data and can interrogate Mutagen to find out the
data type (PNG, JPG, etc.) You could simply write out the data "as is"
to a memory-based "file-like" object using StringIO: http://effbot.org/librarybook/stringio.htm <-- to get you
started.
Then, you can simply read the "memory file" using standard file input
methods and perhaps later on write out an actual disk file.
One more idea: Check out the free MP3Tag program for MSW platforms.
It can read and write tags and artwork images in a very consistent and
transparent manner to the most popular audio file formats including
FLAC, MP3 and OGG. Unfortunately, this very powerful powerful utility
doesn't have a command line interface, so it can't be automated.
For instance, I sometimes want to convert FLAC files into high bit
rate MP3s and simply copy over all the tags from the FLAC original.
This is not difficult using MP3Tag, but I really would like this
operation to be a "one-click process". For instance, a wxPython
program could use Mutagen to transfer all the tag info including
embedded images into the MP3 files. So far, I have been unsuccessful
finding a command line utility to convert the newest format of FLAC
encoded files has to WAV file format.
Ray
···
On Sep 22, 1:17 pm, edoc <e.doxta...@gmail.com> wrote:
All
This topic is probably a bit stale, but I thought I'd finally get back to it
and implement your suggestion. I played around a bit, and came up with the
following. It's not genius, nor is it fault-tolerant, but it delivers what
I need. Thanks again, everyone for your help. ...
This topic is probably a bit stale, but I thought I’d finally get back to it
and implement your suggestion. I played around a bit, and came up with the
following. It’s not genius, nor is it fault-tolerant, but it delivers what
I need. Thanks again, everyone for your help. …
Mutagen is a much more complete, documented and useful package than
EyeD3 in which development has been abandoned and practical examples
are terribly incomplete. Using Mutagen is a breeze compared to using
EyeD3.
I hope you know that the state of music file tag definition is in a
state of mass confusion. Mutagen helps to alleviate this problem by
having methods that convert old format tags into modern ones.
As for handling embedded images, since you have successfully extracted
the artwork image data and can interrogate Mutagen to find out the
data type (PNG, JPG, etc.) You could simply write out the data “as is”
Then, you can simply read the “memory file” using standard file input
methods and perhaps later on write out an actual disk file.
One more idea: Check out the free MP3Tag program for MSW platforms.
It can read and write tags and artwork images in a very consistent and
transparent manner to the most popular audio file formats including
FLAC, MP3 and OGG. Unfortunately, this very powerful powerful utility
doesn’t have a command line interface, so it can’t be automated.
For instance, I sometimes want to convert FLAC files into high bit
rate MP3s and simply copy over all the tags from the FLAC original.
This is not difficult using MP3Tag, but I really would like this
operation to be a “one-click process”. For instance, a wxPython
program could use Mutagen to transfer all the tag info including
embedded images into the MP3 files. So far, I have been unsuccessful
finding a command line utility to convert the newest format of FLAC
encoded files has to WAV file format.