no inputstream?

M

max

hey folks,

coming from java, new to python. i'm trying to port a java app to
python that writes an inputstream to a buffer, then parses the buffer
(specifically, i'm getting ID3 tags from mp3s online). i understand
that this java approach to the task may not apply to python, but i'm
having trouble finding a working approach in python.

i currently have locations of the mp3s in question as strings, which
works for parsing local files, but gives me a "No such file or
directory" error when it tries to process URLs. it seems terribly
inefficient to download each mp3 just to get at that small tag data,
and i assume there's a way to do this with file() or open() or
something, i just can't get it to work.

anyone know how i can fix this? thanks in advance for any help!

best,
max
 
M

Marc 'BlackJack' Rintsch

i currently have locations of the mp3s in question as strings, which
works for parsing local files, but gives me a "No such file or
directory" error when it tries to process URLs. it seems terribly
inefficient to download each mp3 just to get at that small tag data,
and i assume there's a way to do this with file() or open() or
something, i just can't get it to work.

You can use `urllib2.urlopen()` to open URLs as files. But if you deal
with ID3 V1 tags you'll have to download the file anyway because those are
in the last 128 bytes of an MP3 file.

Ciao,
Marc 'BlackJack' Rintsch
 
C

castironpi

You can use `urllib2.urlopen()` to open URLs as files.  But if you deal
with ID3 V1 tags you'll have to download the file anyway because those are
in the last 128 bytes of an MP3 file.

Ciao,
        Marc 'BlackJack' Rintsch

Just don't import time. What would you do with an autolocking timer,
such as time.sleep( ) on a thread? I am tongue tied in the presence
of a lady.
 
M

max

Just don't import time.  What would you do with an autolocking timer,
such as time.sleep( ) on a thread?  I am tongue tied in the presence
of a lady.

thanks guys. i guess i just figured there'd be a way to get at those
id3 bytes at the end without downloading the whole file. if java can
do this, seems like i should just stick with that implementation, no?
 
C

castironpi

thanks guys.  i guess i just figured there'd be a way to get at those
id3 bytes at the end without downloading the whole file.  if java can
do this, seems like i should just stick with that implementation, no?- Hide quoted text -

- Show quoted text -

I can post life1 to this: lifeOne, lifeone, lifea perhaps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top