(chore) prettier

This commit is contained in:
Snowflake107 2021-05-13 13:55:41 +05:45
parent 30af411c07
commit 82cfc913c8
2 changed files with 88 additions and 72 deletions

View file

@ -207,9 +207,13 @@ export class Player extends EventEmitter {
const searchQueryString = this.options.disableArtistSearch
? spotifyTrack.title
: `${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,
prop: 'backupLink',
value: ytv[0].url
@ -232,7 +236,8 @@ export class Player extends EventEmitter {
let tracks: Track[] = [];
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, {
title: m.name ?? '',
description: m.description ?? '',
@ -253,9 +258,13 @@ export class Player extends EventEmitter {
const searchQueryString = this.options.disableArtistSearch
? data.title
: `${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,
prop: 'backupLink',
value: ytv[0].url
@ -263,9 +272,11 @@ export class Player extends EventEmitter {
}
return data;
}));
})
);
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, {
title: m.track.name ?? '',
description: m.track.description ?? '',
@ -286,9 +297,13 @@ export class Player extends EventEmitter {
const searchQueryString = this.options.disableArtistSearch
? data.title
: `${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,
prop: 'backupLink',
value: ytv[0].url
@ -296,7 +311,8 @@ export class Player extends EventEmitter {
}
return data;
}));
})
);
}
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
? queue.playing.title
: `${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)
return void this.emit(

View file

@ -211,7 +211,7 @@ export class Util {
* @param prop
* @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, {
value: ops.value,
writable: true,