mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
ok that alot
This commit is contained in:
1 parent
df1a783fde
commit
5f33ee231d
17 files changed
+64
-47
No files matched your search
+15
-3
@@ -300,7 +300,7 @@ class YTUtils extends EventEmitter {
|
||||
|
||||
let tracks = [];
|
||||
if (data.loadType === "search") tracks = data.data ?? [];
|
||||
else if (data.loadType === "track") tracks = [data.data];
|
||||
else if (data.loadType === "track") tracks = data.data ? [data.data] : [];
|
||||
else if (data.loadType === "playlist") tracks = data.data?.tracks ?? [];
|
||||
|
||||
const resultTracks = this._rankTracks(tracks, provider);
|
||||
@@ -335,12 +335,18 @@ class YTUtils extends EventEmitter {
|
||||
}
|
||||
|
||||
// Handle single track
|
||||
if (data.loadType === "track") {
|
||||
if (data.loadType === "track" && data.data) {
|
||||
const video = trackToVideo(data.data);
|
||||
if (!video) return { type: "error", data: "Failed to parse track data." };
|
||||
this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
|
||||
return { type: "video", data: video };
|
||||
}
|
||||
|
||||
if (data.loadType === "track" && !data.data) {
|
||||
this.emit("message", `**Track data was empty for '${query}'.**`);
|
||||
return { type: "error", data: "Empty track data returned." };
|
||||
}
|
||||
|
||||
// Handle search results (take first)
|
||||
if (data.loadType === "search" && data.data?.length) {
|
||||
const bestTrack = this._pickBestTrack(data.data, provider) ?? data.data[0];
|
||||
@@ -383,12 +389,18 @@ class YTUtils extends EventEmitter {
|
||||
}
|
||||
|
||||
// Single track from search
|
||||
if (data.loadType === "track") {
|
||||
if (data.loadType === "track" && data.data) {
|
||||
const video = trackToVideo(data.data);
|
||||
if (!video) return { type: "error", data: "Failed to parse track data." };
|
||||
this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
|
||||
return { type: "video", data: video };
|
||||
}
|
||||
|
||||
if (data.loadType === "track" && !data.data) {
|
||||
this.emit("message", `**Track data was empty for '${query}'.**`);
|
||||
return { type: "error", data: "Empty track data returned." };
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
this.emit("message", `**No results found for '${query}'.**`);
|
||||
return { type: "error", data: null, error: "No results found" };
|
||||
|
||||
Reference in new issue
Block a user