View Full Version : Radio Streaming screenlet (new version uses mplayer)
whise
August 5th, 2007, 06:04 PM
A screenlet that plays online radio
by Helder Fraga aka Whise
http://hendrik.kaju.pri.ee/screenlets/files/img/2323232.resized.png
Instalation
Put it in your /usr/local/share/screenlets and run it from there + you need Mplayer and codecs installed
It already comes with about 10 radios predefined you can add more radios editing the menu.xml file using nullsoft shoutcast links
New version uses mplayer instead of gstreamer (plays more stream formats), you need mplayer and codecs installed
Download link:
http://www.mediafire.com/?fgd2crj2n4g
order version 0.1
(older version uses mplayer here - http://www.mediafire.com/?7mmtxmqznxj)
(older version uses gstreamer here - http://www.mediafire.com/?0jcq3fdbs21)
new version , new gui with play stop buttons , now it plays ram files (finally bbc radio and ministy of sound)
and fixed a bug where it hang when internet connection failled
RYX
August 5th, 2007, 06:59 PM
You slightly amaze me with your development speed :D ... Good work!
KDE users would just have to install gstreamer, so it is not impossible for them to use it (even though some people may not like to install it).
btw: I'd love to have an one online radio for electronic music (don't know a good one, maybe someone else has a good suggestion) ... :)
watkin5
August 5th, 2007, 08:37 PM
http://www.bbc.co.uk/radio/aod/radio4.shtml?fm]Radio (http://www.bbc.co.uk/radio/aod/mainframe.shtml? please
and for music http://www.bbc.co.uk/radio/aod/radio2.shtml]Radio (http://www.bbc.co.uk/radio/aod/mainframe.shtml?[url) 2
delfick
August 6th, 2007, 01:39 AM
http://www.nova937.com.au/dmgcustom/Nova937.asx
:D
whise
August 6th, 2007, 02:34 AM
well its done , im sorry but i only manage to make it play mms: streams and nullsoft streams
no asx :(
delfick
August 6th, 2007, 08:28 AM
well its done , im sorry but i only manage to make it play mms: streams and nullsoft streams
no asx :(
damn.....
not that it really matters, my speakers are always connected to my radio which is tuned into that station :D
mikedee
August 6th, 2007, 11:06 AM
Are you able to play ram streams with this?
If so the BBC Radio station direct links are like this (I can never get the embedded player to work)
http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram
This is for radio 1, the others are probably similar.
plun
August 6th, 2007, 11:24 AM
well its done , im sorry but i only manage to make it play mms: streams and nullsoft streams
no asx :(
whise, thanks for your work with screenlets, Great ! :D
This is maybe a sensitive question but we live in a world with commercial codecs. :roll:
Maybe its better to use mplayer as "backend" ?
I have this script for popular swedish stations and its "dirty codecs" everywhere..
#!/bin/bash
echo ""
echo""
echo " 1 -> NRJ"
echo " 2 -> Studio 107.5"
echo " 3 -> 107.1 Vinyl"
echo " 4 -> The Voice"
echo " 5 -> Mix MegaPol"
echo " 6 -> Rix FM"
echo " 7 -> P1"
echo " 8 -> P2 Musik"
echo " 9 -> P3"
echo " 10 -> Lugna favoriter"
echo " 11 -> Bandit"
echo ""
echo "Välj en station"
read radio
if [ "$radio" = "1" ]; then
mplayer http://83.241.238.21/nrj/?MSWMExt=.asf
elif [ "$radio" = "2" ]; then
mplayer mms://live.alleredge.com/AE_StudioSE_Mid
elif [ "$radio" = "3" ]; then
mplayer mms://live.alleredge.com/AE_Vinyl_Mid
elif [ "$radio" = "4" ]; then
mplayer mms://live.alleredge.com/AE_TheVoiceSE_Mid
elif [ "$radio" = "5" ]; then
mplayer mms://live.alleredge.com/AE_MixMegapol_Mid
elif [ "$radio" = "6" ]; then
mplayer http://83.241.238.21/rixfm/?MSWMExt=.asf
elif [ "$radio" = "7" ]; then
mplayer rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p1.rm
elif [ "$radio" = "8" ]; then
mplayer rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p2musik.rm
elif [ "$radio" = "9" ]; then
mplayer rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm
elif [ "$radio" = "10" ]; then
mplayer http://83.241.239.21/lugna/?MSWMExt=.asf
elif [ "$radio" = "11" ]; then
mplayer http://83.241.239.21/bandit/?MSWMExt=.asf
MSWMExt=.asf
exit
fi
Mplayer plays all junk.... 8)
Thanks !
whise
August 6th, 2007, 03:30 PM
hi there , i thought about using mplayer because its my favorite player , but the thing is i canot play ram streams on my pc with mplayer so i cant test it
RYX
August 6th, 2007, 03:58 PM
From what I know mplayer has a commandline version (I think the original mplayer is a commandline app and the gui is an extension). So it should be possible to realize it using the commandline mplayer. Maybe there is an option to lauch it without gui?
mikedee
August 6th, 2007, 04:52 PM
I am able to play the ram streams from the commandline mplayer with this command
mplayer -playlist http://....ram
I suppose if the screenlet worked with the mplayer backend then it should be able to play most filetypes.
plun
August 6th, 2007, 04:56 PM
From what I know mplayer has a commandline version (I think the original mplayer is a commandline app and the gui is an extension). So it should be possible to realize it using the commandline mplayer. Maybe there is an option to lauch it without gui?
Well... :D I posted my mplayer script (without gui) , test it !...8)
No 7, 8 and 9 is ram files... no problem with mplayer
It must be rather simple for a dev to hide mplayer...
:D
RYX
August 6th, 2007, 06:30 PM
Looks like Ubuntu-users need to install the package "mplayer-nogui" to be able to use mplayer from the commandline. But the streams really work well.
EDIT: As it turns out, the "mplayer"-executable is the commandline app, the "gmplayer" is the graphical one. So no need to install anything but the "mplayer"-package on Ubuntu ...
mikedee
August 6th, 2007, 06:30 PM
I had a quick look around and the correct way is to start mplayer with the -slave option, and then feed commands into stdin.
The commands are documented here
http://www.mplayerhq.hu/DOCS/tech/slave.txt
whise
August 6th, 2007, 07:28 PM
nice find , :) gona take a look
whise
August 6th, 2007, 08:44 PM
ok i have a big question , how do i run it in non-blocking mode? because when i use os.system it blocks the screenlet i can access mplayer using the mplayer -slave but not the screenlet , anyone?
edit , looks like its more complicated then i thought ive been looking at an mplayer gui made in python and it uses child process and pipe catching to run player backend , im still not good enough in python to do this..:(
RYX
August 6th, 2007, 10:07 PM
Does it work if you add an "&" to the call like this:os.popen('mplayer -slave -quiet &')
whise
August 6th, 2007, 10:12 PM
yeah i can open it but how do i pause or stop it , im suposed to imput 'pause' in the same terminal that i run mplayer to pause it , or 'stop' to stop it , i dont know how to do it
can you give me an ideia on how? maybe starting a child process and killing it on stop or station change ,
RYX
August 6th, 2007, 10:24 PM
Ok, stupid idea. If you add an "&" you won't be able to send commands through stdin ...
You could use a thread for that. It shouldn't be really difficult. You use something like "p=os.popen(...)" to open the pipe to the process and then use "r=p.write('get_file_metadata')" to send commands to the pipe ... (I think, never done it myself)
:)
RYX
August 6th, 2007, 10:30 PM
I can't guarantee this works, hacked it together in textfield :)
import threading
import os, sys
class MPlayer (threading.Thread):
def __init__ (self, url):
threading.Thread.__init__(self)
self.url = url
self.pipe = None
def send_command (self, command):
if self.pipe:
return self.pipe.write(command + '\n') # \n to end the command
else:
return None
def close (self):
"""Close the pipe to the player."""
self.pipe.close()
def run (self):
self.pipe = os.popen('mplayer -slave -quiet ' + self.url, 'w')
if self.pipe:
self.send_command('start')
# after the start command the process will most likely block and we
# need to control mplayer from your gui now
player = MPlayer('http://83.241.238.21/rixfm/?MSWMExt=.asf')
player.start()
Better check the python docs about threading, I am not sure if this is entirely correct ...
EDIT: I updated it to a version that at least doesn't crash - the rest is up to you :D ...
:)
whise
August 7th, 2007, 12:59 AM
i managed to make it run but cant send commands .. im lost :(
whise
August 7th, 2007, 02:06 AM
ok i got it running... no pause , only start and stop , god enough i guess
i would like to add more stations to it know maybe someone can help
plun
August 7th, 2007, 09:23 AM
Whise/Helder... Thanks..! :D
Running my "dirty codecs " swedish stations :lol:
Some trouble with the label tag and what is shown on the screenlets.....
probably my fault.
mikedee
August 7th, 2007, 10:17 AM
Hi whise :)
I added this to the list at the bottom, but its not working :(
<imageitem label="BBC Radio 1" id="http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram BBC Radio 1" />
I added -playlist to the mplayer options (which does not seem to break the other stations), but its still not working.
Ill try to look into it further, the problem is that I think they block these streams from outside the UK, so unless you are here it will not work.
Your on_menuitem_select will need to check if its a http with a .ram at the end, the ram file contains only this, but I assume you need to make the initial request to get the session id etc.
rtsp://rmlive.bbc.co.uk/bbc-rbs/rmlive/ev7/live24/radio1/live/r1_dsat_g2.ra?BBC-UID=e4b69b57c56bbf3a195127466040e14d88b38e18b050c0 a30b2a813944c959b1_n&SSO2-UID=
If I get it working then Ill post all the urls that I know...
There are about 10 di.fm streams, maybe the station selection will need to have grouping and then you can have preset channel buttons on the screenlet
plun
August 7th, 2007, 10:46 AM
Confusing 8)
Nullsoft naming ??
I can get all my station to work except Virgin with a ogg and the rm file
<imageitem label="Smooth Jazz" id="http://scfire-ntc0l-1.stream.aol.com/stream/1005 Smooth Jazz" />
<imageitem label="ChroniX Aggression" id="http://scfire-chi0l-1.stream.aol.com/stream/1039 ChroniX Aggression" />
<imageitem label="Powerhitz" id="http://205.188.215.229:8006/ Powerhitz" />
<imageitem label="Mix Megapol" id="mms://live.alleredge.com/AE_MixMegapol_Mid" />
<imageitem label="Lugna Favoriter" id="http://83.241.239.21/lugna/?MSWMExt=.asf" />
<imageitem label="P3" id="rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm" />
<imageitem label="RixFM" id="http://83.241.238.21/rixfm/?MSWMExt=.asf" />
<imageitem label="Virgin" id="http://ogg.smgradio.com/vc160.ogg" />
I am using XML copy editor to change the XML file.
I have also tested with Streamtuner and Virgin is OK.
:?:
plun
August 7th, 2007, 11:00 AM
Now it works
<imageitem label="P3" id="rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm " />
<imageitem label="Virgin" id="http://ogg.smgradio.com/vc160.ogg " />
A space is needed after the stream URL... :D
EDIT
Then I lost my "Label".....something is strange with the <imageitem> syntax.
Is it possible to take the Clip info to the screenlet ?
Cache fill: 15.00% (49152 bytes)
[Ogg] stream 0: audio (Vorbis), -aid 0
Ogg file format detected.
Clip info:
Artist: Martha And The Muffins
Name: Echo Beach
EDIT
Checked my terminal ouput and its the Demuxer info which changes
Demuxer info Name changed to The original classic rock station
Demuxer info Artist changed to Virgin Radio Classic Rock
Demuxer info Name changed to The original classic rock station
Demuxer info Artist changed to Virgin Radio Classic Rock
Demuxer info Name changed to The original classic rock station
Demuxer info Artist changed to Def Leppard
Demuxer info Name changed to Animal
Demuxer info Artist changed to Aerosmith
Demuxer info Name changed to Sweet emotion
whise
August 7th, 2007, 01:00 PM
Now it works
<imageitem label="P3" id="rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm " />
<imageitem label="Virgin" id="http://ogg.smgradio.com/vc160.ogg " />
you should put the station name after that space so it shows up in the the screenlet
got to change that , my code is all messy and dirty , but now i dont have time to clean it
@mikedee , sorry but i cant test playing ram files on my pc , maybe a problem with mplayer installation gives me a dll error
btw i just though that i can use this to create a internet tv screenlet , but i dont know any tv links
plun
August 7th, 2007, 01:29 PM
got to change that , my code is all messy and dirty , but now i dont have time to clean it
Well, maybe the code is dirty but it works... :D
<imageitem label="Lugna Favoriter" id="http://83.241.239.21/lugna/?MSWMExt=.asf Lugna Favoriter" />
<imageitem label="P3" id="rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm P3" />
<imageitem label="Rix FM " id="http://83.241.238.21/rixfm/?MSWMExt=.asf Rix FM" />
<imageitem label="Virgin " id="http://ogg.smgradio.com/vc160.ogg Virgin Classic" />
<separator />
Virgin is probably a channel for a lot of users.
Thanks !
whise
August 7th, 2007, 01:40 PM
well i made it because i was browsing throuht all the widgets at yahoo widgets , and theres about 10 different ones , all the others 50000000000 are clones off each other , aside from a mail check that i think rIx is working on, all that they have more then us is web browser embedded and web streams (not any more), i found a mozilla embedded control for python , but it requires installaion , a found also a way to auto fill web forms from python but i lost the web page from where i got it , that can be very good for screenlets
RYX
August 7th, 2007, 02:27 PM
he he he :) ... That's exactly what I thought about yahoo widgets, too ... though you forgot all those incredibly useless event-countdowns :D ... (I bet you could cover five monitors with different countdowns for music/movie/festival/holiday/release/*-events). There are a few widgets I really like, but they would be thousand times easier to do using HTML/JavaScript (e.g. all those stocktrade- and sports-notifiers).
The mozilla-widget for python is ok, but I think it is (yet) unable to create a transparent background and would always cover the entire screenlet-window. Maybe it would be possible to create a container-widget (like a gtk.Fixed, but with a fully transparent bg) that allows placing common gtk-widgets at fixed positions (with fixed size). That way we could simply put a mozilla widget in the center of the screenlet and the outer border could still draw the screenlet's window. (But I think Moses played with that once and I seem to remember that there was a problem).
mikedee
August 7th, 2007, 05:41 PM
Soon you will have another html widget to use
http://gtk-webcore.sourceforge.net/
This uses the same rendering engine as safari, so with the correct client side libraries it will be possible to write a widget wrapper for apple widgets with identical results. The apple libraries mainly involve the configuration and flipping the widget (as well as notifying it when it is showing).
From what I see, KHTML/Webkit is a much faster engine than mozilla
whise
August 7th, 2007, 07:18 PM
i wish there was some html support embedded into python core , that and alsa support
btw im thinking that in the next release of this screenlets adding radio in the menu should be by genre like
Radios --> Music stations
News stations
Sport stations
Other.....
but for that i would nee someone to help me and collect radio links
RYX
August 8th, 2007, 02:20 AM
Here is a new version of my Mplayer-class, together with a small testbed application to play with it. It now works pretty well and takes a lot of commands. I think the popen2-thing is too complex and os.popen would work as well ... but it's too late and I gotta go to bed :D
#!/usr/bin/env python
# this is a simple test of my mplayer class
#
# by RYX (Rico Pfaus) 2007
#
import gtk
class Testbed:
"""Only a small testbed for the MPlayer-class."""
def __init__ (self):
self.player = None
self.win = gtk.Window()
self.win.connect('delete-event', self.delete_event)
self.win.show()
self.create_ui()
def create_ui (self):
vbox = gtk.VBox()
self.button_start = gtk.Button('Start')
self.button_start.connect('clicked', self.button_clicked, 'start')
vbox.add(self.button_start)
# "send" entry and button
self.entry = gtk.Entry()
self.button_send = gtk.Button('Send')
self.button_send_ret = gtk.Button('Send (and await return)')
vbox.add(self.entry)
vbox.add(self.button_send)
vbox.add(self.button_send_ret)
self.button_send.connect('clicked', self.button_clicked, 'send')
self.button_send_ret.connect('clicked', self.button_clicked, 'send_ret')
vbox.show_all()
self.win.add(vbox)
# MPlayer-class event-handling
def output_started (self, player):
print "Output of file/stream has started."
def output_stopped (self, player):
print "Output has stopped."
# gtk event-handling
def button_clicked (self, widget, id):
if id == 'start' and not self.player:
# create new player, connect to signals and start it
self.player = MPlayer('http://83.241.238.21/rixfm/?MSWMExt=.asf')
self.player.connect('output-started', self.output_started)
self.player.connect('output-stopped', self.output_stopped)
self.player.start()
elif id == 'send' and self.player:
print self.player.send_command(self.entry.get_text() + '\n')
elif id == 'send_ret' and self.player:
print self.player.send_command(self.entry.get_text() + '\n', True)
def delete_event (self, widget, event):
if self.player:
self.player.quit()
gtk.main_quit()
def start (self):
gtk.gdk.threads_init()
gtk.main()
import threading
import sys
import popen2
import gobject
class MPlayer (threading.Thread, gobject.GObject):
"""A utility class to use mplayer as media-backend from python-apps. Uses
the slave-mode of mplayer and runs it through a pipe."""
# some constants and vars
STARTING_PLAYBACK = 'Starting playback...' # indicates successful conn.
NO_STREAM = 'No stream found.' # indicates error
__connected = False
__failed = False
# signals
__gsignals__ = {
'output-started' : (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'output-stopped' : (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
}
# constructor
def __init__ (self, url, options=''):
"""Create new MPLayer-thread for playing the given urk. Options can be
used to add additonal options to mplayer's commandline."""
gobject.GObject.__init__(self)
threading.Thread.__init__(self)
self.url = url
self.options = options
self.pipe_w = None
self.pipe_r = None
# "public" functions
def connected (self):
"""Returns True/False depending on the connection-status of mplayer."""
return self.__connected
def failed (self):
"""Returns True/False depending on if the connection has failed."""
return self.__failed
# mplayer-functions (only a few for testing yet)
def get_audio_bitrate (self):
"""Get the bitrate of the current audio."""
return self.send_command('get_audio_bitrate', has_return=True)
def get_volume (self):
"""Get the current volume of the player."""
return self.send_command('get_property volume', has_return=True)
def load_file (self, url, append=False):
"""Load/play a media-file or stream from a URL or path. You must connect
to the "output-started" and "connection-failed" signals to handle the
result."""
if append:
url = url + ' 1'
self.send_command('loadfile ' + url)
# skip all response lines sent by mplayer
self.__wait_for_result()
def load_playlist (self, url, append=False):
"""Load/play a playlist from a URL or path. The result of this action
is not returned directly. You must connect to the "output-started"
and "connection-failed" signals to handle the result."""
if append:
url = url + ' 1'
self.send_command('loadlist ' + url)
# skip all response lines sent by mplayer
self.__wait_for_result()
def loop (self, value):
"""Adjust/set how many times the movie should be looped (-1 means no
loop, 0 means forever)."""
self.send_command('loop ' + value)
def toggle_mute (self):
"""Toggle mute on/off."""
self.send_command('mute')
def toggle_pause (self):
"""Toggle pause on/off."""
self.send_command('pause')
def quit (self):
"""Quit connection to player."""
self.send_command('quit', has_return=True) # need return to avoid crash
self.emit('output-stopped')
# TODO: emit signal 'player-quit'
self.close()
def set_mute (self, value):
"""Set mute (True/False)."""
self.send_command('mute ' + str(int(value)))
def set_volume (self, abs_volume):
"""Set the absolute volume."""
self.send_command('volume ' + str(abs_volume))
# internal/low-level functions
def send_command (self, command, has_return=False):
"""Send a command to mplayer. If "has_return" is True, the call waits
for a return value (NOTE: This can cause blocking if no return is
sent!!! Use it with caution and only if you expect a return value or
need to wait for the end of an operation!)."""
if self.pipe_w and command != '':
try:
self.pipe_w.write(command + '\n') # \n to end the command
self.pipe_w.flush()
# if we want to wait for a return value, wait
if has_return == True and self.pipe_r:
return self.pipe_r.readline()[:-1]
except Exception, ex:
print "Error: %s " % ex
# TEST!!!!!!!!!
if command.startswith('loadfile'):
self.__wait_for_result()
# no return
return None
else:
return None
def close (self):
"""Close the pipes to the player."""
if self.pipe_r:
self.pipe_r.close()
if self.pipe_w:
self.pipe_w.close()
def __wait_for_result (self):
"""Waits for a result from MPlayer after a new file is loaded or set to
be played. This function MUST be called whenever a new file/list has
been loaded to skip the initial output from mplayer and determine the
result of the operation (and emit the "output-start"-signal)."""
out = ''
# skip all the initial lines that are output by mplayer
while out != MPlayer.NO_STREAM and out != MPlayer.STARTING_PLAYBACK:
#print "O: %s" % out
out = self.pipe_r.readline()[:-1]
# now check the returned status (i.e. the current line)
if out == MPlayer.NO_STREAM:
self.__failed = True
print "failed to connect!!"
# TODO: emit signal here
elif out == MPlayer.STARTING_PLAYBACK:
self.__connected = True
self.emit('output-started')
# from this point on we block and mplayer waits for commands ...
else:
self.__failed = True
print "Unknown state. Error happened."
# TODO: emit signal here
def run (self):
self.pipe_r, self.pipe_w = popen2.popen2('mplayer -slave -quiet ' + \
self.options + ' ' + self.url)
if self.pipe_w and self.pipe_r:
# skip all the initial lines that are output by mplayer and either
# block or quit and raise error
self.__wait_for_result()
app = Testbed()
app.start()
:)
RYX
August 8th, 2007, 01:53 PM
I updated the class again and added some basic signals that can be easily handled within an application. It now properly waits for result lines whenever loadfile/loadlist are used. Some more bugs fixed, too.
btw: I highly dislike the mainstream-music on RixFM, I just chose it for testing because I found the name pretty funny (for obvious reasons) :D ...
whise
August 8th, 2007, 03:24 PM
are you thinking about embedding it in the screenlets core?
would be nice :D
RYX
August 8th, 2007, 04:01 PM
You can just import it as a module (e.g. mplayer.py) and include the file in your Screenlet for now. It doesn't really fit into the screenlets base-classes.
I think it would make more sense to (eventually) create a complete "mplayer"-module from it, make an additional package "python-mplayer" then and hand it over to the people at mplayerhq. Such a python-interface for mplayer could be of interest for other applications developers as well (and I am suprised that there is none yet). Also it is a rather enjoyable task to create it - especially creating own signals is pure fun.
(Maybe it should use os.fork instead of threading, but it works so it can't be that bad for a first try ... :))
:)
mikedee
August 8th, 2007, 04:12 PM
especially creating own signals is pure fun
NURSE!!
:lol:
RYX
August 8th, 2007, 04:24 PM
especially creating own signals is pure fun
NURSE!!
:lol:
:D ...
It's really simple (as you can see above). The mplayer "slave-mode" is a bit tricky, but the idea of having a completely gobject-based MPlayer-class is pretty cool (that's the fun-part of it). Playing with it wasn't very difficult, even without the smallest idea of using pipes for process communication. Maintaining such a class when things change may get ugly, though ...
:)
mikedee
August 8th, 2007, 04:50 PM
Sounds good :) I wouldn't worry too much about the interface changing because I expect mplayer is fairly stable.
Your test app works here
I just replaced the Mplayer constructor with this
self.player = MPlayer('http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram', '-playlist')
I am not sure what the load_playlist and load_file functions do...
RYX
August 8th, 2007, 05:12 PM
Load_playlist and load_file are for loading (appending) a new list/file after the player has been started, they have no effect before the player is running. It is a bit of a workaround that we first need to start the player with an url and then can send commands to it - mplayer can't just start in slave-mode and then wait for input, it needs to be playing something to not immediately quit (at least I was unable to make it just wait for input without playing a file).
cbudden
August 22nd, 2007, 02:11 PM
How can I get the screenlet to start, but not play the station straight away?
whise
August 22nd, 2007, 07:52 PM
open it and put start = False or something , cant remember lol
kilvadi
August 29th, 2007, 07:54 PM
I like your radiostreaming screenlet and i have an idea.
mplayer is able to use tuner cards (via v4l).
so w mplayer we can hear real radio stations (and watch tv) also.
my command line: mplayer {-radio driver=v4l} radio://[FREQ]
thanks!
whise
August 30th, 2007, 02:38 PM
i cant aqctually test it , not because i have no tuner card witch i do , but because mine doesnt work :(
whise
September 12th, 2007, 04:26 PM
new version , new gui with play stop buttons , now it plays ram files (finally bbc radio and ministy of sound)
and fixed a bug where it hang when internet connection failled
plun
September 12th, 2007, 04:34 PM
Thanks whise.... my Gutsy kernel have had a network stack bug and my connection went up and down... The Radio screenlet froze beacuse of this..
Testing the new version :)
whise
September 12th, 2007, 04:35 PM
forgot to say real media streams take a little longer to load
plun
September 12th, 2007, 06:28 PM
Works great now....
For other to know.... national stations can easily be added
I am using XML copy editor
/usr/local/share/screenlets/RadioStreaming/menu.xml
<!-- Uncomment to add Hide/show option to menu -->
<!--<item label="Hide/Show" id="hide_show" />-->
<!-- user definable actions here: -->
<!-- <imageitem label="radio name" id="radio address SPACE radio name" />-->
<imageitem label="Ministry of Sound" id="http://www.ministryofsound.com/radio/radioplayer/ Ministry of Sound" />
<imageitem label="BBC Radio 1" id="http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram BBC Radio 1" />
<imageitem label="BBC Radio 2" id="http://www.bbc.co.uk/radio2/realmedia/fmg2.ram BBC Radio 2" />
<imageitem label="BBC Radio 3" id="http://www.bbc.co.uk/radio3/ram/r3g2.ram BBC Radio 3" />
<imageitem label="BBC Radio 4" id="http://www.bbc.co.uk/radio4/realplayer/media/fmg2.ram BBC Radio 4" />
<imageitem label="BBC Radio 5" id="http://www.bbc.co.uk/fivelive/live/surestream_int.ram BBC Radio 5" />
<imageitem label="BBC News" id="http://www.bbc.co.uk/worldservice/meta/tx/nb/live_news_au_nb.ram BBC News" />
<imageitem label="Frequence 3" id="http://80.65.234.120:8000/ Frequence 3" />
<imageitem label="Hitz Channel" id="http://scfire-chi0l-1.stream.aol.com/stream/1074 Hitz Channel" />
<imageitem label="Hot 108 Jamz" id="http://scfire-nyk0l-2.stream.aol.com/stream/1071 Hot 108 Jamz" />
<imageitem label="RMF FM" id="http://213.251.140.62:8002 RMF FM" />
<imageitem label="80s Channel" id="http://scfire-nyk0l-2.stream.aol.com/stream/1040 80s Channel" />
<imageitem label="Sky FM Jazz" id="http://scfire-ntc0l-1.stream.aol.com/stream/1010 Sky FM Jazz" />
<imageitem label="Techno 4ever" id="http://80.237.156.79:8000/ Techno 4ever" />
<imageitem label="Digitally imported" id="http://scfire-nyk0l-1.stream.aol.com/stream/1003 Digitally imported" />
<imageitem label="Sky FM Top Hits" id="http://scfire-chi0l-2.stream.aol.com/stream/1014 Sky FM Top Hits" />
<imageitem label="Smooth Jazz" id="http://scfire-ntc0l-1.stream.aol.com/stream/1005 Smooth Jazz" />
<imageitem label="ChroniX Aggression" id="http://scfire-chi0l-1.stream.aol.com/stream/1039 ChroniX Aggression" />
<imageitem label="Powerhitz" id="http://205.188.215.229:8006/ Powerhitz" />
<imageitem label="Mix Megapol" id="mms://live.alleredge.com/AE_MixMegapol_Mid Mix Megapol" />
<imageitem label="Lugna Favoriter" id="http://83.241.239.21/lugna/?MSWMExt=.asf Lugna Favoriter" />
<imageitem label="P3" id="rtsp://sr-rm.qbrick.com/broadcast/cluster/encoder/02038_p3.rm P3" />
<imageitem label="Rix FM " id="http://83.241.238.21/rixfm/?MSWMExt=.asf Rix FM" />
<separator />
<imageitem label="Start" id="start" />
<imageitem label="Stop" id="stop" />
</menu>
:)
eneru
September 13th, 2007, 06:13 PM
this sounds absolutely cool :)
Would it be possible to had a button to save the current playing track ? (it won't work exactly the same depending on the radio stations, but could help at last)
whise
September 13th, 2007, 07:00 PM
thats not possible ,internet radio are streams , theres no available way to go back on a stream
eneru
September 13th, 2007, 08:20 PM
I had a media player which allowed that before (don't remember the name, it was on windows).
I guess it saves the stream in real time in a buffer, and differentiated the tracks thanks to info given by the radio (and then gave this name to the saved track) or/and by the blanks between tracks. After some times (or when the max size was hit) it deleted the more ancient saved track, and etc.
Depending on the radio, tracks could be quite lengthy (if they didn't stream the correct name for each song, so there were several songs in the same file) or correct otherwise :)
whise
September 13th, 2007, 08:42 PM
oh i see what you mean , but i dont know of a way to do it
some-guy
September 15th, 2007, 06:27 PM
you can lok into Pymp, it is a mplayer frontend written in python :D
http://jdolan.dyndns.org/trac/wiki/Pymp
whise
September 15th, 2007, 06:33 PM
i know i used it :D
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.