This repository has been archived on 2024-02-03. You can view files and clone it, but cannot push or open issues or pull requests.
nixtape-theme-lastnixtape/plugins/function.topartists.php

37 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2015-09-28 22:41:12 +02:00
<?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);
}
?>