mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
fixed multi-genre random play
This commit is contained in:
parent
d3840c7de0
commit
ab0e89b8dd
5 changed files with 30 additions and 25 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
v.3.4-Alpha3
|
||||
- Fixed multi-genre Random Play
|
||||
- New Version of Flash player fixes playlist repeat bug (Thx hugoh)
|
||||
- Fixed catalog update and album art dump command line tools
|
||||
- Removed dead link for renaming an Artist
|
||||
|
|
|
@ -266,7 +266,6 @@ class Random {
|
|||
if (is_array($matchlist)) {
|
||||
foreach ($matchlist as $type => $value) {
|
||||
if (is_array($value)) {
|
||||
$where .= "(";
|
||||
foreach ($value as $v) {
|
||||
if (!strlen($v)) { continue; }
|
||||
$v = Dba::escape($v);
|
||||
|
@ -274,7 +273,6 @@ class Random {
|
|||
else { $where .= " AND ( $type='$v'"; }
|
||||
}
|
||||
$where .= ")";
|
||||
$where = rtrim($where,"()");
|
||||
}
|
||||
elseif (strlen($value)) {
|
||||
$value = Dba::escape($value);
|
||||
|
@ -283,7 +281,6 @@ class Random {
|
|||
} // end foreach
|
||||
} // end if matchlist
|
||||
|
||||
|
||||
if ($data['random_type'] == 'full_album') {
|
||||
$query = "SELECT `album`.`id` FROM `song` INNER JOIN `album` ON `song`.`album`=`album`.`id` " .
|
||||
"WHERE $where GROUP BY `song`.`album` ORDER BY RAND() $limit_sql";
|
||||
|
|
11
random.php
11
random.php
|
@ -25,8 +25,17 @@ require_once 'lib/init.php';
|
|||
show_header();
|
||||
|
||||
switch ($_REQUEST['action']) {
|
||||
default:
|
||||
case 'get_advanced':
|
||||
$object_ids = Random::advanced($_POST);
|
||||
|
||||
// We need to add them to the active playlist
|
||||
foreach ($object_ids as $object_id) {
|
||||
$GLOBALS['user']->playlist->add_object($object_id,'song');
|
||||
}
|
||||
// We need to refresh the playlist
|
||||
|
||||
case 'advanced':
|
||||
default:
|
||||
require_once Config::get('prefix') . '/templates/show_random.inc.php';
|
||||
break;
|
||||
} // end switch
|
||||
|
|
|
@ -67,6 +67,9 @@ switch ($_REQUEST['page']) {
|
|||
} // end switch on page
|
||||
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'refresh_rightbar':
|
||||
$results['rightbar'] = ajax_include('rightbar.inc.php');
|
||||
break;
|
||||
/* Controls the editing of objects */
|
||||
case 'show_edit_object':
|
||||
|
||||
|
@ -119,7 +122,6 @@ switch ($_REQUEST['action']) {
|
|||
require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '_row.inc.php';
|
||||
$results[$key] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
case 'edit_object':
|
||||
|
||||
|
@ -184,7 +186,6 @@ switch ($_REQUEST['action']) {
|
|||
require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '_row.inc.php';
|
||||
$results[$key] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
/* Controls Localplay */
|
||||
case 'localplay':
|
||||
|
@ -219,8 +220,6 @@ switch ($_REQUEST['action']) {
|
|||
$results['3514'] = '0x1';
|
||||
break;
|
||||
} // end switch on cmd
|
||||
$xml_doc = xml_from_array($results);
|
||||
echo $xml_doc;
|
||||
break;
|
||||
case 'current_playlist':
|
||||
switch ($_REQUEST['type']) {
|
||||
|
@ -230,7 +229,6 @@ switch ($_REQUEST['action']) {
|
|||
} // end switch
|
||||
|
||||
$results['rightbar'] = ajax_include('rightbar.inc.php');
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
// Handle the users basketcases...
|
||||
case 'basket':
|
||||
|
@ -290,7 +288,6 @@ switch ($_REQUEST['action']) {
|
|||
} // end switch
|
||||
|
||||
$results['rightbar'] = ajax_include('rightbar.inc.php');
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
/* For changing the current play type FIXME:: need to allow select of any type */
|
||||
case 'change_play_type':
|
||||
|
@ -299,8 +296,6 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
/* Uses a drop down, no need to replace text */
|
||||
$results['play_type'] = '';
|
||||
$xml_doc = xml_from_array($results);
|
||||
echo $xml_doc;
|
||||
break;
|
||||
/* reloading the now playing information */
|
||||
case 'reloadnp':
|
||||
|
@ -316,7 +311,6 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$results['recently_played'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
/* Setting ratings */
|
||||
case 'set_rating':
|
||||
|
@ -327,7 +321,6 @@ switch ($_REQUEST['action']) {
|
|||
$key = "rating_" . $_GET['object_id'] . "_" . $_GET['rating_type'];
|
||||
$results[$key] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
/* This can be a positve (1) or negative (-1) vote */
|
||||
case 'vote':
|
||||
|
@ -347,8 +340,6 @@ switch ($_REQUEST['action']) {
|
|||
require_once(conf('prefix') . '/templates/show_tv_playlist.inc.php');
|
||||
$results['tv_playlist'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$xml_doc = xml_from_array($results);
|
||||
echo $xml_doc;
|
||||
break;
|
||||
// Used to change filter/settings on browse
|
||||
case 'browse':
|
||||
|
@ -368,8 +359,6 @@ switch ($_REQUEST['action']) {
|
|||
Browse::show_objects($object_ids);
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$xml_doc = xml_from_array($results);
|
||||
echo $xml_doc;
|
||||
break;
|
||||
case 'page':
|
||||
Browse::set_start($_REQUEST['start']);
|
||||
|
@ -378,7 +367,6 @@ switch ($_REQUEST['action']) {
|
|||
Browse::show_objects();
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
case 'sidebar':
|
||||
switch ($_REQUEST['button']) {
|
||||
|
@ -403,11 +391,13 @@ switch ($_REQUEST['action']) {
|
|||
require_once Config::get('prefix') . '/templates/sidebar.inc.php';
|
||||
$results['sidebar'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
default:
|
||||
$results['rfc3514'] = '0x1';
|
||||
echo xml_from_array($results);
|
||||
break;
|
||||
} // end switch action
|
||||
|
||||
// Go ahead and do the echo
|
||||
echo xml_from_array($results);
|
||||
|
||||
?>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
*/
|
||||
?>
|
||||
<form id="random" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/random.php">
|
||||
<form id="random" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/random.php?action=get_advanced">
|
||||
<?php show_box_top(_('Play Random Selection')); ?>
|
||||
<table class="table-data" cellspacing="0" cellpadding="3">
|
||||
<tr>
|
||||
|
@ -76,12 +76,20 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<?php echo Ajax::text("?page=random&action=advanced_random",_('Enqueue'),'advanced_random_enqueue','random','button'); ?>
|
||||
<input type="submit" value="<?php echo _('Enqueue'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php show_box_bottom(); ?>
|
||||
</form>
|
||||
<div id="browse">
|
||||
|
||||
<?php
|
||||
if (is_array($object_ids)) {
|
||||
Browse::reset_filters();
|
||||
Browse::set_type('song');
|
||||
Browse::save_objects($object_ids);
|
||||
Browse::show_objects();
|
||||
echo Ajax::observe('window','load',Ajax::action('?action=refresh_rightbar','playlist_refresh_load'));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue