no inputstream?

Discussion in 'Python' started by max, May 15, 2008.

  1. max

    max Guest

    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
    max, May 15, 2008
    #1
    1. Advertising

  2. On Thu, 15 May 2008 06:08:35 -0700, max wrote:

    > 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
    Marc 'BlackJack' Rintsch, May 15, 2008
    #2
    1. Advertising

  3. max

    castironpi Guest

    On May 15, 8:37 am, Marc 'BlackJack' Rintsch <> wrote:
    > On Thu, 15 May 2008 06:08:35 -0700, max wrote:
    > > 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


    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.
    castironpi, May 15, 2008
    #3
  4. max

    max Guest

    On May 15, 9:51 am, castironpi <> wrote:
    > On May 15, 8:37 am, Marc 'BlackJack' Rintsch <> wrote:
    >
    > > On Thu, 15 May 2008 06:08:35 -0700, max wrote:
    > > > 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

    >
    > 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?
    max, May 15, 2008
    #4
  5. max

    castironpi Guest

    On May 15, 9:02 am, max <> wrote:
    > On May 15, 9:51 am, castironpi <> wrote:
    >
    >
    >
    >
    >
    > > On May 15, 8:37 am, Marc 'BlackJack' Rintsch <> wrote:

    >
    > > > On Thu, 15 May 2008 06:08:35 -0700, max wrote:
    > > > > 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

    >
    > > 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?- Hide quoted text -
    >
    > - Show quoted text -


    I can post life1 to this: lifeOne, lifeone, lifea perhaps.
    castironpi, May 15, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,017
    John Saunders
    Oct 16, 2003
  2. steven shingler

    Email attachment from InputStream?

    steven shingler, Jan 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    382
    Shiv Kumar
    Jan 20, 2004
  3. karahan celikel

    changing Request.InputStream

    karahan celikel, Mar 2, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    4,524
    Karahan Celikel
    Mar 4, 2004
  4. Steve Drake

    ASP.NET InputStream is not a stream

    Steve Drake, Oct 13, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    7,120
    Gabe Garza
    Oct 18, 2004
  5. R
    Replies:
    5
    Views:
    2,116
    Kevin McMurtrie
    Mar 13, 2005
Loading...

Share This Page