mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
New parameter to hide directplay/playlist if number of items is above the limit.
This commit is contained in:
parent
c5365fd2b3
commit
1684b0535b
8 changed files with 128 additions and 30 deletions
|
@ -445,6 +445,9 @@ class Update
|
|||
|
||||
$update_string = '- Add session_remember table to store remember tokens.<br />';
|
||||
$version[] = array('version' => '370015','description' => $update_string);
|
||||
|
||||
$update_string = '- Add limit of media count for direct play preference.<br />';
|
||||
$version[] = array('version' => '370016','description' => $update_string);
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
@ -2952,4 +2955,23 @@ class Update
|
|||
$retval = Dba::write($sql) ? $retval : false;
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* update 370016
|
||||
*
|
||||
* Add limit of media count for direct play preference
|
||||
*/
|
||||
public static function update_370016()
|
||||
{
|
||||
$retval = true;
|
||||
|
||||
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
||||
"VALUES ('direct_play_limit','0','Limit direct play to maximum media count',25,'integer','interface')";
|
||||
$retval = Dba::write($sql) ? $retval : false;
|
||||
$id = Dba::insert_id();
|
||||
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
|
||||
$retval = Dba::write($sql, array($id)) ? $retval : false;
|
||||
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,17 @@ if ($album->disk) {
|
|||
$title .= "<span class=\"discnb disc" . $album->disk . "\">, " . T_('Disk') . " " . $album->disk . "</span>";
|
||||
}
|
||||
$title .= ' - ' . (($album->f_album_artist_link) ? $album->f_album_artist_link : $album->f_artist_link);
|
||||
|
||||
$show_direct_play = AmpConfig::get('directplay');
|
||||
$show_playlist_add = true;
|
||||
$directplay_limit = AmpConfig::get('direct_play_limit');
|
||||
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($album->song_count <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php UI::show_box_top($title,'info-box'); ?>
|
||||
<div class="item_right_info">
|
||||
|
@ -62,18 +73,20 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
<ul>
|
||||
<?php if (AmpConfig::get('directplay')) { ?>
|
||||
<?php if ($show_direct_play) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'),'play', T_('Play'),'directplay_full_' . $album->id); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), T_('Play'),'directplay_full_text_' . $album->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', T_('Play last'),'addplay_album_text_' . $album->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($show_playlist_add) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'),'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>
|
||||
<?php echo Ajax::text('?action=basket&type=album&' . $album->get_http_album_query_ids('id'), T_('Add to temporary playlist'), 'play_full_text_' . $album->id); ?>
|
||||
|
@ -82,6 +95,7 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php echo Ajax::button('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'),'random', T_('Random to temporary playlist'),'play_random_' . $album->id); ?>
|
||||
<?php echo Ajax::text('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), T_('Random to temporary playlist'), 'play_random_text_' . $album->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<a onclick="submitNewItemsOrder('<?php echo $album->id; ?>', 'reorder_songs_table_<?php echo $album->id; ?>', 'song_',
|
||||
'<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=set_track_numbers', 'refresh_album_songs')">
|
||||
|
|
|
@ -25,6 +25,18 @@ $web_path = AmpConfig::get('web_path');
|
|||
$album->allow_group_disks = true;
|
||||
// Title for this album
|
||||
$title = scrub_out($album->name) . ' (' . $album->year . ') - ' . $album->f_artist_link;
|
||||
|
||||
$show_direct_play_cfg = AmpConfig::get('directplay');
|
||||
$show_playlist_add = true;
|
||||
$show_direct_play = $show_direct_play_cfg;
|
||||
$directplay_limit = AmpConfig::get('direct_play_limit');
|
||||
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($album->song_count <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php UI::show_box_top($title, 'info-box'); ?>
|
||||
<div class="item_right_info">
|
||||
|
@ -43,18 +55,19 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') - ' .
|
|||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
<ul>
|
||||
<?php if (AmpConfig::get('directplay')) { ?>
|
||||
<?php if ($show_direct_play) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), 'play', T_('Play'), 'directplay_full_'); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), T_('Play'), 'directplay_full_text_'); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_'); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', T_('Play last'), 'addplay_album_text_'); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($show_playlist_add) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'), 'add', T_('Add to temporary playlist'), 'play_full_'); ?>
|
||||
<?php echo Ajax::text('?action=basket&type=album&' . $album->get_http_album_query_ids('id'), T_('Add to temporary playlist'), 'play_full_text_'); ?>
|
||||
|
@ -63,6 +76,7 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') - ' .
|
|||
<?php echo Ajax::button('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'play_random_'); ?>
|
||||
<?php echo Ajax::text('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), T_('Random to temporary playlist'), 'play_random_text_'); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (Access::check_function('batch_download')) { ?>
|
||||
<li>
|
||||
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
|
||||
|
@ -81,18 +95,28 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') - ' .
|
|||
$c_album = new Album($album_id);
|
||||
$c_album->format();
|
||||
$c_title = scrub_out($c_album->name) . " <span class=\"discnb disc" . $c_album->disk . "\">, " . T_('Disk') . " " . $c_album->disk . "</span>";
|
||||
$show_direct_play = $show_direct_play_cfg;
|
||||
$show_playlist_add = true;
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($c_album->song_count <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="album_group_disks_title"><span> <?php echo $c_title; ?></span></div>
|
||||
<div class="album_group_disks_actions">
|
||||
<?php
|
||||
if (AmpConfig::get('directplay')) {
|
||||
if ($show_direct_play) {
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $c_album->get_http_album_query_ids('object_id'), 'play', T_('Play'), 'directplay_full_' . $c_album->id);
|
||||
if (Stream_Playlist::check_autoplay_append()) {
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $c_album->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_' . $c_album->id);
|
||||
}
|
||||
}
|
||||
if (Stream_Playlist::check_autoplay_append()) {
|
||||
echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $c_album->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_' . $c_album->id);
|
||||
if ($show_playlist_add) {
|
||||
echo Ajax::button('?action=basket&type=album&' . $c_album->get_http_album_query_ids('id'), 'add', T_('Add to temporary playlist'), 'play_full_' . $c_album->id);
|
||||
echo Ajax::button('?action=basket&type=album_random&' . $c_album->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'play_random_' . $c_album->id);
|
||||
}
|
||||
echo Ajax::button('?action=basket&type=album&' . $c_album->get_http_album_query_ids('id'), 'add', T_('Add to temporary playlist'), 'play_full_' . $c_album->id);
|
||||
echo Ajax::button('?action=basket&type=album_random&' . $c_album->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'play_random_' . $c_album->id);
|
||||
?>
|
||||
<a onclick="submitNewItemsOrder('<?php echo $c_album->id; ?>', 'reorder_songs_table_<?php echo $c_album->id; ?>', 'song_',
|
||||
'<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=set_track_numbers', 'refresh_album_songs')">
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<td class="cel_play">
|
||||
<span class="cel_play_content"> </span>
|
||||
<div class="cel_play_hover">
|
||||
<?php if (AmpConfig::get('directplay')) { ?>
|
||||
<?php if ($show_direct_play) { ?>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $libitem->get_http_album_query_ids('object_id'), 'play', T_('Play'), 'play_album_' . $libitem->id); ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $libitem->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_' . $libitem->id); ?>
|
||||
|
@ -44,11 +44,13 @@ if (Art::is_enabled()) {
|
|||
<td class="cel_album"><?php echo $libitem->f_name_link; ?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php echo Ajax::button('?action=basket&type=album&' . $libitem->get_http_album_query_ids('id'), 'add', T_('Add to temporary playlist'), 'add_album_' . $libitem->id); ?>
|
||||
<?php echo Ajax::button('?action=basket&type=album_random&' . $libitem->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'random_album_' . $libitem->id); ?>
|
||||
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'album', '<?php if (!count($libitem->album_suite)) { echo $libitem->id; } else { echo implode(',', $libitem->album_suite); } ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
||||
</a>
|
||||
<?php if ($show_playlist_add) { ?>
|
||||
<?php echo Ajax::button('?action=basket&type=album&' . $libitem->get_http_album_query_ids('id'), 'add', T_('Add to temporary playlist'), 'add_album_' . $libitem->id); ?>
|
||||
<?php echo Ajax::button('?action=basket&type=album_random&' . $libitem->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'random_album_' . $libitem->id); ?>
|
||||
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'album', '<?php if (!count($libitem->album_suite)) { echo $libitem->id; } else { echo implode(',', $libitem->album_suite); } ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="cel_artist"><?php echo (!empty($libitem->f_album_artist_link) ? $libitem->f_album_artist_link : $libitem->f_artist_link); ?></td>
|
||||
|
|
|
@ -51,16 +51,27 @@ $thcount = 8;
|
|||
if (AmpConfig::get('ratings')) { Rating::build_cache('album',$object_ids); }
|
||||
if (AmpConfig::get('userflags')) { Userflag::build_cache('album',$object_ids); }
|
||||
|
||||
$show_direct_play_cfg = AmpConfig::get('directplay');
|
||||
$directplay_limit = AmpConfig::get('direct_play_limit');
|
||||
|
||||
/* Foreach through the albums */
|
||||
foreach ($object_ids as $album_id) {
|
||||
$libitem = new Album($album_id);
|
||||
$libitem->allow_group_disks = $allow_group_disks;
|
||||
$libitem->format();
|
||||
$show_direct_play = $show_direct_play_cfg;
|
||||
$show_playlist_add = true;
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($libitem->song_count <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr id="album_<?php echo $libitem->id; ?>" class="<?php echo UI::flip_class(); ?>">
|
||||
<?php require AmpConfig::get('prefix') . '/templates/show_album_row.inc.php'; ?>
|
||||
</tr>
|
||||
<?php } //end foreach ($albums as $album) ?>
|
||||
<?php }?>
|
||||
<?php if (!count($object_ids)) { ?>
|
||||
<tr class="<?php echo UI::flip_class(); ?>">
|
||||
<td colspan="<?php echo $thcount; ?>"><span class="nodata"><?php echo T_('No album found'); ?></span></td>
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
*/
|
||||
|
||||
$web_path = AmpConfig::get('web_path');
|
||||
$show_direct_play = AmpConfig::get('directplay');
|
||||
$show_playlist_add = true;
|
||||
$directplay_limit = AmpConfig::get('direct_play_limit');
|
||||
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($artist->songs <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
UI::show_box_top($artist->f_name, 'info-box');
|
||||
|
@ -78,18 +88,19 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php echo T_("Show albums"); ?></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php if (AmpConfig::get('directplay')) { ?>
|
||||
<?php if ($show_direct_play) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id,'play', T_('Play all'),'directplay_full_' . $artist->id); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id, T_('Play all'),'directplay_full_text_' . $artist->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<li>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id . '&append=true','play_add', T_('Play all last'),'addplay_artist_' . $artist->id); ?>
|
||||
<?php echo Ajax::text('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id . '&append=true', T_('Play all last'),'addplay_artist_text_' . $artist->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($show_playlist_add) { ?>
|
||||
<li>
|
||||
<?php /* HINT: Artist Fullname */ ?>
|
||||
<?php echo Ajax::button('?action=basket&type=artist&id=' . $artist->id,'add', T_('Add all to temporary playlist'),'add_' . $artist->id); ?>
|
||||
|
@ -100,6 +111,7 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $artist->id,'random', T_('Random all to temporary playlist'),'random_' . $artist->id); ?>
|
||||
<?php echo Ajax::text('?action=basket&type=artist_random&id=' . $artist->id, T_('Random all to temporary playlist'),'random_text_' . $artist->id); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!--<?php if (Access::check('interface','50')) { ?>
|
||||
<li>
|
||||
<a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&artist=<?php echo $artist->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('cog', T_('Update from tags')); ?></a>
|
||||
|
|
|
@ -23,22 +23,24 @@
|
|||
<td class="cel_play">
|
||||
<span class="cel_play_content"> </span>
|
||||
<div class="cel_play_hover">
|
||||
<?php if (AmpConfig::get('directplay')) { ?>
|
||||
<?php if ($show_direct_play) { ?>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id,'play', T_('Play'),'play_artist_' . $libitem->id); ?>
|
||||
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
|
||||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_artist_' . $libitem->id); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cel_artist"><?php echo $libitem->f_name_link; ?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php echo Ajax::button('?action=basket&type=artist&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_artist_' . $libitem->id); ?>
|
||||
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $libitem->id,'random', T_('Random to temporary playlist'),'random_artist_' . $libitem->id); ?>
|
||||
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'artist', '<?php echo $libitem->id ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
||||
</a>
|
||||
<?php if ($show_playlist_add) { ?>
|
||||
<?php echo Ajax::button('?action=basket&type=artist&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_artist_' . $libitem->id); ?>
|
||||
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $libitem->id,'random', T_('Random to temporary playlist'),'random_artist_' . $libitem->id); ?>
|
||||
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'artist', '<?php echo $libitem->id ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="cel_songs"><?php echo $libitem->songs; ?></td>
|
||||
|
|
|
@ -51,10 +51,21 @@ $thcount = 8;
|
|||
if (AmpConfig::get('ratings')) { Rating::build_cache('artist',$object_ids); }
|
||||
if (AmpConfig::get('userflags')) { Userflag::build_cache('artist',$object_ids); }
|
||||
|
||||
$show_direct_play_cfg = AmpConfig::get('directplay');
|
||||
$directplay_limit = AmpConfig::get('direct_play_limit');
|
||||
|
||||
/* Foreach through every artist that has been passed to us */
|
||||
foreach ($object_ids as $artist_id) {
|
||||
$libitem = new Artist($artist_id, $_SESSION['catalog']);
|
||||
$libitem->format();
|
||||
$libitem = new Artist($artist_id, $_SESSION['catalog']);
|
||||
$libitem->format();
|
||||
$show_direct_play = $show_direct_play_cfg;
|
||||
$show_playlist_add = true;
|
||||
if ($directplay_limit > 0) {
|
||||
$show_playlist_add = ($libitem->songs <= $directplay_limit);
|
||||
if ($show_direct_play) {
|
||||
$show_direct_play = $show_playlist_add;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr id="artist_<?php echo $libitem->id; ?>" class="<?php echo UI::flip_class(); ?>">
|
||||
<?php require AmpConfig::get('prefix') . '/templates/show_artist_row.inc.php'; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue