forked from adilson0888/lastfm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lastfm.php
73 lines (57 loc) · 2.27 KB
/
lastfm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
error_reporting(1);
include 'functions.php';
//Handler Section
$handler = isset($_GET['oper']) ? $_GET['oper'] : "";
switch ($handler) {
case 'tags':
returnArtistTag();
break;
default:
$totalArtists = getTotalArtists();
$sections = defineSections($totalArtists);
ob_start();
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-music" aria-hidden="true"></span>
04 - Results
</h3>
</div>
<div class="panel-body">
<table class="table table-striped">
<tbody>
<?php
$artists_general_list = array();
foreach ($_REQUEST["tunning"] as $key => $value) :
//Não serão feitas requisições para categorias não desejadas
if($value <= 0 ) continue;
$xml = getResults(getenv("LASTFM_PAGELIMIT"), rand($sections[$key][0], $sections[$key][1]));?>
<?php
$artists = $xml->artists->artist;
$toKeep = randomGen(0, getenv("LASTFM_PAGELIMIT") -1, $value);
?>
<?php foreach( $toKeep as $index ) : ?>
<tr>
<?php $artistUrl = "tasker://".stripAccents($artists[$index]->name); ?>
<td><a href="<?=$artistUrl?>"><img src="<?php echo !empty(strval($artists[$index]->image[1])) ? strval($artists[$index]->image[1]) : $noimage ?>"></a></td>
<td>
<?php if(strlen($artists[$index]->name) > 0) : ?>
<a href="<?=$artistUrl?>" class="artistTitle"><?=$artists[$index]->name?></a><br/>
<span class="glyphicon glyphicon-fire" aria-hidden="true"></span>
<span style="font-size:15px;"><?=$artists[$index]->playcount?></span><br/>
<div class="tags-area" id="<?=$artists[$index]->mbid ?>"></div>
<?php endif ; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach ; ?>
</tbody>
</table>
</div>
</div>
<?php return ob_end_flush();
break;
}
?>