Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Update proposal] Yandex Music #198

Closed
llimonix opened this issue May 16, 2024 · 4 comments
Closed

[Update proposal] Yandex Music #198

llimonix opened this issue May 16, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs

Comments

@llimonix
Copy link

llimonix commented May 16, 2024

@Krispeckt
could you change the functionality of getsearch and instead of searching for a track, search for everything. Parse the best match and, depending on the best match, parse and add information. I tried to implement it, but I'm too stupid in java
It looks like this now:
image
I would like it to look like this (example):

	private AudioItem getSearch(String query) throws IOException {
		var json = this.getJson(PUBLIC_API_BASE + "/search?text=" + URLEncoder.encode(query, StandardCharsets.UTF_8) + "&type=all&page=0");
		if (json.isNull() || json.get("result").get("best").isNull()) {
			return AudioReference.NO_TRACK;
		}
		var bestResult = json.get("result").get("best");
		var type = bestResult.get("type").text();
		switch (type) {
			case "track":
				var tracks = this.parseTracks(json.get("result").get("tracks").get("results"));
				if (tracks.isEmpty()) {
					return AudioReference.NO_TRACK;
				}
				return new BasicAudioPlaylist("Yandex Music Search: " + query, tracks, null, true);

			case "album":
				var albumId = bestResult.get("result").get("id").text();
				return this.getAlbum(albumId);

			case "artist":
				var artistId = bestResult.get("result").get("id").text();
				return this.getArtist(artistId);

			case "playlist":
				var userId = bestResult.get("result").get("uid").text();
				var playlistId = bestResult.get("result").get("kind").text();
				return this.getPlaylist(userId, playlistId);

			default:
				return AudioReference.NO_TRACK;
		}
	}
@Krispeckt
Copy link
Contributor

Krispeckt commented May 17, 2024

I can do it differently by using LavaSearch. There you will be able to get a search on the service and determine the best one for you yourself.At the moment Yandex music in the plugin does not support LavaSearch

Perhaps later I'll implement this

@topi314
Copy link
Owner

topi314 commented May 17, 2024

As @Krispeckt said this should be implemented via the LavaSearch API
This would mean you get back search results for all those types(tracks, albums, playlists, artists & text autocomplete). Lavaplayer does not support searching for anything other than tracks

@topi314 topi314 added enhancement New feature or request good first issue Good for newcomers up for grabs labels May 17, 2024
@llimonix
Copy link
Author

I can do it differently by using LavaSearch. There you will be able to get a search on the service and determine the best one for you yourself.At the moment Yandex music in the plugin does not support LavaSearch

Perhaps later I'll implement this

That would be great.

@Krispeckt
Copy link
Contributor

This issue is closed 🥹

@topi314 topi314 closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs
Projects
None yet
Development

No branches or pull requests

3 participants