mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 10:49:37 +02:00
Allow several time the same songs in Recently Played (fix #186)
This commit is contained in:
parent
469c8759f2
commit
8ff0728a3d
4 changed files with 18 additions and 14 deletions
|
@ -161,8 +161,8 @@ class Random implements media
|
||||||
|
|
||||||
// Get the last album playbed by us
|
// Get the last album playbed by us
|
||||||
$data = $GLOBALS['user']->get_recently_played('1','album');
|
$data = $GLOBALS['user']->get_recently_played('1','album');
|
||||||
if ($data['0']) {
|
if ($data[0]) {
|
||||||
$where_sql = " AND `song`.`album`='" . $data['0'] . "' ";
|
$where_sql = " AND `song`.`album`='" . $data[0] . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT `song`.`id` FROM `song` ";
|
$sql = "SELECT `song`.`id` FROM `song` ";
|
||||||
|
@ -193,8 +193,8 @@ class Random implements media
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
$data = $GLOBALS['user']->get_recently_played('1','artist');
|
$data = $GLOBALS['user']->get_recently_played('1','artist');
|
||||||
if ($data['0']) {
|
if ($data[0]) {
|
||||||
$where_sql = " AND `song`.`artist`='" . $data['0'] . "' ";
|
$where_sql = " AND `song`.`artist`='" . $data[0] . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT `song`.`id` FROM `song` ";
|
$sql = "SELECT `song`.`id` FROM `song` ";
|
||||||
|
|
|
@ -1036,8 +1036,7 @@ class Song extends database_object implements media
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
if (isset($results[$row['object_id']])) { continue; }
|
$results[] = $row;
|
||||||
$results[$row['object_id']] = $row;
|
|
||||||
if (count($results) >= AmpConfig::get('popular_threshold')) { break; }
|
if (count($results) >= AmpConfig::get('popular_threshold')) { break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ $(document).ajaxComplete(function () {
|
||||||
// Post the contents of a form.
|
// Post the contents of a form.
|
||||||
function ajaxPost(url, input, source) {
|
function ajaxPost(url, input, source) {
|
||||||
if ($(source)) {
|
if ($(source)) {
|
||||||
$(source).off('click', function(){ ajaxPost(url, input, source); });
|
$(source).off('click');
|
||||||
}
|
}
|
||||||
$.ajax(url, { success: processContents, type: 'post', data: $('#'+input).serialize() });
|
$.ajax(url, { success: processContents, type: 'post', data: $('#'+input).serialize() });
|
||||||
} // ajaxPost
|
} // ajaxPost
|
||||||
|
@ -36,7 +36,7 @@ function ajaxPost(url, input, source) {
|
||||||
// Get response from the specified URL.
|
// Get response from the specified URL.
|
||||||
function ajaxPut(url, source) {
|
function ajaxPut(url, source) {
|
||||||
if ($(source)) {
|
if ($(source)) {
|
||||||
$(source).off('click', function(){ ajaxPut(url, source); });
|
$(source).off('click');
|
||||||
}
|
}
|
||||||
$.ajax(url, { success: processContents, type: 'post', dataType: 'xml' });
|
$.ajax(url, { success: processContents, type: 'post', dataType: 'xml' });
|
||||||
} // ajaxPut
|
} // ajaxPut
|
||||||
|
|
|
@ -37,7 +37,9 @@ UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($data as $row) {
|
<?php
|
||||||
|
$nb = 0;
|
||||||
|
foreach ($data as $row) {
|
||||||
$row_user = new User($row['user']);
|
$row_user = new User($row['user']);
|
||||||
$song = new Song($row['object_id']);
|
$song = new Song($row['object_id']);
|
||||||
|
|
||||||
|
@ -92,9 +94,9 @@ UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
|
||||||
<span class="cel_play_content"> </span>
|
<span class="cel_play_content"> </span>
|
||||||
<div class="cel_play_hover">
|
<div class="cel_play_hover">
|
||||||
<?php if (AmpConfig::get('directplay')) { ?>
|
<?php if (AmpConfig::get('directplay')) { ?>
|
||||||
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id,'play', T_('Play'),'play_song_' . $song->id); ?>
|
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id,'play', T_('Play'),'play_song_' . $nb . '_' . $song->id); ?>
|
||||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||||
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $song->id); ?>
|
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $nb . '_' . $song->id); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,8 +104,8 @@ UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
|
||||||
<td class="cel_song"><?php echo $song->f_link; ?></td>
|
<td class="cel_song"><?php echo $song->f_link; ?></td>
|
||||||
<td class="cel_add">
|
<td class="cel_add">
|
||||||
<span class="cel_item_add">
|
<span class="cel_item_add">
|
||||||
<?php echo Ajax::button('?action=basket&type=song&id='.$song->id, 'add', T_('Add to temporary playlist'), 'add_'.$song->id); ?>
|
<?php echo Ajax::button('?action=basket&type=song&id='.$song->id, 'add', T_('Add to temporary playlist'), 'add_' . $nb . '_'.$song->id); ?>
|
||||||
<a id="<?php echo 'add_playlist_'.$song->id ?>" onclick="showPlaylistDialog(event, 'song', '<?php echo $song->id ?>')">
|
<a id="<?php echo 'add_playlist_' . $nb . '_'.$song->id ?>" onclick="showPlaylistDialog(event, 'song', '<?php echo $song->id ?>')">
|
||||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -122,7 +124,10 @@ UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
|
||||||
} ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php
|
||||||
|
++$nb;
|
||||||
|
}
|
||||||
|
?>
|
||||||
<?php if (!count($data)) { ?>
|
<?php if (!count($data)) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="8"><span class="nodata"><?php echo T_('No recently item found'); ?></span></td>
|
<td colspan="8"><span class="nodata"><?php echo T_('No recently item found'); ?></span></td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue