36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
/*
|
|
* Smarty plugin
|
|
* -------------------------------------------------------------
|
|
* File: function.artisttracks.php
|
|
* Type: function
|
|
* Name: artisttracks
|
|
* Purpose: outputs an array of tracks by $artist
|
|
* -------------------------------------------------------------
|
|
*/
|
|
function smarty_function_toptracks($params, $template) {
|
|
|
|
/**
|
|
* Retrieves a list of tracks
|
|
*
|
|
* @param string $artist The name of the artist (required)
|
|
* @param string $album The name of the album (optional)
|
|
* @return array artisttracks
|
|
*/
|
|
global $adodb;
|
|
|
|
$query = 'SELECT artist AS artist,track AS name,count(track) AS plays FROM Scrobbles WHERE time > '.strtotime("-3 month").' GROUP BY track ORDER BY COUNT(track) DESC LIMIT 15';
|
|
|
|
$data = $adodb->CacheGetAll(600, $query);
|
|
/*foreach($data as &$item) {
|
|
$item['trackurl'] = Server::getTrackURL($artist, null, $item['track']);
|
|
if (!$item['image']) {
|
|
$item['image'] = $default_album_image;
|
|
} else {
|
|
$item['image'] = resolve_external_url($item['image']);
|
|
}
|
|
}*/
|
|
|
|
$template->assign(toptracks, $data);
|
|
}
|
|
?>
|