no inputstream?
max
maxwell.newlands at gmail.com
Thu May 15 16:00:34 EDT 2008
you're right, my java implementation does indeed parse for Id3v2
(sorry for the confusion). i'm using the getrawid3v2() method of this
bitstream class (http://www.javazoom.net/javalayer/docs/docs0.4/
javazoom/jl/decoder/Bitstream.html) to return an inputstream that then
i buffer and parse. apologies if i misrepresented my code!
back to python, i wonder if i'm misusing the mutagen id3 module. this
brief tutorial (http://www.sacredchao.net/quodlibet/wiki/Development/
Mutagen/Tutorial) leads me to believe that something like this might
work:
from mutagen.mp3 import MP3
id3tags = MP3(urllib2.urlopen(URL))
but this gives me the following TypeError: "coercing to Unicode: need
string or buffer, instance found". does this mean i need to convert
the "file-like object" that is returned by urlopen() into a unicode
object? if so, do i just decode() with 'utf-8', or is this more
complex? as of now, doing so gives me mostly "No such file or
directory" errors, with a few HTTP 404s.
anyway, thanks again....
On May 15, 1:02 pm, Hrvoje Niksic <hnik... at xemacs.org> wrote:
> "John Krukoff" <jkruk... at ltgc.com> writes:
> > I'd love to know how Java handles all that automatically through a
> > generic stream interface, though.
>
> It could be that their stream interface supports seek(), and that
> seek()ing on HTTP connection sends the appropriate range request and,
> if it fails, throws an appropriate exception which the client code
> interprets as "seeking impossible, read the whole file".
>
> But that doesn't apply to the InputStream interface described athttp://java.sun.com/j2se/1.5.0/docs/api/java/io/InputStream.html-- no
> seeking there.
More information about the Python-list
mailing list