computer, travel, movies, music, cuisine and more
Posts tagged macosx
Webradios on OSX: guide to easy listening
Apr 17th
I’m a huge fan of some radios which I’ve been listening to in my life. For example, while driving in Italy I usually listen to virginradio, while being in Sydney I used to listen to tripleM, both of which usually air good rock music without too much DJs and ads.
YES! I want to listen to music, not ads or people speaking!
Thankfully most radio stations nowadays also spot an internet streaming. Nightmarefully usually it’s a flash or WMP (Windows Media Player) streaming. Being a MacOSX user (mostly) or a Linux user (always – mostly: so basically the time I’m not on MacOSX) I found both formats bad. The first because it works once and not the other time, the second because while more or less working with Quicktime (+ some weird nasty plugin [flip4Mac])
ATTEMPTED SOLUTION
What I usually do is easy – with example:
- Go to the webpage of the radio – http://www.triplem.com.au/sydney
- Find the ‘listen online’ button
- Open up the source code for the page that the ‘listen online’ opens up (usually they use pop-ups windows for such streamings) when there’s some kind of streaming going on
- Search for something like:
asx
Or alternatively if you don’t find any entry:
embed -
If in the step before you found the asx copy all the link, following our example:
... id="WMPlayer" name="WMPlayer" src="http://resources.triplem.com.au/listenfeed/2mmmlivestream.asx" type="video/quicktime" ...
let’s copy:
http://resources.triplem.com.au/listenfeed/2mmmlivestream.asxIf instead in the step before we found the embed keyword let’s look around it to find something like:
... <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="http://151.1.245.1/20" name="nnrVideoPlayer" autostart="1" width="400" height="70" showcontrols="1"> </EMBED> ...
around the code there should be the src tag, such as in the example. Let’s therefore copy:
http://151.1.245.1/20 - Open your favorite video/audio player, not iTunes, such as VLC and search for something called like ‘Open Network’. In our example, using VLC it’s: File->Open Network… or even faster the shortcut ⌘N and paste what you just copied:
- Press OK and after some buffering time you should be listening to your favorite radio! And without any ads or needing to keep your browser or anything!
This is clearly and hack solution which may work for you or not. If you have problems with your radio streaming and the above solution don’t hesitate to contact me and I’ll look into it (whenever I’ll find some time).
Hope it helped!
ciop ciop
TIME protocol on MacOSX
Apr 15th
Recently in the Advanced Operating System course, at ETH (Systems) I’ve struggled upon the TIME protocol (not NTP). The problem was simple: get a TIME protocol server that could respond to the SLUG2 (friendly called by me and my project partner SLUT) when ‘she’ was needing a reply (for some randomness, apparently).
Since MacOSX doesn’t provide any such thing, I settled on the task and here’s the result:
Server side:
#!/usr/bin/env python
import time
from socket import *
def server(host="", port=37):
sock = socket (AF_INET, SOCK_DGRAM)
sock.bind ((host, port))
print "listening on port %s (%s)" % (port, `host`)
while 1:
# Block waiting for packet.
data, address = sock.recvfrom(256)
print "Client sent:", data
print "Client at:", address
# Got a packet, reply to address packet came from.
sock.sendto(time.time(),address)
if __name__ == "__main__":
server("", 37)
Client side (just to test that the server is actually working)
#!/usr/bin/env python
import socket
port=37
clisocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while 1:
data = raw_input("Type something: ")
if data:
clisocket.sendto(data, ("127.0.0.1", port))
# Block waiting for reply.
data, address = clisocket.recvfrom(256)
print "Server sent time:", data
else:
break
clisocket.close()
This code (and any other that might be present on this blog) should be taken with a good grain of salt. It seems to do what it’s supposed to do. So if you’re in an emergency, trying to find a TIME protocol server to make it answer your client needs, here it is. Fiddle with it as much as you want. And don’t hesitate to comment with good and bad news about it.
The code and the issue have been tested on MacOSX 10.5.6
ciop ciop

