ОсновноеRadiotalkПользовательское
Технологии вещания, софт, скрипты
3   •   Посмотреть все темы

Perl скрипт ices

 

26
Вадим @tayler882
Вот нашел скрипт perl для ices, подключается к БД и выбирает трек с id=1. Поможете дописать чтобы треки играли по очереди, например: id=1, id=2 и т.д.



sub ices_shutdown {
print "Perl subsystem shutting down:\n";
}

sub ices_get_next {

use DBI;
use DBD::mysql;
$dbh = DBI->connect('DBI:mysql:ices;host=localhost', 'юзверь', 'пасс'
) || die "Could not connect to database: $DBI::errstr";
$sth = $dbh->prepare('SELECT filename FROM mp_id3_tags WHERE id=1');
$sth->execute();
$result = $sth->fetchrow_hashref();
print "Value returned: $result->{filename}\n";
return $result->{filename};

$dbh->disconnect();
}

# If defined, the return value is used for title streaming (metadata)
sub ices_get_metadata {

use DBI;
use DBD::mysql;
$dbh = DBI->connect('DBI:mysql:ices;host=localhost', 'юзверь', 'пасс'
) || die "Could not connect to database: $DBI::errstr";
$sth = $dbh->prepare('SELECT filename FROM mp_id3_tags WHERE id=1');
$sth->execute();
$result = $sth->fetchrow_hashref();
print "Value returned: $result->{filename}\n";
return $result->{name};

$dbh->disconnect();

#return "Artist - Title (Album, Year)";
}




sub ices_get_lineno {
return 1;
}

return 1;

6245
Тарас @tarasian666
WHERE id= $id

$id++;

26
Вадим @tayler882
Спасибо.