Raise another Internet radio
But not simple, but more or less automated.
We will do round-the-clock radio with periodic broadcasts of DJs, automatic creation of low-stream and recording of broadcasts.
Despite the fact that the solutions used are quite trivial, the topic is designed primarily to see these trivial solutions.
To do this, we need only mpd and icecast. I will not consider their installation and general configuration, for the first is trivial, and for the second, example configs are supplied.
We assume that you have already done this.
Task zero: preparation.
We will need three mountpoints in icecream. Define them: We need the first one for round-the-clock broadcasting with mpd, the other two for broadcasting DJs. Task One:
round-the-clock broadcasting with periodic broadcasts of DJs.
We need that the listeners do not need to reconnect each time the broadcast starts / ends. It is very easy to do this in the iccast: fallback-mount.
Let's bring our config of mounts in ayskast to this form: Using fallback-mount we instructed ayskas to give clients /mpd.ogg stream in the absence of broadcasting to /radio_low.ogg and /radio_high.ogg. And the fallback-override flag allows you to return customers to this mount when broadcasting to it. Very simple, right? Everything seems to be fine, but not all DJs can afford to broadcast in two streams, and it’s not very convenient. The second task: the automatic creation of a low-stream.
For this we will use the same mpd, but we will write a new config for it. It will be necessary to change at least the paths to the library, playlists and pid-file so that there are no conflicts between two copies of mpd. The output will need to be sent to the mount /radio-low.ogg of the Ayskast. Now we just have to start a new copy of mpd with this config and add the address of the high-stream radio to the playlist. Thus, the MPD, like any other client, receives either broadcast from the main MPD or a DJ broadcast, transcodes and sends it to a low stream. Problem solved.
The last task: automatic recording of air.
Eiskast supports writing a stream to a file. Unfortunately, he does not know how to separate files, and therefore with each new broadcast the old file will be overwritten. Fortunately, he can execute scripts at the start / end of broadcasting.
We need to record only a high-stream, as DJs broadcast only on it.
We will slightly fix the Aiskast config: We indicated where to record the stream and which script to execute at the end of the broadcast. I recommend naming the file for the dump by the name of the mount point, because the mount point is passed as a parameter to the script. It remains only to write this script: All that the script does is move the dump file to the directory specified in $ path, naming it by the current date and stream name.
That, in fact, is all. If the community is interested, then in the next article I will tell you how to notify about current tracks and broadcasts using the bot in the jabber-conference.
We will do round-the-clock radio with periodic broadcasts of DJs, automatic creation of low-stream and recording of broadcasts.
Despite the fact that the solutions used are quite trivial, the topic is designed primarily to see these trivial solutions.
To do this, we need only mpd and icecast. I will not consider their installation and general configuration, for the first is trivial, and for the second, example configs are supplied.
We assume that you have already done this.
Task zero: preparation.
We will need three mountpoints in icecream. Define them: We need the first one for round-the-clock broadcasting with mpd, the other two for broadcasting DJs. Task One:
/mpd.ogg
/radio_high.ogg
/radio_low.ogg
round-the-clock broadcasting with periodic broadcasts of DJs.
We need that the listeners do not need to reconnect each time the broadcast starts / ends. It is very easy to do this in the iccast: fallback-mount.
Let's bring our config of mounts in ayskast to this form: Using fallback-mount we instructed ayskas to give clients /mpd.ogg stream in the absence of broadcasting to /radio_low.ogg and /radio_high.ogg. And the fallback-override flag allows you to return customers to this mount when broadcasting to it. Very simple, right? Everything seems to be fine, but not all DJs can afford to broadcast in two streams, and it’s not very convenient. The second task: the automatic creation of a low-stream.
/mpd.ogg
/radio_high.ogg
/mpd.ogg
1
/radio_low.ogg
/mpd.ogg
1
For this we will use the same mpd, but we will write a new config for it. It will be necessary to change at least the paths to the library, playlists and pid-file so that there are no conflicts between two copies of mpd. The output will need to be sent to the mount /radio-low.ogg of the Ayskast. Now we just have to start a new copy of mpd with this config and add the address of the high-stream radio to the playlist. Thus, the MPD, like any other client, receives either broadcast from the main MPD or a DJ broadcast, transcodes and sends it to a low stream. Problem solved.
The last task: automatic recording of air.
Eiskast supports writing a stream to a file. Unfortunately, he does not know how to separate files, and therefore with each new broadcast the old file will be overwritten. Fortunately, he can execute scripts at the start / end of broadcasting.
We need to record only a high-stream, as DJs broadcast only on it.
We will slightly fix the Aiskast config: We indicated where to record the stream and which script to execute at the end of the broadcast. I recommend naming the file for the dump by the name of the mount point, because the mount point is passed as a parameter to the script. It remains only to write this script: All that the script does is move the dump file to the directory specified in $ path, naming it by the current date and stream name.
/mpd.ogg
/radio_high.ogg
/mpd.ogg
1
/tmp/radio_high.ogg
/path/to/my/script/stend.pl
/radio_low.ogg
/mpd.ogg
1
#!/usr/bin/env perl
use strict;
use warnings;
use DateTime;
my $path="/path/to/my/archive/";
my $mn=$ARGV[0];
$mn=~s|/||;
my $dt=DateTime->now;
my $dmy = $dt->dmy('_');
my $fname=$path.$dmy."_".time()."_".$mn;
`mv /tmp/$mn $fname`;
That, in fact, is all. If the community is interested, then in the next article I will tell you how to notify about current tracks and broadcasts using the bot in the jabber-conference.