(chore) prettier
This commit is contained in:
parent
30af411c07
commit
82cfc913c8
2 changed files with 88 additions and 72 deletions
|
@ -207,9 +207,13 @@ export class Player extends EventEmitter {
|
||||||
const searchQueryString = this.options.disableArtistSearch
|
const searchQueryString = this.options.disableArtistSearch
|
||||||
? spotifyTrack.title
|
? spotifyTrack.title
|
||||||
: `${spotifyTrack.title}${' - ' + spotifyTrack.author}`;
|
: `${spotifyTrack.title}${' - ' + spotifyTrack.author}`;
|
||||||
const ytv = await YouTube.search(searchQueryString, { limit: 1, type: "video" }).catch(e => { });
|
const ytv = await YouTube.search(searchQueryString, {
|
||||||
|
limit: 1,
|
||||||
|
type: 'video'
|
||||||
|
}).catch((e) => {});
|
||||||
|
|
||||||
if (ytv && ytv[0]) Util.define({
|
if (ytv && ytv[0])
|
||||||
|
Util.define({
|
||||||
target: spotifyTrack,
|
target: spotifyTrack,
|
||||||
prop: 'backupLink',
|
prop: 'backupLink',
|
||||||
value: ytv[0].url
|
value: ytv[0].url
|
||||||
|
@ -232,7 +236,8 @@ export class Player extends EventEmitter {
|
||||||
let tracks: Track[] = [];
|
let tracks: Track[] = [];
|
||||||
|
|
||||||
if (playlist.type !== 'playlist')
|
if (playlist.type !== 'playlist')
|
||||||
tracks = await Promise.all(playlist.tracks.items.map(async (m: any) => {
|
tracks = await Promise.all(
|
||||||
|
playlist.tracks.items.map(async (m: any) => {
|
||||||
const data = new Track(this, {
|
const data = new Track(this, {
|
||||||
title: m.name ?? '',
|
title: m.name ?? '',
|
||||||
description: m.description ?? '',
|
description: m.description ?? '',
|
||||||
|
@ -253,9 +258,13 @@ export class Player extends EventEmitter {
|
||||||
const searchQueryString = this.options.disableArtistSearch
|
const searchQueryString = this.options.disableArtistSearch
|
||||||
? data.title
|
? data.title
|
||||||
: `${data.title}${' - ' + data.author}`;
|
: `${data.title}${' - ' + data.author}`;
|
||||||
const ytv = await YouTube.search(searchQueryString, { limit: 1, type: "video" }).catch(e => { });
|
const ytv = await YouTube.search(searchQueryString, {
|
||||||
|
limit: 1,
|
||||||
|
type: 'video'
|
||||||
|
}).catch((e) => {});
|
||||||
|
|
||||||
if (ytv && ytv[0]) Util.define({
|
if (ytv && ytv[0])
|
||||||
|
Util.define({
|
||||||
target: data,
|
target: data,
|
||||||
prop: 'backupLink',
|
prop: 'backupLink',
|
||||||
value: ytv[0].url
|
value: ytv[0].url
|
||||||
|
@ -263,9 +272,11 @@ export class Player extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
else {
|
else {
|
||||||
tracks = await Promise.all(playlist.tracks.items.map(async (m: any) => {
|
tracks = await Promise.all(
|
||||||
|
playlist.tracks.items.map(async (m: any) => {
|
||||||
const data = new Track(this, {
|
const data = new Track(this, {
|
||||||
title: m.track.name ?? '',
|
title: m.track.name ?? '',
|
||||||
description: m.track.description ?? '',
|
description: m.track.description ?? '',
|
||||||
|
@ -286,9 +297,13 @@ export class Player extends EventEmitter {
|
||||||
const searchQueryString = this.options.disableArtistSearch
|
const searchQueryString = this.options.disableArtistSearch
|
||||||
? data.title
|
? data.title
|
||||||
: `${data.title}${' - ' + data.author}`;
|
: `${data.title}${' - ' + data.author}`;
|
||||||
const ytv = await YouTube.search(searchQueryString, { limit: 1, type: "video" }).catch(e => {});
|
const ytv = await YouTube.search(searchQueryString, {
|
||||||
|
limit: 1,
|
||||||
|
type: 'video'
|
||||||
|
}).catch((e) => {});
|
||||||
|
|
||||||
if (ytv && ytv[0]) Util.define({
|
if (ytv && ytv[0])
|
||||||
|
Util.define({
|
||||||
target: data,
|
target: data,
|
||||||
prop: 'backupLink',
|
prop: 'backupLink',
|
||||||
value: ytv[0].url
|
value: ytv[0].url
|
||||||
|
@ -296,7 +311,8 @@ export class Player extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tracks.length) return void this.emit(PlayerEvents.NO_RESULTS, message, query);
|
if (!tracks.length) return void this.emit(PlayerEvents.NO_RESULTS, message, query);
|
||||||
|
@ -1325,7 +1341,7 @@ export class Player extends EventEmitter {
|
||||||
const searchQueryString = this.options.disableArtistSearch
|
const searchQueryString = this.options.disableArtistSearch
|
||||||
? queue.playing.title
|
? queue.playing.title
|
||||||
: `${queue.playing.title}${' - ' + queue.playing.author}`;
|
: `${queue.playing.title}${' - ' + queue.playing.author}`;
|
||||||
const yteqv = await YouTube.search(searchQueryString, { type: "video", limit: 1 }).catch(() => {});
|
const yteqv = await YouTube.search(searchQueryString, { type: 'video', limit: 1 }).catch(() => {});
|
||||||
|
|
||||||
if (!yteqv || !yteqv.length)
|
if (!yteqv || !yteqv.length)
|
||||||
return void this.emit(
|
return void this.emit(
|
||||||
|
|
|
@ -211,7 +211,7 @@ export class Util {
|
||||||
* @param prop
|
* @param prop
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
static define(ops: { target: any, prop: any, value: any, enumerate?: boolean }) {
|
static define(ops: { target: any; prop: any; value: any; enumerate?: boolean }) {
|
||||||
Object.defineProperty(ops.target, ops.prop, {
|
Object.defineProperty(ops.target, ops.prop, {
|
||||||
value: ops.value,
|
value: ops.value,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
|
Loading…
Reference in a new issue