2 ############################################################################
3 # soepkiptng (c) copyright 2000 Eric Lammerts <eric@lammerts.org>.
5 ############################################################################
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License, version 2, as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # A copy of the GNU General Public License is available on the World Wide Web
16 # at `http://www.gnu.org/copyleft/gpl.html'. You can also obtain it by
17 # writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
19 ############################################################################
24 # find program directory
27 my $l = readlink or die "readlink $_: $!\n";
28 if($l =~ m
|^/|) { $_ = $l; } else { s|[^/]*$|/$l|; }
31 my $progdir = abs_path
($1);
33 require "$progdir/soepkiptng.lib";
37 read_configfile
(\
%conf, $opt_c);
39 $ENV{PATH
} = "$progdir/bin:$ENV{PATH}";
40 use lib
"$progdir/lib";
43 my ($url, $desc) = @_;
45 my $arid = get_id
($dbh, "artist", '') or die;
46 my $alid = get_id
($dbh, "album", '') or die;
47 $dbh->do("REPLACE INTO song SET title=?, filename=?, album_id=?, " .
48 "artist_id=?, present=1, encoding=\"Shoutcast\", track=0, " .
49 "length=0, time_added=NULL", undef,
50 $desc, $url, $alid, $arid) or die;
52 warn "Added $url: $desc\n";
53 if($have_stream{$url}) { $num_updated++; }
54 else { $num_added++; }
60 $dbh = DBI
->connect("DBI:$conf{'db_type'}:$conf{'db_name'}:$conf{'db_host'}", $conf{'db_user'}, $conf{'db_pass'})
61 or die "can't connect to database";
63 my $shc = $dbh->selectcol_arrayref("SELECT filename FROM song WHERE filename LIKE \"http:%\"");
76 if(/^File(\d+)\s*=\s*(http:\S+)/) {
80 if(/^Title(\d+)\s*=\s*(.*\S+)/) {
91 for($i = 0; $i < @url; $i++) {
92 add_shout
($url[$i], $title[$i] || $url[$i])
99 printf <<EOF, $num_added, $num_updated;
100 %4d Shoutcast streams added.
101 %4d Shoutcast streams updated.