diff --git a/ajax-track-version.php b/ajax-track-version.php index 4e43ee5..04c5437 100644 --- a/ajax-track-version.php +++ b/ajax-track-version.php @@ -1,7 +1,7 @@ '; if ($cfg['access_add']) echo ''; - if ($cfg['access_play']) echo ''; + if ($cfg['access_play']) echo ''; echo ''; } diff --git a/index.php b/index.php index f273ebd..aaf0b65 100644 --- a/index.php +++ b/index.php @@ -796,7 +796,11 @@ function view2() { - + @@ -808,7 +812,7 @@ function view2() { + $resultsFound = true; + $TA_ids = ($TA_ids == '' ? $track['tid'] : $TA_ids . ';' . $track['tid']); +?>
+ + ';?> + + Track artist  Title  Album 
@@ -854,10 +860,10 @@ function view2() { $exploded = multiexplode($cfg['artist_separator'],$track['track_artist']); $l = count($exploded); if ($l > 1) { - for ($i=0; $i<$l; $i++) { - $artist = $artist . '' . html($exploded[$i]) . ''; - if ($i != $l - 1) { - $delimiter = getInbetweenStrings($exploded[$i],$exploded[$i + 1], $track['track_artist']); + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $track['track_artist']); $artist = $artist . '' . $delimiter[0] . ''; } } @@ -926,11 +932,34 @@ function view2() { "; - echo ""; - echo ''; +?> +
+ + + + - + + + ';?> + + Track artist  Title  Album  + Genre  Time @@ -985,10 +1019,10 @@ function view2() { + $resultsFound = true; + $FAV_ids = ($FAV_ids == '' ? $track['tid'] : $FAV_ids . ';' . $track['tid']); +?> @@ -1014,7 +1050,26 @@ function view2() { - 1) echo '' . html($track['track_artist']) . ''; else echo html($track['track_artist']); ?> + + 1) { + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $track['track_artist']); + $artist = $artist . '' . $delimiter[0] . ''; + } + } + echo $artist; + } + else { + echo '' . html($track['track_artist']) . ''; + } + ?> + ' . html($track['title']) . ''; elseif ($cfg['access_add']) echo '' . html($track['title']) . ''; @@ -1024,6 +1079,18 @@ function view2() { > + 0) { + foreach($album_genres as $g_id => $ag) { + ?> +
+ + + "; - echo ""; - echo ''; +?> + + + + + 1) { - for ($i=0; $i<$l; $i++) { - $artist = $artist . '' . html($exploded[$i]) . ''; - if ($i != $l - 1) { - $delimiter = getInbetweenStrings($exploded[$i],$exploded[$i + 1], $album['artist']); + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $album['artist']); $artist = $artist . '' . $delimiter[0] . ''; } } @@ -1432,6 +1524,19 @@ function view3() { + +
+
Album DR: +
+
+ +
+
+ +
File type: @@ -2105,7 +2210,26 @@ function view3all() { - 1) echo '' . html($track['track_artist']) . ''; else echo html($track['track_artist']); ?> + + 1) { + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $track['track_artist']); + $artist = $artist . '' . $delimiter[0] . ''; + } + } + echo $artist; + } + else { + echo '' . html($track['track_artist']) . ''; + } + ?> + ' . html($track['title']) . ''; elseif ($cfg['access_add']) echo '' . html($track['title']) . ''; @@ -2733,6 +2857,14 @@ function viewNewStartPage() { request.always(function() { $('#iframeRefresh').addClass("icon-anchor"); $('#iframeRefresh').removeClass("icon-selected fa-spin"); + $('#suggested_container [id^="add_"]').click(function(){ + $(this).removeClass('fa-plus-circle').addClass('fa-cog fa-spin icon-selected'); + }); + + $('#suggested_container [id^="play_"]').click(function(){ + $(this).removeClass('fa-play-circle-o').addClass('fa-cog fa-spin icon-selected'); + }); + }); }); diff --git a/javascript-src/arts.functions.js b/javascript-src/arts.functions.js index a30b0e2..7c30ee2 100644 --- a/javascript-src/arts.functions.js +++ b/javascript-src/arts.functions.js @@ -139,6 +139,7 @@ function evaluateAdd(data) { if (data.file_id) {data.album_id = data.file_id}; if (data.random) {data.album_id = 'random'}; if (data.disc) {data.album_id = data.album_id + '_' + data.disc}; + if (data.addType) {data.album_id = data.addType}; if (data.album_id) { if (data.addResult == 'add_OK') { $('[id="add_' + data.album_id +'"]').removeClass('fa-cog fa-spin icon-selected').addClass('fa-check-square icon-ok'); diff --git a/play.php b/play.php index c42819d..9a4e698 100644 --- a/play.php +++ b/play.php @@ -46,6 +46,7 @@ elseif ($action == 'playSelect') playSelect(); elseif ($action == 'addSelect') addSelect(); elseif ($action == 'addSelectUrl') addSelectUrl(); +elseif ($action == 'addMultitrack') addMultitrack(); elseif ($action == 'insertSelect') insertSelect(); elseif ($action == 'seekImageMap') seekImageMap(); elseif ($action == 'playIndex') playIndex(); @@ -317,6 +318,52 @@ function addSelect() { //return 'add_OK'; } + + + +// +------------------------------------------------------------------------+ +// | Add multitrack | +// +------------------------------------------------------------------------+ +function addMultitrack() { + global $cfg, $db; + authenticate('access_add'); + require_once('include/play.inc.php'); + + $track_ids = explode(';', get('track_ids')); + $addType = get('addType'); + $data = array(); + $addResult = 'add_error'; + + + $status = mpd('status'); + if ($cfg['add_autoplay'] && $status['playlistlength'] == 0) { + $addResult = addTracks('play', '', '', $track_ids[0]); + if (count($track_ids) > 1) { + foreach($track_ids as $key => $value) { + if ($key > 0) { + $addResult = addTracks('add', '', '', $value); + } + } + } + } + else { + foreach($track_ids as $value) { + $addResult = addTracks('add', '', '', $value); + } + } + + $data['addResult'] = $addResult; + $data['addType'] = $addType; + + ob_start(); + echo safe_json_encode($data); + header('Connection: close'); + header('Content-Length: ' . ob_get_length()); + ob_end_flush(); + ob_flush(); + flush(); +} + // +------------------------------------------------------------------------+ // | Add select url | // +------------------------------------------------------------------------+ @@ -400,10 +447,10 @@ function insertSelect() { // +------------------------------------------------------------------------+ // | Add tracks | // +------------------------------------------------------------------------+ -function addTracks($mode = 'play', $insPos = '', $playAfterInsert = '') { +function addTracks($mode = 'play', $insPos = '', $playAfterInsert = '', $track_id = '') { global $cfg, $db; - $track_id = get('track_id'); + $track_id = ($track_id == '' ? get('track_id') : $track_id); $album_id = get('album_id'); $disc = get('disc'); $filepath = get('filepath'); @@ -417,7 +464,7 @@ function addTracks($mode = 'play', $insPos = '', $playAfterInsert = '') { if ($track_id) { - $query = mysqli_query($db,'SELECT relative_file FROM track WHERE track_id = "' . mysqli_real_escape_string($db,$track_id) . '"'); + $query = mysqli_query($db,'SELECT relative_file, track_id FROM track WHERE track_id = "' . mysqli_real_escape_string($db,$track_id) . '"'); } elseif ($album_id) { $select_md = ''; @@ -1642,6 +1689,7 @@ function playlistTrack() { $data['track_artist'] = $exploded; $data['track_artist_url'] = $exploded; $data['track_artist_url_all'] = (string) rawurlencode($currentsong['Artist']); + $data['track_artist_all'] = (string) ($currentsong['Artist']); $data['title'] = (string) $title; $data['album'] = (string) $album; $data['by'] = (string) ''; diff --git a/search.php b/search.php index 6cf41ef..5317eb9 100644 --- a/search.php +++ b/search.php @@ -1,4 +1,4 @@ - - + + + ';?> + + Track artist  Title  Album  @@ -220,6 +224,7 @@ function track_artist() { + while ($track = mysqli_fetch_assoc($query)) { + $TA_ids = ($TA_ids == '' ? $track['tid'] : $TA_ids . ';' . $track['tid']); + ?> @@ -271,10 +278,10 @@ function track_artist() { $exploded = multiexplode($cfg['artist_separator'],$track['track_artist']); $l = count($exploded); if ($l > 1) { - for ($i=0; $i<$l; $i++) { - $artist = $artist . '' . html($exploded[$i]) . ''; - if ($i != $l - 1) { - $delimiter = getInbetweenStrings($exploded[$i],$exploded[$i + 1], $track['track_artist']); + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $track['track_artist']); $artist = $artist . '' . $delimiter[0] . ''; } } @@ -356,6 +363,29 @@ function track_artist() { } echo ""; echo "
"; + + + ?> + + 0) { $match_found = true; - if ($group_found == 'none') $group_found = 'TT'; + if ($group_found == 'none') $group_found = 'TT'; ?>

Track title ( 1) { echo $rows . " matches found"; @@ -447,7 +477,11 @@ function track_title() { - + @@ -459,7 +493,7 @@ function track_title() { + while ($track = mysqli_fetch_assoc($query)) { + $TT_ids = ($TT_ids == '' ? $track['tid'] : $TT_ids . ';' . $track['tid']); + ?>
+ + ';?> + + Track artist  Title  Album 
@@ -508,10 +544,10 @@ function track_title() { $exploded = multiexplode($cfg['artist_separator'],$track['track_artist']); $l = count($exploded); if ($l > 1) { - for ($i=0; $i<$l; $i++) { - $artist = $artist . '' . html($exploded[$i]) . ''; - if ($i != $l - 1) { - $delimiter = getInbetweenStrings($exploded[$i],$exploded[$i + 1], $track['track_artist']); + for ($j=0; $j<$l; $j++) { + $artist = $artist . '' . html($exploded[$j]) . ''; + if ($j != $l - 1) { + $delimiter = getInbetweenStrings($exploded[$j],$exploded[$j + 1], $track['track_artist']); $artist = $artist . '' . $delimiter[0] . ''; } } @@ -581,6 +617,24 @@ function track_title() { } echo "
"; echo "

"; +?> + + - - + + + @@ -191,11 +192,7 @@ function playlistAction(action) { }); }; -function addClick(){ - $('[id^="add_"]').click(function(){ - $(this).removeClass('fa-plus-circle').addClass('fa-cog fa-spin icon-selected'); - }); -}; + $(document).ready(function () {