Тема: perl скрипт ices0
Есть скрипт на перле для ices, который должен брать данные о треках из базы mysql, но почему то у меня выдает ошибку при запуске ices. Может кто то сможет помочь?
Вот сам скрипт:
sub ices_shutdown {
print "Perl subsystem shutting down:\n";
}
# Function called to get the next filename to stream.
# Should return a string.
sub ices_get_next {
#print "Perl subsystem quering for new track:\n";
#return "/usr/local/etc/modules/mp3/2.mp3";
use DBI;
$dbh = DBI->connect('DBI:mysql:база;host=localhost', 'юзер', 'пароль'
) || die "Could not connect to database: $DBI::errstr";
$sth = $dbh->prepare('SELECT name FROM mp_id3_tags WHERE строка с айди трека (она же id)=1');
$sth->execute();
$result = $sth->fetchrow_hashref();
print "Value returned: $result->{file}\n";
return $result->{file};
$dbh->disconnect();
}
# If defined, the return value is used for title streaming (metadata)
sub ices_get_metadata {
use DBI;
$dbh = DBI->connect('DBI:mysql:база;host=localhost', 'юзер', 'пароль'
) || die "Could not connect to database: $DBI::errstr";
$sth = $dbh->prepare('SELECT name FROM mp_id3_tags WHERE строка с айди трека (она же id)=1');
$sth->execute();
$result = $sth->fetchrow_hashref();
print "Value returned: $result->{name}\n";
return $result->{name};
$dbh->disconnect();
#return "Artist - Title (Album, Year)";
}
# Function used to put the current line number of
# the playlist in the cue file. If you don't care
# about cue files, just return any integer.
sub ices_get_lineno {
return 1;
}
return 1;
В таблице следующие строки:
ID filename audio_bitrate playtime_seconds artist title album genre
Думаю что в них указано - все ясно (в filename - полный путь к файлу)