It would be great to see this as an option in Libretime and as a way getting it working fully in AWS or other virtualisation. At the moment, if you need to record shows you end up having to host the the Libretime server actually in the studio.
I got this sort of working in Airtime 2.5.2 see hack by replacing ecasound with sox to record a stream and push it to the master source at the same time. I better option might be to record from the master or show source directly?
Currently the record from line in feature is not working 100% as reported in #42. Having it also record from the stream is certainly a feature that would benefit lots of stations.
Liquidsoap has file recording facilities as well. They may be the better option since less re-encoding needs to be done that way. I did have some buffering issues when I was playing with those in a different piece of software, those may have stemmed from my setup being underspeced.
This should probably be implemented in a way that makes sense for both the line-in and stream-in case. There might also be some overlap with some stations 24/7 recoding needs. Where I'm at we need to keep such recordings as mandated by the broadcast authority. We are currently opening those archives up to the members of our community station and I have been considering re-uploading (or watching) those same recordings in LibreTime to be able to replay them.
The line-in recording feature is currently missing is a way to get the shows linked to the original show. during import. This would be needed for stream recordings as well. Originally this was handled by media-monitor and never ported to analyzer.
I think this is not needed as you can do that right now (as soon as the line in feature works 100% ).
You'd just need to activate ALSA sound card and do a loop back from the output of your soundcard to the input (you may connect a physical cable too.. but why when you can use the loopback feature?)
http://www.sabi.co.uk/Notes/linuxSoundALSA.html#tasksRecordPlay
I want to achieve something similar so I'll do some test. I'll let you know as soon as I investigate a bit more about it.
I'm not sure I understand this @xabispacebiker. What if you don't have a sound card? Our current Airtime setup uses a Raspberry Pi which has a doesn't have a good sound card - so we record off a stream instead. Which also means that you can record from any source anywhere...
@hairmare In case it is of interest I'm attaching the script we use to record everything that comes out of the station (both live and scheduled). It might be useful to cover your legal requirements...
(run from cron)
0 * * * * /usr/loca/bin/radiobackup.sh http://airtime.address.com:8000/airtime.ogg >> /dev/null 2>&1
@GroundTruthNZ Thanks for posting the script, nice streamwripper wrapper :)
At our station we recently rolled out a nice rails app to manage our archive. It covers both our legal and comfort use cases, under the hood it uses some hacky liquidsoap scripts for 24x7 recording. It depends on LibreTime's database as source of truth regarding the program grid.
The current (broken) recording solution is more about recording individual shows for rebroadcast. What I beleive is really needed to get some progress going into the pre-recording situation (being it line-in or streams) is some proper docs on the REST upload API that make it easy to identify what's missing in the MVCs modules/rest parts so the recording from wherever can be uploaded as such, this would also be the api the ecasound recordings take which why #42 needs tagging on this issue.
We currently use curl --output on a cron job
regards and respect to all
It might be possible to avoid the multiple files/sox step by using a substitute for curl which is also very kind to memory usage. I will try it out as a client has a current need for this and report back.
` /* Curl-less, Streamripper-less, ffmpeg & mplayer-less, low memory use, simple native php CLI script which can be called from a cron job. It avoids the re-encoding stuff that many solutions use, so loss of fidelity and less resource load on the server. It also tries to recover from stream breaks. Questions/queries to John Chewter [email protected]
Syntax in bash (cron) is: php /your/path/ripstream.php yourfilename minutes
NB. No spaces in filename are permitted. Minutes can have partial minutes in decimal format, so 45.5 minutes would be 45 mins and 30 seconds. */
$streamurl = 'http://x-pedia.org:8000/deprogrammedradio.mp3';
$savepath = dirname(__FILE__).'/downloads';
$got_commands = true;
if (isset($argv[0])){
$filename = $argv[1];
} else {
$got_commands = false;
echo "Error - No file name specified.\n";
}
if (isset($argv[1])){
$myminutes = $argv[2];
} else {
$got_commands = false;
echo "Error - No minutes specified.\n";
}
if (isset($argv[3])){
echo "Oops! Too many arguements. Have you spaces in your filename?\n";
$got_commands = false;
}
if ($got_commands == false) {
echo "Syntax in bash (cron) is: php /your/path/ripstream.php yourfilename minutes\n";
echo "NB. No spaces in filename are permitted.\n";
echo "Minutes can have partial minutes in decimal format, so 45.5 minutes would be 45 mins and 30 seconds.\n\n";
exit(1);
}
function downloadStream($streamurl, $filename, $savepath, $myminutes) {
$retry = 0;
$gotFile = false;
$max_time = 60 * $myminutes;
$end_time = microtime(true) + $max_time;
$blocksize = 1024 * 8;
$current_time = microtime(true);
while ((microtime() < $end_time) && ($retry < 10)) {
if ($streamhandle = fopen ($streamurl, "rb")){
if ($streamhandle) {
$show_filename = $savepath.'/'.date('m-d-Y_hia').'-'.$filename;
$newf = fopen ($show_filename, "wb");
if ($newf){
while($current_time < $end_time) {
$current_time = microtime(true);
fwrite($newf, fread($streamhandle, $blocksize ), $blocksize );
}
}
}
if ($newf) {
fclose($newf);
$gotFile = true;
}
$t = 100;
break;
} else {
$t=$t+1;
sleep(2);
}
if ($streamhandle) { fclose($streamhandle); }
}
if ($streamhandle) { fclose($streamhandle); }
return $gotFile;
}
if (!file_exists($savepath)) {
mkdir($savepath);
}
if (downloadStream($streamurl, $filename, $savepath, $myminutes)){
echo "Download OK";
exit(0);
} else {
echo "Download Failed";
exit(1);
}
?>
`
Nice one @JohnnyC1951! Something like this could presumably also be used in the recorder.py script (rather than ecasound) to record a stream for rebroadcasting...
We would back this feature as well at our station, We are now looking to move away from SAM Cloud because of the cost and I'm currently going with LT however this feature would make life 1000's times easier as we repeat almost every show we have.
Cheers
AJ from RW
Yeah, I agree this would be helpful. @aj2199 do you mean back financially or by contributing code or are you just sharing that this would be useful. The big challenge with LibreTime currently is that as a volunteer side project new features, bug fixes and potential improvements aren't getting the energy that they need to add significant functionality so any help (even encouragement like your comment) is appreciated.
We could potentially look at some sort of donation to help prompt the development and implementation of such feature. @Robbt
If I understand and code in php so if I could help with anything I'm happy to give it a go.
In case anyone is interested, I made a change to LiquidSoap on Airtime 2.5.1 to 'auto-archive' the stream for our station (Hollow Earth Radio) when someone is streaming on the Master or Show sources, but not when there was schedule playlists or dead air. It would also modify the MP3 tags using ID3v2 to include the name of the radio show and that the track was a show archive.
The MP3 archives would be created in a directory which was configured to be monitored by Airtime and the files would be auto imported. I have been able to get the file creation working with LibreTime, but due to the switch to airtime_analyzer the monitoring and auto-import doesn't work.
@btpnlsl that would be interesting to see definitely
@aj2199
The modifications have a bunch of hard coding which is really specific to our station. I would be interested in making it more generic or being able to turn the feature on or off.
When the master or show stream switch on or off, dump.start or dump.stop will be called to start the auto-archive:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/ls_script.liq#L216-L234
Here are the methods which do the actual archiving:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/ls_script.liq#L420-L469
There is a separate python file which gets the current show title:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/get_current_show.py#L1
This issue has been automatically marked as stale because it has not had activity in the last 5 months. It will be closed if no activity occurs in the next month.
Please chat to us on discourse or ask for help on our chat if you have any questions or need further support with getting this issue resolved.
You may also label an issue as pinned if you would like to make sure that it does not get closed by this bot.
@aj2199
The modifications have a bunch of hard coding which is really specific to our station. I would be interested in making it more generic or being able to turn the feature on or off.When the master or show stream switch on or off, dump.start or dump.stop will be called to start the auto-archive:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/ls_script.liq#L216-L234Here are the methods which do the actual archiving:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/ls_script.liq#L420-L469There is a separate python file which gets the current show title:
https://www.github.com/HollowEarthRadio/libretime/blob/e5a2b4f81e2ed1108a76a5c6b7e555d6fd68a097/python_apps/pypo/liquidsoap/get_current_show.py#L1
is your work still working with the last release of LBT ?