From 809139782ed80f6240d8d8e17738708fc730aa82 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Sat, 10 Apr 2021 23:37:48 +0545 Subject: [PATCH] refactor --- README.md | 2 ++ src/Player.ts | 10 +++++----- src/utils/Util.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a8994ed..4ada687 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ $ npm install --save @discordjs/opus - Lightweight 🛬 - Custom extractors support 🌌 - Lyrics 📃 +- Multiple sources support ✌ +- Play in multiple servers at the same time 🚗 # Sources supported > By default, **discord-player** supports `youtube`, `spotify`, `soundcloud`, `vimeo`, `reverbnation`, `facebook` and `attachment links` only. diff --git a/src/Player.ts b/src/Player.ts index 72bfd9d..853b496 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -119,7 +119,7 @@ export class Player extends EventEmitter { const track = new Track(this, { title: data.title, url: data.url, - duration: Util.durationString(Util.parseMS(data.duration / 1000)), + duration: Util.buildTimeCode(Util.parseMS(data.duration / 1000)), description: data.description, thumbnail: data.thumbnail, views: data.playCount, @@ -213,7 +213,7 @@ export class Player extends EventEmitter { new Track(this, { title: data.title, url: data.url, - duration: Util.durationString(Util.parseMS(data.duration)), + duration: Util.buildTimeCode(Util.parseMS(data.duration)), description: data.description, thumbnail: data.thumbnail?.displayThumbnailURL(), views: data.views, @@ -272,7 +272,7 @@ export class Player extends EventEmitter { const r = new Track(this, { title: song.title, url: song.url, - duration: Util.durationString(Util.parseMS(song.duration / 1000)), + duration: Util.buildTimeCode(Util.parseMS(song.duration / 1000)), description: song.description, thumbnail: song.thumbnail ?? 'https://soundcloud.com/pwa-icon-192.png', views: song.playCount ?? 0, @@ -388,7 +388,7 @@ export class Player extends EventEmitter { author: info.videoDetails.author.name, url: info.videoDetails.video_url, thumbnail: lastThumbnail.url, - duration: Util.durationString(Util.parseMS(parseInt(info.videoDetails.lengthSeconds) * 1000)), + duration: Util.buildTimeCode(Util.parseMS(parseInt(info.videoDetails.lengthSeconds) * 1000)), views: parseInt(info.videoDetails.viewCount), requestedBy: message.author, fromPlaylist: false, @@ -402,7 +402,7 @@ export class Player extends EventEmitter { track = new Track(this, { title: data.title, description: data.description, - duration: Util.durationString(Util.parseMS(data.duration)), + duration: Util.buildTimeCode(Util.parseMS(data.duration)), thumbnail: data.thumbnail, author: data.author, views: data.views, diff --git a/src/utils/Util.ts b/src/utils/Util.ts index 556e129..bf3f76b 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -114,7 +114,7 @@ export class Util { author: r.channel.name, url: r.url, thumbnail: r.thumbnail.displayThumbnailURL(), - duration: r.durationFormatted, + duration: Util.buildTimeCode(Util.parseMS(r.duration)), views: r.views, requestedBy: options?.user, fromPlaylist: Boolean(options?.pl),