473,466 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

no inputstream?

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

Jun 27 '08 #1
4 1740
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
Jun 27 '08 #2
On May 15, 8:37*am, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
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.
Jun 27 '08 #3
max
On May 15, 9:51*am, castironpi <castiro...@gmail.comwrote:
On May 15, 8:37*am, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
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?
Jun 27 '08 #4
On May 15, 9:02*am, max <maxwell.newla...@gmail.comwrote:
On May 15, 9:51*am, castironpi <castiro...@gmail.comwrote:


On May 15, 8:37*am, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
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 thoseare
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.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Seong Jin, Cho | last post by:
Hi. Is there a way to get an unbuffered InputStream from Process? I found out that java.lang.Win32Process and java.lang.UNIXProcess both wraps the stdout with java.io.BufferedInputStream, but...
1
by: Charles.Deisler | last post by:
XmlTextReader requestdata = new XmlTextReader(Request.InputStream); XmlTextWriter xmltextwriter = new XmlTextWriter(somefile,someencoding); XmlTextWriter xmltextwriter2 = new...
7
by: Steve Drake | last post by:
All, I have a HttpHandler that handles a PUT, if i PUT 700MEGs of data it runs out of memory, i have found that this is due to the Request.InputStream loading the entire stream when you access...
0
by: Keith Harris | last post by:
Hi, I have an HtmlInputFile control which allows a user to upload a CSV file. I want to display the first few rows for preview and later, load the rows to a database. Displaying the preview...
0
by: bvasanth123 | last post by:
Hi, I would like to know how can I read an InputStream into Excel object. In my web app, user uploads MS-Excel file though asp.net html file control. I get UploadedFile.PostedFile.InputStream()...
0
by: bvasanth123 | last post by:
Hi, I would like to know how can I read an InputStream into Excel object. In my web app, user uploads MS-Excel file though asp.net html file control. I get UploadedFile.PostedFile.InputStream()...
1
by: samtilden | last post by:
I want to print out some tracing messages from Global.asax.cs/Application_BeginRequest(). I easily got: System.Web.HttpContext.Current.Request.RawUrl, and...
1
by: O.B. | last post by:
I have the need to read a file (version.txt) that is embedded within an WAR file that is within an EAR file: foo.ear contains bar.war contains resources/version.txt I am able to get the bar.ear...
0
by: raheel javed | last post by:
i am using mobile for communication with live server when mobile send its information to server the input stream is encoded in utf-8 that is converted into string but it is still not...
11
by: John Krukoff | last post by:
-----Original Message----- First off, ignore castironpi, it's a turing test failure. Second, I'm curious as to how Java manages this. I'd think their streams would have to be pretty magic to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.