Re: [Tutor] MP3Info class usage
Your advice is spot on and I'm well on my way... your Windows installation advice should be in the readme, if anyone's listening :-) Thanks again, Gareth -- View this message in context: http://www.nabble.com/MP3Info-class-usage-tp20934673p21143262.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Terry Carroll wrote: On Fri, 19 Dec 2008, Terry Carroll wrote: It would be nice if Eyed3, which is not OS-specific, did not have such an OS-specific install process. Perhaps. But someone who cares about windows support would have to submit patches. I don't know if Travis uses windows or not. I have submitted a number of patches to eyeD3, but I don't use windows at all myself. I can't see spending any time to support a proprietary OS. :) And, to be fair, the install process isn't really OS-specific. It works on a large number of operating systems -- just not on Windows. You know, I just reinstalled Eyed3, and compared the installed result to the six files distributed in the zipped tarfile, and they're identical except that one file is named __init__.py.in instead of __init__.py, and has two doc variables defined with templates. If you want to avoid having to install a Unix-like environment, I suggest you just 1) unzip and untar the zipped tarfile, 2) copy the eyeD3 directory from eyeD3-0.6.16/src/ to Python's Lib/site-packages/ directory 3) rename __init__.py.in to __init__.py 4) (probably cosmetic) in __init__.py, edit the lines: eyeD3Version = @PACKAGE_VERSION@; eyeD3Maintainer = @PACKAGE_BUGREPORT@; to: eyeD3Version = 0.6.16; eyeD3Maintainer = Travis Shirk tra...@pobox.com; Someone else will now explain why this is a terrible idea. I don't think it is a bad idea at all. I was going to suggest something similar. If you do that, you should be able to copy the src/eyeD3 directory somewhere in your PYTHONPATH and use it just fine. -- ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~ I like this 'God'; he's so deliciously evil. -- Stewie Griffin pgpzJ8ONmIkTV.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
On Thu, 18 Dec 2008, Gareth at Serif wrote: I've not installed it, I've just imported it in my main program. How do you install eyeD3, there's no installation package? I read the readme, which talks about executing 'configure', but that just reports back that it is not recognized as an internal or external command, operable program or batch file. I'm betting that you'e on windows, like me. configure is s shell script. You'll need a version os shell that runs on windows. make, too, I'll bet. I run Cygwin on windows, which is a pretty good thing to have apart from this. It's free and avaliable from http://www.cygwin.com/ By default, I believe make is not installed; you'll have to request it. You'll still get the error that configure is not recognized as a valid command, but invoking it with sh congigure works for me. It would be nice if Eyed3, which is not OS-specific, did not have such an OS-specific install process. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
On Fri, 19 Dec 2008, Terry Carroll wrote: configure is s shell script. You'll need a version os shell that runs on windows. make, too, I'll bet. I run Cygwin on windows, which is a pretty good thing to have apart from this. It's free and avaliable from http://www.cygwin.com/ ... It would be nice if Eyed3, which is not OS-specific, did not have such an OS-specific install process. You know, I just reinstalled Eyed3, and compared the installed result to the six files distributed in the zipped tarfile, and they're identical except that one file is named __init__.py.in instead of __init__.py, and has two doc variables defined with templates. If you want to avoid having to install a Unix-like environment, I suggest you just 1) unzip and untar the zipped tarfile, 2) copy the eyeD3 directory from eyeD3-0.6.16/src/ to Python's Lib/site-packages/ directory 3) rename __init__.py.in to __init__.py 4) (probably cosmetic) in __init__.py, edit the lines: eyeD3Version = @PACKAGE_VERSION@; eyeD3Maintainer = @PACKAGE_BUGREPORT@; to: eyeD3Version = 0.6.16; eyeD3Maintainer = Travis Shirk tra...@pobox.com; Someone else will now explain why this is a terrible idea. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Todd Zullinger wrote: That's hard to guess at. If you can explain what you have done and how you've installed eyeD3, that would help. I've not installed it, I've just imported it in my main program. How do you install eyeD3, there's no installation package? I read the readme, which talks about executing 'configure', but that just reports back that it is not recognized as an internal or external command, operable program or batch file. Clearly I'm missing a huge step, can you help me out? -- View this message in context: http://www.nabble.com/MP3Info-class-usage-tp20934673p21071143.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Gareth at Serif wrote: I've not installed it, I've just imported it in my main program. How do you install eyeD3, there's no installation package? What OS are you running? I can help if you run some sort of *nix system. If you're on Windows, then I'll have to pass as I know nothing about installing python modules on Windows. :) I read the readme, which talks about executing 'configure', but that just reports back that it is not recognized as an internal or external command, operable program or batch file. Hmm, ... batch file makes me think this is Windows. On *nix systems, you run ./configure; make; sudo make install. The ./ in front of configure tells the shell that the program you are trying to run is in the current directory. Otherwise, the shell would look for configure in your $PATH, which does not include the current directory. -- ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~ Mollison's Bureaucracy Hypothesis: If an idea can survive a bureaucratic review and be implemented it wasn't worth doing. pgp8LSNYi8sv7.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Okay, I've moved over to eyeD3.py... fif nothing else, the documentation for it's usage is far superior. However, I can't get anything to run. The help gives examples of some simple tasks, but as soon as I 'import eyeD3', not even calling any functions within it, I start getting errors such as: In eyeD3.py, the 'from eyeD3.tag import *;' line (and similar) didn't work until I removed the 'eyeD3.' part and just imported 'tag'. Then in tag.py, some of the class defs complained about undefined variables, for example 'def link(self, f, v = ID3_ANY_VERSION)' needed to have quotes around 'ID3_ANY_VERSION'. Now these issues are addressed I have an error in mp3.py, 'class EyeD3Driver(eyeD3.utils.FileHandler) NameError: name 'eyeD3' is not defined. I'm baffled that I'm having to jump through so many hoops because I imported eyeD3... is this typical? What have I done wrong? Cheers, Gareth Todd Zullinger wrote: I'd recommend eyeD3¹ and/or mutagen² for tag reading. Both are pretty easy to use. ¹ http://eyed3.nicfit.net/ ² http://code.google.com/p/quodlibet/wiki/Development/Mutagen -- View this message in context: http://www.nabble.com/MP3Info-class-usage-tp20934673p20980334.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Gareth at Serif wrote: Okay, I've moved over to eyeD3.py... fif nothing else, the documentation for it's usage is far superior. However, I can't get anything to run. The help gives examples of some simple tasks, but as soon as I 'import eyeD3', not even calling any functions within it, I start getting errors such as: In eyeD3.py, the 'from eyeD3.tag import *;' line (and similar) didn't work until I removed the 'eyeD3.' part and just imported 'tag'. How have you installed eyeD3? Perhaps there's something wrong with the installation. Certainly, 'import eyeD3' should not create any errors. Then in tag.py, some of the class defs complained about undefined variables, for example 'def link(self, f, v = ID3_ANY_VERSION)' needed to have quotes around 'ID3_ANY_VERSION'. That's not what you want to do. ID3_ANY_VERSION is defined in eyeD3/__init__.py. If you quote it, you're breaking it. I'm baffled that I'm having to jump through so many hoops because I imported eyeD3... is this typical? What have I done wrong? That's hard to guess at. If you can explain what you have done and how you've installed eyeD3, that would help. -- ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~ Don't look for me in daylight where robots all assemble. You'll find me in my dark world, in my smoke-filled temple. pgpcUXQkD7v1L.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] MP3Info class usage
Has anyone ever used MP3Info to retrieve the ID3 tags from an MP3? It seems to be a well written class that can access ID3 tags in v.1 or v.2, but I've not used classes before and I'm struggling to figure out how to use it. Given that, for testing purposses, I have a property called 'testfile' set to the path of a valid MP3 file, I then try to output the artist name with the following, where ID3v2 is a class defined in MP3Info: song = ID3v2(testfile) print '\nArtist is: %s' % (song.artist) When I execute this script I get an error, AttributeError: 'str' object has no attribute 'seek'. Is this a bug in the class or am I not using it correctly? Has anyone any better suggestions for retreiving ID3 tags from an MP3 file using python? Regards, Gareth -- View this message in context: http://www.nabble.com/MP3Info-class-usage-tp20934673p20934673.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
Gareth at Serif wrote: Has anyone any better suggestions for retreiving ID3 tags from an MP3 file using python? I'd recommend eyeD3¹ and/or mutagen² for tag reading. Both are pretty easy to use. ¹ http://eyed3.nicfit.net/ ² http://code.google.com/p/quodlibet/wiki/Development/Mutagen -- ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~ A paranoid is someone who knows a little of what's going on. -- William S. Burroughs pgpqn2qXFwKw3.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
On 12/10/08, Todd Zullinger [EMAIL PROTECTED] wrote: I'd recommend eyeD3¹ and/or mutagen² for tag reading. Both are pretty easy to use. I would second eyeD3 -- I use the command line version and it is pretty versatile. D ¹ http://eyed3.nicfit.net/ ² http://code.google.com/p/quodlibet/wiki/Development/Mutagen -- ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~ A paranoid is someone who knows a little of what's going on. -- William S. Burroughs ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
On Wed, Dec 10, 2008 at 7:48 AM, Gareth at Serif [EMAIL PROTECTED] wrote: Given that, for testing purposses, I have a property called 'testfile' set to the path of a valid MP3 file, I then try to output the artist name with the following, where ID3v2 is a class defined in MP3Info: song = ID3v2(testfile) print '\nArtist is: %s' % (song.artist) When I execute this script I get an error, AttributeError: 'str' object has no attribute 'seek'. The ID3v2 constructor wants a file object as a parameter, not a string. It is trying to call testfile.seek() which causes the error you see. Try ID3v2(open(testfile)) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] MP3Info class usage
On Wed, 10 Dec 2008 04:48:38 -0800, Gareth at Serif wrote: Has anyone ever used MP3Info to retrieve the ID3 tags from an MP3? It seems to be a well written class that can access ID3 tags in v.1 or v.2, but I've not used classes before and I'm struggling to figure out how to use it. Given that, for testing purposses, I have a property called 'testfile' set to the path of a valid MP3 file, I then try to output the artist name with the following, where ID3v2 is a class defined in MP3Info: song = ID3v2(testfile) print '\nArtist is: %s' % (song.artist) When I execute this script I get an error, AttributeError: 'str' object has no attribute 'seek'. Is this a bug in the class or am I not using it correctly? Has anyone any better suggestions for retreiving ID3 tags from an MP3 file using python? Regards, Gareth You need to know about file interface. The testfile you gave is neither a file object nor a file-like object but a string while the function ID3v2 expects a file or file-like object. In short, ID3v2 tries to call testfile.seek() which doesn't exists. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor