
RecordRadio
Source (link to git-repo or to original if based on someone elses unmodified work):
Description:
RecordRadio is a simple bash script that plugs into amarok and uses streamripper to record radio stations you listen to.
Now as of version 0.2 it can also save podcasts to your music collection!
Simply enable it as a plugin, and when you connect to any http stream it plugin will spawn a instance of streamripper that will record the songs and place them in subdirectories within a directory called "Music" in your home. Five seconds later amarok will start listening to a relay server on port 8017 so as not to use unnecessary bandwidth.
To save a podcast or remote mp3 or ogg file to your music collection, right click on it in your playlist, select "RecordRadio" and "Save Podcast". They will be saved in a directory called Music/SavedPodcasts within your home directory.
If you wish to change the streamripper options (proxy settings etc.) or the directory where things are stored right-click on RecordRadio in your script manager and click edit. These are simply variables that are set in the first few lines of the file.
Requirements:
You need to have streamripper installed. It comes as part of Debian and several other distributions. You can also download it from http://streamripper.sourceforge.net/ .
If you are using Mandriva 2006 you can get streamripper from "contrib". However for RecordRadio to work you will need to update to the latest version of Amarok due to a bug in 1.3.1
For RecordRadio to run need to have a few standard GNU commands available: (awk, egrep, ps, wget)
RecordRadio has been tested on and works with
Amarok == 1.3.7 (with xine and arts engines),
1.3.1 will NOT work!
Streamripper == 1.67.17
Note: This script will not work with Amarok 2.0. Please see: https://bugs.kde.org/show_bug.cgi?id=179015
Known Bugs:
When you start an internet radio station your playlist will be cleared. (This can be fixed as soon as the amarok developers fix the playMedia dcop call)
Because streamripper for whatever reason cannot produce metadata on demand for some stations, there may be a delay of up to 15 secounds before you can switch to the replay server. However you can continue to listen to the station live until then, and it will still get recorded. These stations may also cause amarok to be unable to report the length of recorded songs. However these can be fixed by using a plugin called MP3Fixer, and restarting amarok.
Sometimes the server is full and cannot support an additional connection for streamripper so you can't record that station, so it simply will not be recorded and you will continue to listen to it live. If this happens you will receive an error to the effect that localhost refused your connection.
If you like this plugin, please consider making a donation to the Electronic Frontier foundation: www.eff.org Last changelog:
Now as of version 0.2 it can also save podcasts to your music collection!
Simply enable it as a plugin, and when you connect to any http stream it plugin will spawn a instance of streamripper that will record the songs and place them in subdirectories within a directory called "Music" in your home. Five seconds later amarok will start listening to a relay server on port 8017 so as not to use unnecessary bandwidth.
To save a podcast or remote mp3 or ogg file to your music collection, right click on it in your playlist, select "RecordRadio" and "Save Podcast". They will be saved in a directory called Music/SavedPodcasts within your home directory.
If you wish to change the streamripper options (proxy settings etc.) or the directory where things are stored right-click on RecordRadio in your script manager and click edit. These are simply variables that are set in the first few lines of the file.
Requirements:
You need to have streamripper installed. It comes as part of Debian and several other distributions. You can also download it from http://streamripper.sourceforge.net/ .
If you are using Mandriva 2006 you can get streamripper from "contrib". However for RecordRadio to work you will need to update to the latest version of Amarok due to a bug in 1.3.1
For RecordRadio to run need to have a few standard GNU commands available: (awk, egrep, ps, wget)
RecordRadio has been tested on and works with
Amarok == 1.3.7 (with xine and arts engines),
1.3.1 will NOT work!
Streamripper == 1.67.17
Note: This script will not work with Amarok 2.0. Please see: https://bugs.kde.org/show_bug.cgi?id=179015
Known Bugs:
When you start an internet radio station your playlist will be cleared. (This can be fixed as soon as the amarok developers fix the playMedia dcop call)
Because streamripper for whatever reason cannot produce metadata on demand for some stations, there may be a delay of up to 15 secounds before you can switch to the replay server. However you can continue to listen to the station live until then, and it will still get recorded. These stations may also cause amarok to be unable to report the length of recorded songs. However these can be fixed by using a plugin called MP3Fixer, and restarting amarok.
Sometimes the server is full and cannot support an additional connection for streamripper so you can't record that station, so it simply will not be recorded and you will continue to listen to it live. If this happens you will receive an error to the effect that localhost refused your connection.
If you like this plugin, please consider making a donation to the Electronic Frontier foundation: www.eff.org
0.2.3 - Separate "always record" and "Record on demand" modes and several bug fixes.
0.2.2 - Adds menu to listen without recording.
0.2.1 - Fixed bugs mentioned by pfeifle and prevented from going out of control if amarok crashes.
0.2 - Added ability to save podcasts.
0.1.1 - Removed bug requiring output file.
0.1 - First release
Ratings & Comments
32 Comments
I was searching for streaming media rippers and ran across this script. It's no longer working in the latest Amarok which is version 2.4.0. Perhaps you could look into this. It will install but does not work as stated within this version of Amarok (i.e. no right click menus.
"sorry streamripper was rejected by the server" any help please ? tx
One reason this can occur is that certain websites don't want to have their content recorded and will disallow anything with the user agent "StreamRipper" from connecting. You can of course get around this if you really want to. If you look at its manpage, streamripper has an option to change the user agent to anything you want. All you have to do is to add this flag to the 'options' string specified at the top of the file. This is not done by default, because I have no desire to conceal things from the site it is connecting to.
Hello! Can I use this Script in Amarok 2.0 ?
Unfortunately this and almost any other complex plug-in is permanently broken in Amarok 2.0. Someone decided that the only plugins that should be allowed must be written in Java script, not call any external libraries processes and only call these functions within Amarok: http://amarok.kde.org/wiki/Development/Script_API I consider this very limiting and have filed a feature request: https://bugs.kde.org/show_bug.cgi?id=179015 I would encourage anyone who wants this plugin to continue to work in future version to vote for that feature.
As far as I understand external calls are possible, just via qtscript. I didn't look to deep into it, but did a small test via the amarok console script executing: Importer.loadQtBinding("qt.core"); var q = new QProcess(); q.start("kate"); And it seems to work. Should be possible to execute streamripper on this way. I might look deeper into it someday, but it would be great to see this script ported to amarok 2.0 soon. It is definitly one of my favorite ones and currently deeply missed! :)
It would be fine, if some parameters can be set out of amarok. The first lines of "OnDemand-Script" like this: == snip === Output="/dev/null" MusicDir="$HOME/Music" PodcastDir="$MusicDir/SavedPodcasts" PortNumber=8017 http_proxy="" Options="-o larger -k 1 --quiet -z" == snap === should be changeable out of amarok.
I really like that it even splits the songs and saves them seperately, like that I can easily choose which songs I want to keep. Great work! Cheers, Thelonius
Maybe you can help me with that? ... In both modes (always and record on demand) the stream records into one big mp3 file. I start and stop recording with the script manager and I'm running Amarok 1.4.5. and streamripper. Please help! Thanks :)
RTFM: Quote:Q: How can I make streamripper rip to a single large file instead of a lot of little files?
A: Use the -a flag to rip to a single large file. Use the -A flag to disable the creation of the little files.
http://streamripper.sourceforge.net/faq.php
Here is a suggestion for a feature, which would make this skript superb: While amaroK plays in the background I happen to decide that I'd like to have the actual playing song on my harddisk. How about a Skript recording a radiostream song after song all the time, and a possibility to hit a button saying "save this". If this button is not hit while the actual song is still playing, then the song is deleted when the next song begins.
Great script. One question: to record I use "save podcast" but how do I stop recording? Thanks
Hi, great tool! Just one problem. I tried to record the last.fm stream in amarok 1.4.0(through lastamarok) with recordradio but its just not working... any ideas how to handle this?
The same problem here :( The script works well with eg. Virgin Radio, but not with last.fm ...
If you are interested in saving lastfm in general you probably want to have a look at this. But saving it with amarok would be much cooler... Although I'm not sure it this is legal... http://search.cpan.org/src/JOCHEN/last.fm-ripper-1.2/README
last.fm is handled differently in Amarok, so it wouldn't be possible with a script like this.
You are awesome! Thanks for the script.
Hi !! I try your script, but it says me that : "Impossible to open the URL http://localhost:8017/relay.mp3 I use Xine, but with Arts it is worse ! What can I do ? Bye !
This means that it was not able to connect to the relay server it spawned. There are two possibilities that can cause this. First is if you are using the "Always record" mode, the server may have accepted the connection from your computer, and allowed you to start listening, but rejected when you tried to reconnect, because it was busy. This should not happen in "record on demand" mode. So try that first. The second possibility is that it simply did not wait long enough to try to connect to the server. This could simply be caused by your computer being slow. If this happens consistently go into the script manager and right click on the script and click edit. Then change the line towards the bottom that says: "sleep 2" to something like say "sleep 5", which will add an extra three seconds pause to get the relay server up and running. If this continues to happen, even with the increased delay and in "on demand" mode. Then edit the script so that it sends it's log to a file somewhere, start amarok and reproduce the problem. Then send me the log file as well as a step by step list of everyting you did.
Here's one that streams fine but this script doesn't handle, because it doesn't end in ".mp3" or ".ogg": http://64.236.34.67:80/stream/1005 Can that be fixed? :)
This is a stream, not a podcast. If you add this as a radio station and start playing, it will get recorded. (At least it worked for me.) Clicking "Save Podcast" is only intended for podcasts and deliberately ignores streams. These two features are really unrelated I just happened to put them in the same plugin so they would not step on each other's toes. Handling podcasts and streams in the same way is not a good idea because if you just try to download a stream, you will get a never ending file that you can't easily deal with. Similarly using streamripper to download podcasts makes no sense as it will mess up the name and ID3 tags. I could make a feature to record a radio stream that you are not currently listening to from a right-click menu. However I have not yet done this, as I don't see any way to have a good interface so you can see what you are currently downloading, or a good way to allow the user stop the recording. If anyone has any ideas on how to provide such an interface I would welcome suggestions.
Oops, I'm sorry, I didn't realize there was separate functionality for podcasts and streams. I just tried it, and indeed, it's recording. :) Now, I do have a small feature request, if possible: could there be a button or menu item for recording streams, instead of doing it automatically? I don't want to record it every time I listen to it, but it'd be nice to be able to leave the script activated without it automatically recording streams. Thanks for your great script. :)
0.2.2 now has a menu to do this.
Thanks for adding that, but wouldn't it make more sense to not record by default, and to use the menu to record it? I listen to this stream all the time, but I only record from it once in a while.
Trying 0.2.3 now. You rock, thanks. :)