Было дело, кто-то публиковал данный код PAL скрипта ТОП 10...
var P : TPlayer;
var OldTime : DateTime;
OldTime := Now;
PAL.Loop:= True; // Ñêðèïò áóäåò âûïîëíÿòñÿ ïîñòîÿííî
// ------------- íàñòîðèòü ñåêóíäû äëÿ òî÷íîãî çàïóñêà (èíòåðâàë íå áîëåå 30 ñåê.)
if (now >= T['20:59:30']) and (now <= T['21:00:00']) and // çàïóñê â 21:00 âå÷åðà
((DayOfWeek(Now) = Friday)) then // çàïóñêàåòñÿ òîëüêî â ïÿòíèöó
begin
// -----------------------------------------------------------------------------
Queue.AddFile('D:\Music MP3\iradio\Zastavki\peredachi\top10\top10_anons_mix.mp3',ipTop); // ãîëîñ âåäóùåãî î çàâåðøåíèè Õèò-ïàðàäà
// -----------------------------------------------------------------------------
var D : TDataSet;
var C : Integer;
D := Query('SELECT songlist.*, count(*) as cnt '+
'FROM songlist,requestlist '+
'WHERE (songlist.ID = requestlist.songID) '+
' AND (requestlist.code < 700) '+
'GROUP BY songlist.ID '+
'ORDER BY songlist.count_requested DESC, songlist.date_played DESC, cnt DESC LIMIT 10',[],True); // ëèìèò 10 òðåêîâ
// ñòàâèì â î÷åðåäü íà âîñïðîèçâåäåíèå ñ 10 òðåêà ïî 1
C := 0;
D.First;
while not D.EOF do
begin
C := C + 1;
WriteLn('#'+IntToStr(C)+'. '+D['artist']+' - '+D['title']);
Queue.AddFile(D['filename'],ipTop);
D.Next;
// ----------------------------------------------------------------- (7-8 ñåê. ôîíîâûé äæèíãë - Æåëàòåëüíî èç óäàðíûõ èíñòðóìåíòîâ)
Queue.AddFile('D:\Music MP3\iradio\Zastavki\zvuki\prokrutka_lenty_2.mp3',ipTop); // äæèíãë - äëÿ êðàñèâîãî ýôôåêòà ïåðåõîäà îò òðåêà ê òðåêó
end;
Queue.AddFile('D:\Music MP3\iradio\Zastavki\peredachi\top10\top10_anons_mix.mp3',ipTop); // ãîëîñ âåäóùåãî î íà÷àëå Õèò-ïàðàäà
// -----------------------------------------------------------------------------
PAL.WaitForTime(T['+00:01:00']); // çàäåðæêà 1 ìèí. îò ïîâòîðíîãî çàïóñêà
end;
После установки SB 2019 и MySQL 8.0 перестал а грамотно работать связка
D := Query('SELECT songlist.*, count(*) as cnt '+
'FROM songlist,requestlist '+
'WHERE (songlist.ID = requestlist.songID) '+
' AND (requestlist.code < 700) '+
'GROUP BY songlist.ID '+
'ORDER BY songlist.count_requested DESC, songlist.date_played DESC, cnt DESC LIMIT 10',[],True)
Выводит один и тот же список топа на востроизведение, но он не соотвествует реальному списку в здесь -> http://www.rsgiradio.ru/top10/
Кто в теме, помогите исправить данную ситуацию с запросом.
Заранее спасибо.
РS...
Для понимания.
Сама страничка чуточку переделана -> http://www.rsgiradio.ru/iradio/web/playing_tr.php
Запрос оригинала в Java выглядит так:
<!-- BEGIN:TOP_REQUESTS -->
<?php if (ALLOW_REQUESTS && SHOW_TOP_REQUESTS && is_array($topRequestedSongs) && count($topRequestedSongs) > 0): ?>
<div id="top_requests">
<dl>
<dt>Top Requested</dt>
<?php
$counter = 1;
foreach ($topRequestedSongs as $topRequestedSong): ?>
<dd>
<a href="javascript:songinfo(<?php echo $topRequestedSong->ID; ?>)" title="<?php echo $topRequestedSong->artist_title; ?>">
<?php echo $counter++;?>. <?php echo $topRequestedSong->title; ?>
<?php if(!empty($topRequestedSong->artist)) : ?><br /> by <?php echo $topRequestedSong->artist; ?><?php endif; ?>
(<?php echo $topRequestedSong->cnt; ?>)
</a>
</dd>
<?php endforeach; ?>
</dl>
</div>
<?php endif; ?>
<!-- END:TOP_REQUESTS -->
Даю ниже html код, может поможет для изменения SQL запроса выше.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php echo STATION_NAME; ?> - Èíôîðìàöèîííî-ìóçûêàëüíûé ïîðòàë î õóäîæåñòâåííîé ãèìíàñòèêè</title>
<link rel="SHORTCUT ICON" href="../image.files/phg.ico" type="image/x-icon">
<!-- General styles of the samPHPweb pages -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="styles/style_w.css" />
<!-- Common Javascript functions -->
<script type="text/javascript" src="js/common.js"></script>
<?php if (ALLOW_REQUESTS) : ?>
<!-- Javascript for request and songinfo actions -->
<script type="text/javascript">
/**
* Open a popup window to send a song request to SAM
*/
function request(songID)
{
<?php if(PRIVATE_REQUESTS): ?>
requestPrivate(songID);
<?php else: ?>
var samhost = "<? echo SAM_HOST; ?>";
var samport = "<? echo SAM_PORT; ?>";
requestAudioRealm(songID, samhost, samport);
<?php endif; ?>
}
</script>
<?php endif; ?>
<!-- AddThis javascript -->
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=spacialaudio"></script>
<!-- JQuery library to do cool Javascript stuff -->
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<!-- JQuery plugin for Cross-Browser compatible rounding of corners -->
<script type="text/javascript" src="js/jquery.corner.js"></script>
<script language=javascript>
function glossary(param,w,h,t,l)
{ par=' width=600,height=600,top=0,scrollbars=1';
var glossary = window.open(param, 'glossary', par);
glossary.focus(); }
function ask(param) {
par=' width=600,height=600,scrollbars=0';
var ask = window.open(param, 'ask', par);
ask.focus(); }
function popup(urla,w,h) {
var popup = window.open(urla, 'popup', 'width='+w+',height='+h+',top=0,scrollbars=1');
popup.focus(); }
function godestination() {
if (document.destination.selector.options
[document.destination.selector.selectedIndex].value != '')
document.location.href=document.destination.selector.options
[document.destination.selector.selectedIndex].value; }
</script>
<script LANGUAGE="JavaScript" type="text/javascript">
function ratesong(rating, songid)
{
var ratesong;
if (ratesong) {
ratesong++;
}
else {
ratesong=0;
}
ratesong = window.open("./ratesong.php?rating="+rating+"&checkid="
+songid, "ratesongwin", "location=no,status=no,menubar=no,scrollbars
=no,resizeable=yes,height=305,width=290");
}
</script>
</head>
<body>
<!-- BEGIN:PAGE -->
<div id="page">
<?php require_once('display.header_tr.php'); ?>
<?php
$counter = 1;
foreach ($topRequestedSongs as $topRequestedSong): ?>
<?php endforeach; ?>
<?php if(is_array($recentSongs) && count($recentSongs)>0) : ?>
<!-- BEGIN:RECENTLY PLAYED -->
<div id="recently_played_wrapper">
<div id="recently_played">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th align="left">
меÑто
</th>
<th colspan="2" align="center">
иÑполнитель
</th>
<th class="links" align="center">
ÑÑылки
</th>
<th align="left">
альбом
</th>
<th align="right">
времÑ
</th>
</tr>
</thead>
<tbody>
<?php foreach ($topRequestedSongs as $key => $topRequestedSongs): ?>
<tr>
<td>
<?php echo $counter++;?>.
</td>
<td>
<?php if(SHOW_PICTURES && !empty($topRequestedSongs->picture)) : ?>
<a href="<?php echo $topRequestedSongs->buycd; ?>" target="_blank">
<img class="rpPicture" id="rpPicture<?php echo $key; ?>" onload="showPicture(this, <?php echo SHOW_PICTURES; ?>)" width="60" height="60" src="<?php echo $topRequestedSongs->picture; ?>" alt="Buy CD!" title="Buy CD!" />
</a>
<?php endif; ?>
</td>
<td>
<?php $string = "$topRequestedSongs->artist_title"; ## Ñòàðîå çíà÷åíèå: echo $topRequestedSongs->artist_title; ##
$string = iconv('utf-8', 'cp1252', $string);
$string = iconv('cp1251', 'utf-8', $string);
echo $string; ?>
</td>
<td align="center">
<?php if (ALLOW_REQUESTS) : ?>
<a href="javascript:request(<?php echo $topRequestedSongs->ID; ?>);">
<img src="images/request.png" alt="Request this track now!" title="Request this track now!"/>
</a>
<?php endif; ?>
<a href="<?php echo $topRequestedSongs->website; ?>" target="_blank">
<img src="images/home.png" alt="Artist homepage" title="Artist homepage" />
</a>
<a href="javascript:songinfo(<?php echo $topRequestedSongs->ID; ?>)">
<img src="images/info.png" alt="Track information" title="Track information" />
</a>
</td>
<td>
<?php $string = "$topRequestedSongs->album"; ## Ñòàðîå çíà÷åíèå: echo $topRequestedSongs->album; ##
$string = iconv('utf-8', 'cp1252', $string);
$string = iconv('cp1251', 'utf-8', $string);
echo $string; ?>
</td>
<td align="right">
<?php echo $topRequestedSongs->durationDisplay; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!-- END:RECENTLY PLAYED -->
<?php endif; ?>
<?php require_once('display.footer.php'); ?>
</div>
<!-- END:PAGE -->
<!-- JQuery to round corners some of the HTML items on the page -->
<script type="text/javascript">
//<![CDATA[
// Make sure the DOM is ready
$(document).ready(function() {
// Rounding of corners (Cross-browser compatible)
// See http://jquery.malsup.com/corner/ for different Styles.
// Rounds the page corners
$('#page').corner();
// Rounds the Navigation Menu Corners
$('#navigation dl').corner();
// Rounds the Currently Playing Table Corners
$('#currently_playing').corner();
// Rounds the Coming Up Corners
$('#coming-up').corner();
// Rounds the Recently Played Table Corners
$('#recently_played').corner();
// Style odd and even rows in Currently Playing Table (Cross-browser compatible)
$('#recently_played table tbody tr:nth-child(odd)').addClass('recently_played_odd');
$('#recently_played table tbody tr:nth-child(even)').addClass('recently_played_even');
// Round the Dedication Corners
$('#dedication dl').corner('tl tr').corner();
// Round the Top Request Corners
$('#top_requests dl').corner();
});
//]]>
</script>
</body>
</html>
Отредактировано wwc (27-04-2020 19:43:50)