37 lines
1.2 KiB
PHP
37 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_topartists($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 name,COUNT(artist) AS plays FROM Scrobbles WHERE time > '.strtotime("-3 month").' GROUP BY artist ORDER BY COUNT(artist) 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(topartists, $data);
|
||
|
}
|
||
|
?>
|