I playing around with streaming shoutcast mp3s.
Here is some sample code:
-----------------------
import httplib
############
# Put together the headers
headers = {"Icy-MetaData":"1"}
con = httplib.HTTPCon nection('64.142 .8.154', 8000)
con.request("GE T", "/")
stream = con.getresponse ()
print stream.status,s tream.reason
print stream.read()
-----------------------
For which i get error:
bash-2.05b$ ./woxy_saver.py
200
Traceback (most recent call last):
File "./woxy_saver.py", line 21, in ?
print stream.read()
File "C:\python24\li b\httplib.py", line 463, in read
s = self._safe_read (self.length)
File "C:\python24\li b\httplib.py", line 545, in _safe_read
chunk = self.fp.read(am t)
File "C:\python24\li b\httplib.py", line 1273, in read
return s + self._file.read (amt - len(s))
TypeError: unsupported operand type(s) for -: 'str' and 'int'
bash-2.05b$
It seems somehow amt is turning into a str.
Is this a bug in httplib.py or there something wrong with my code?
Cheers
- Haz 1 2051
I should purhaps mention that i am basically trying to translate this.
nc ~= telnet
#!/bin/sh
nc sc1.liquidviewe r.com 9012 <<EOF
GET / HTTP/1.0
Icy-MetaData:1
EOF This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
Hi all,
I have an (well, what I think to be, at least) interesting question:
Is it possible to stream data down to the client and, after a certain amount
of data has been streamed, allow the client to begin interacting with that
data whilst still streaming data down?
Also, if it is possible, how would one go about coding this? Would some sort
of predfined bit of streaming be finished and notify the client (i.e. some
form of Javascript...
|
by: |
last post by:
Hi all, is there a better way to stream binary data stored in a table in sql
2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We
noticed that in certain heavy load scenarios, every now and then the client
would timeout and have to re-initiate the request...
TIA!
|
by: Vijay |
last post by:
Hi Folks,
I having one issue, in my application I am going to use the server push
for streaming the data by keeping the connection open. At client side,
i am having the XMhttprequest object (i.e ActiveX object of IE). When
the data comes, onreadystatechange method get callback on state 3 but
it doesn't allow me to read the data from the object. It says 'The data
necessary to complete this operation is not yet available'. Is it...
|
by: thesti |
last post by:
hello,
i'm trying to import data from an excel file to a SQL Server 2005 table using the Integration Services Project. i have Visual Studio 2005 installed
as i drag the data flow task and double clicking it, i get the following error
The task with the name "Data Flow Task" and the creation name "DTS.Pipeline.1" is not registered for use on this computer.
then i googled, i found a way that i should change the way Integration Services...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |