🔨 Remove Playlist search on web

This commit is contained in:
SebClem 2020-10-31 16:33:48 +01:00
parent 6cffd0ff73
commit eafc4b6170
3 changed files with 15 additions and 22 deletions

View File

@ -189,14 +189,12 @@ public class MusicWebAPIController {
} }
@RequestMapping(value = "/search", method = RequestMethod.GET) @RequestMapping(value = "/search", method = RequestMethod.GET)
public ResponseEntity<List<SearchResult>> search(@CookieValue(name = "token", defaultValue = "") String token, @RequestParam(value = "query") String query, @RequestParam(value = "playlist") boolean playlist) { public ResponseEntity<List<SearchResult>> search(@CookieValue(name = "token", defaultValue = "") String token, @RequestParam(value = "query") String query) {
if (token != null && !token.isEmpty()) { if (token != null && !token.isEmpty()) {
try { try {
UserEntity user = userUtils.getUserWithApiToken(userRepository, token); UserEntity user = userUtils.getUserWithApiToken(userRepository, token);
// YoutubeTools youtubeTools = YoutubeTools.getInstance();
// ArrayList<SearchResult> result = youtubeTools.search(query, 25, playlist);
YoutubeSearchRework youtubeSearch = YoutubeSearchRework.getInstance(); YoutubeSearchRework youtubeSearch = YoutubeSearchRework.getInstance();
List<SearchResult> result = youtubeSearch.searchVideo(query, 25, playlist); List<SearchResult> result = youtubeSearch.searchVideo(query, 25, false);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} catch (UnknownTokenException e) { } catch (UnknownTokenException e) {

View File

@ -431,14 +431,9 @@ function search() {
load.removeClass("hide"); load.removeClass("hide");
load.addClass("scale-in"); load.addClass("scale-in");
$.get("/api/music/search?query=" + input_search.val() + "&playlist=" + $("#playlistSearch").is(':checked'), (data) => { $.get("/api/music/search?query=" + input_search.val(), (data) => {
list.empty(); list.empty();
let url; let url = "https://youtube.com/watch?v=";
if($("#playlistSearch").is(':checked')){
url = "https://www.youtube.com/playlist?list="
}
else
url = "https://youtube.com/watch?v=";
data.forEach((item) => { data.forEach((item) => {

View File

@ -253,17 +253,17 @@
<button class="btn waves-effect waves-light green darken-4 white-text" id="btn_search" <button class="btn waves-effect waves-light green darken-4 white-text" id="btn_search"
type="button"><i class="material-icons">search</i></button> type="button"><i class="material-icons">search</i></button>
</div> </div>
<div class="col l1 m1 s2 center" style="padding: 0; margin-top: 15px;"> <!-- <div class="col l1 m1 s2 center" style="padding: 0; margin-top: 15px;">-->
<div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px"> <!-- <div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">-->
Playlist <!-- Playlist-->
</div> <!-- </div>-->
<div class="row switch"> <!-- <div class="row switch">-->
<label> <!-- <label>-->
<input type="checkbox" id="playlistSearch"/> <!-- <input type="checkbox" id="playlistSearch"/>-->
<span class="lever"></span> <!-- <span class="lever"></span>-->
</label> <!-- </label>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> </div>
<div class="row"> <div class="row">