discord-player 5.2.0 → 5.2.1-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +15 -1
- package/dist/Player.js +556 -555
- package/dist/Structures/ExtractorModel.js +70 -70
- package/dist/Structures/PlayerError.js +48 -48
- package/dist/Structures/Playlist.js +109 -109
- package/dist/Structures/Queue.js +798 -795
- package/dist/Structures/Track.js +158 -153
- package/dist/VoiceInterface/StreamDispatcher.js +231 -231
- package/dist/VoiceInterface/VoiceUtils.js +78 -78
- package/dist/VolumeTransformer.js +94 -0
- package/dist/index.d.ts +1154 -1151
- package/dist/index.js +30 -30
- package/dist/smoothVolume.js +5 -0
- package/dist/types/types.js +58 -58
- package/dist/utils/AudioFilters.js +109 -109
- package/dist/utils/QueryResolver.js +68 -68
- package/dist/utils/Util.js +90 -90
- package/package.json +10 -6
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.version = exports.Util = exports.StreamDispatcher = exports.VoiceUtils = exports.Track = exports.Queue = exports.QueryResolver = exports.ErrorStatusCode = exports.PlayerError = exports.Player = exports.Playlist = exports.ExtractorModel = exports.AudioFilters = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
var AudioFilters_1 = require("./utils/AudioFilters");
|
|
6
|
-
Object.defineProperty(exports, "AudioFilters", { enumerable: true, get: function () { return AudioFilters_1.AudioFilters; } });
|
|
7
|
-
var ExtractorModel_1 = require("./Structures/ExtractorModel");
|
|
8
|
-
Object.defineProperty(exports, "ExtractorModel", { enumerable: true, get: function () { return ExtractorModel_1.ExtractorModel; } });
|
|
9
|
-
var Playlist_1 = require("./Structures/Playlist");
|
|
10
|
-
Object.defineProperty(exports, "Playlist", { enumerable: true, get: function () { return Playlist_1.Playlist; } });
|
|
11
|
-
var Player_1 = require("./Player");
|
|
12
|
-
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return Player_1.Player; } });
|
|
13
|
-
var PlayerError_1 = require("./Structures/PlayerError");
|
|
14
|
-
Object.defineProperty(exports, "PlayerError", { enumerable: true, get: function () { return PlayerError_1.PlayerError; } });
|
|
15
|
-
Object.defineProperty(exports, "ErrorStatusCode", { enumerable: true, get: function () { return PlayerError_1.ErrorStatusCode; } });
|
|
16
|
-
var QueryResolver_1 = require("./utils/QueryResolver");
|
|
17
|
-
Object.defineProperty(exports, "QueryResolver", { enumerable: true, get: function () { return QueryResolver_1.QueryResolver; } });
|
|
18
|
-
var Queue_1 = require("./Structures/Queue");
|
|
19
|
-
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return Queue_1.Queue; } });
|
|
20
|
-
var Track_1 = require("./Structures/Track");
|
|
21
|
-
Object.defineProperty(exports, "Track", { enumerable: true, get: function () { return Track_1.Track; } });
|
|
22
|
-
var VoiceUtils_1 = require("./VoiceInterface/VoiceUtils");
|
|
23
|
-
Object.defineProperty(exports, "VoiceUtils", { enumerable: true, get: function () { return VoiceUtils_1.VoiceUtils; } });
|
|
24
|
-
var StreamDispatcher_1 = require("./VoiceInterface/StreamDispatcher");
|
|
25
|
-
Object.defineProperty(exports, "StreamDispatcher", { enumerable: true, get: function () { return StreamDispatcher_1.StreamDispatcher; } });
|
|
26
|
-
var Util_1 = require("./utils/Util");
|
|
27
|
-
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return Util_1.Util; } });
|
|
28
|
-
(0, tslib_1.__exportStar)(require("./types/types"), exports);
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
-
exports.version = require(`${__dirname}/../package.json`).version;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.version = exports.Util = exports.StreamDispatcher = exports.VoiceUtils = exports.Track = exports.Queue = exports.QueryResolver = exports.ErrorStatusCode = exports.PlayerError = exports.Player = exports.Playlist = exports.ExtractorModel = exports.AudioFilters = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var AudioFilters_1 = require("./utils/AudioFilters");
|
|
6
|
+
Object.defineProperty(exports, "AudioFilters", { enumerable: true, get: function () { return AudioFilters_1.AudioFilters; } });
|
|
7
|
+
var ExtractorModel_1 = require("./Structures/ExtractorModel");
|
|
8
|
+
Object.defineProperty(exports, "ExtractorModel", { enumerable: true, get: function () { return ExtractorModel_1.ExtractorModel; } });
|
|
9
|
+
var Playlist_1 = require("./Structures/Playlist");
|
|
10
|
+
Object.defineProperty(exports, "Playlist", { enumerable: true, get: function () { return Playlist_1.Playlist; } });
|
|
11
|
+
var Player_1 = require("./Player");
|
|
12
|
+
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return Player_1.Player; } });
|
|
13
|
+
var PlayerError_1 = require("./Structures/PlayerError");
|
|
14
|
+
Object.defineProperty(exports, "PlayerError", { enumerable: true, get: function () { return PlayerError_1.PlayerError; } });
|
|
15
|
+
Object.defineProperty(exports, "ErrorStatusCode", { enumerable: true, get: function () { return PlayerError_1.ErrorStatusCode; } });
|
|
16
|
+
var QueryResolver_1 = require("./utils/QueryResolver");
|
|
17
|
+
Object.defineProperty(exports, "QueryResolver", { enumerable: true, get: function () { return QueryResolver_1.QueryResolver; } });
|
|
18
|
+
var Queue_1 = require("./Structures/Queue");
|
|
19
|
+
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return Queue_1.Queue; } });
|
|
20
|
+
var Track_1 = require("./Structures/Track");
|
|
21
|
+
Object.defineProperty(exports, "Track", { enumerable: true, get: function () { return Track_1.Track; } });
|
|
22
|
+
var VoiceUtils_1 = require("./VoiceInterface/VoiceUtils");
|
|
23
|
+
Object.defineProperty(exports, "VoiceUtils", { enumerable: true, get: function () { return VoiceUtils_1.VoiceUtils; } });
|
|
24
|
+
var StreamDispatcher_1 = require("./VoiceInterface/StreamDispatcher");
|
|
25
|
+
Object.defineProperty(exports, "StreamDispatcher", { enumerable: true, get: function () { return StreamDispatcher_1.StreamDispatcher; } });
|
|
26
|
+
var Util_1 = require("./utils/Util");
|
|
27
|
+
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return Util_1.Util; } });
|
|
28
|
+
(0, tslib_1.__exportStar)(require("./types/types"), exports);
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
+
exports.version = require(`${__dirname}/../package.json`).version;
|
package/dist/types/types.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueueRepeatMode = exports.QueryType = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* The search query type
|
|
6
|
-
* This can be one of:
|
|
7
|
-
* - AUTO
|
|
8
|
-
* - YOUTUBE
|
|
9
|
-
* - YOUTUBE_PLAYLIST
|
|
10
|
-
* - SOUNDCLOUD_TRACK
|
|
11
|
-
* - SOUNDCLOUD_PLAYLIST
|
|
12
|
-
* - SOUNDCLOUD
|
|
13
|
-
* - SPOTIFY_SONG
|
|
14
|
-
* - SPOTIFY_ALBUM
|
|
15
|
-
* - SPOTIFY_PLAYLIST
|
|
16
|
-
* - FACEBOOK
|
|
17
|
-
* - VIMEO
|
|
18
|
-
* - ARBITRARY
|
|
19
|
-
* - REVERBNATION
|
|
20
|
-
* - YOUTUBE_SEARCH
|
|
21
|
-
* - YOUTUBE_VIDEO
|
|
22
|
-
* - SOUNDCLOUD_SEARCH
|
|
23
|
-
* @typedef {number} QueryType
|
|
24
|
-
*/
|
|
25
|
-
var QueryType;
|
|
26
|
-
(function (QueryType) {
|
|
27
|
-
QueryType[QueryType["AUTO"] = 0] = "AUTO";
|
|
28
|
-
QueryType[QueryType["YOUTUBE"] = 1] = "YOUTUBE";
|
|
29
|
-
QueryType[QueryType["YOUTUBE_PLAYLIST"] = 2] = "YOUTUBE_PLAYLIST";
|
|
30
|
-
QueryType[QueryType["SOUNDCLOUD_TRACK"] = 3] = "SOUNDCLOUD_TRACK";
|
|
31
|
-
QueryType[QueryType["SOUNDCLOUD_PLAYLIST"] = 4] = "SOUNDCLOUD_PLAYLIST";
|
|
32
|
-
QueryType[QueryType["SOUNDCLOUD"] = 5] = "SOUNDCLOUD";
|
|
33
|
-
QueryType[QueryType["SPOTIFY_SONG"] = 6] = "SPOTIFY_SONG";
|
|
34
|
-
QueryType[QueryType["SPOTIFY_ALBUM"] = 7] = "SPOTIFY_ALBUM";
|
|
35
|
-
QueryType[QueryType["SPOTIFY_PLAYLIST"] = 8] = "SPOTIFY_PLAYLIST";
|
|
36
|
-
QueryType[QueryType["FACEBOOK"] = 9] = "FACEBOOK";
|
|
37
|
-
QueryType[QueryType["VIMEO"] = 10] = "VIMEO";
|
|
38
|
-
QueryType[QueryType["ARBITRARY"] = 11] = "ARBITRARY";
|
|
39
|
-
QueryType[QueryType["REVERBNATION"] = 12] = "REVERBNATION";
|
|
40
|
-
QueryType[QueryType["YOUTUBE_SEARCH"] = 13] = "YOUTUBE_SEARCH";
|
|
41
|
-
QueryType[QueryType["YOUTUBE_VIDEO"] = 14] = "YOUTUBE_VIDEO";
|
|
42
|
-
QueryType[QueryType["SOUNDCLOUD_SEARCH"] = 15] = "SOUNDCLOUD_SEARCH";
|
|
43
|
-
})(QueryType = exports.QueryType || (exports.QueryType = {}));
|
|
44
|
-
/**
|
|
45
|
-
* The queue repeat mode. This can be one of:
|
|
46
|
-
* - OFF
|
|
47
|
-
* - TRACK
|
|
48
|
-
* - QUEUE
|
|
49
|
-
* - AUTOPLAY
|
|
50
|
-
* @typedef {number} QueueRepeatMode
|
|
51
|
-
*/
|
|
52
|
-
var QueueRepeatMode;
|
|
53
|
-
(function (QueueRepeatMode) {
|
|
54
|
-
QueueRepeatMode[QueueRepeatMode["OFF"] = 0] = "OFF";
|
|
55
|
-
QueueRepeatMode[QueueRepeatMode["TRACK"] = 1] = "TRACK";
|
|
56
|
-
QueueRepeatMode[QueueRepeatMode["QUEUE"] = 2] = "QUEUE";
|
|
57
|
-
QueueRepeatMode[QueueRepeatMode["AUTOPLAY"] = 3] = "AUTOPLAY";
|
|
58
|
-
})(QueueRepeatMode = exports.QueueRepeatMode || (exports.QueueRepeatMode = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueueRepeatMode = exports.QueryType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The search query type
|
|
6
|
+
* This can be one of:
|
|
7
|
+
* - AUTO
|
|
8
|
+
* - YOUTUBE
|
|
9
|
+
* - YOUTUBE_PLAYLIST
|
|
10
|
+
* - SOUNDCLOUD_TRACK
|
|
11
|
+
* - SOUNDCLOUD_PLAYLIST
|
|
12
|
+
* - SOUNDCLOUD
|
|
13
|
+
* - SPOTIFY_SONG
|
|
14
|
+
* - SPOTIFY_ALBUM
|
|
15
|
+
* - SPOTIFY_PLAYLIST
|
|
16
|
+
* - FACEBOOK
|
|
17
|
+
* - VIMEO
|
|
18
|
+
* - ARBITRARY
|
|
19
|
+
* - REVERBNATION
|
|
20
|
+
* - YOUTUBE_SEARCH
|
|
21
|
+
* - YOUTUBE_VIDEO
|
|
22
|
+
* - SOUNDCLOUD_SEARCH
|
|
23
|
+
* @typedef {number} QueryType
|
|
24
|
+
*/
|
|
25
|
+
var QueryType;
|
|
26
|
+
(function (QueryType) {
|
|
27
|
+
QueryType[QueryType["AUTO"] = 0] = "AUTO";
|
|
28
|
+
QueryType[QueryType["YOUTUBE"] = 1] = "YOUTUBE";
|
|
29
|
+
QueryType[QueryType["YOUTUBE_PLAYLIST"] = 2] = "YOUTUBE_PLAYLIST";
|
|
30
|
+
QueryType[QueryType["SOUNDCLOUD_TRACK"] = 3] = "SOUNDCLOUD_TRACK";
|
|
31
|
+
QueryType[QueryType["SOUNDCLOUD_PLAYLIST"] = 4] = "SOUNDCLOUD_PLAYLIST";
|
|
32
|
+
QueryType[QueryType["SOUNDCLOUD"] = 5] = "SOUNDCLOUD";
|
|
33
|
+
QueryType[QueryType["SPOTIFY_SONG"] = 6] = "SPOTIFY_SONG";
|
|
34
|
+
QueryType[QueryType["SPOTIFY_ALBUM"] = 7] = "SPOTIFY_ALBUM";
|
|
35
|
+
QueryType[QueryType["SPOTIFY_PLAYLIST"] = 8] = "SPOTIFY_PLAYLIST";
|
|
36
|
+
QueryType[QueryType["FACEBOOK"] = 9] = "FACEBOOK";
|
|
37
|
+
QueryType[QueryType["VIMEO"] = 10] = "VIMEO";
|
|
38
|
+
QueryType[QueryType["ARBITRARY"] = 11] = "ARBITRARY";
|
|
39
|
+
QueryType[QueryType["REVERBNATION"] = 12] = "REVERBNATION";
|
|
40
|
+
QueryType[QueryType["YOUTUBE_SEARCH"] = 13] = "YOUTUBE_SEARCH";
|
|
41
|
+
QueryType[QueryType["YOUTUBE_VIDEO"] = 14] = "YOUTUBE_VIDEO";
|
|
42
|
+
QueryType[QueryType["SOUNDCLOUD_SEARCH"] = 15] = "SOUNDCLOUD_SEARCH";
|
|
43
|
+
})(QueryType = exports.QueryType || (exports.QueryType = {}));
|
|
44
|
+
/**
|
|
45
|
+
* The queue repeat mode. This can be one of:
|
|
46
|
+
* - OFF
|
|
47
|
+
* - TRACK
|
|
48
|
+
* - QUEUE
|
|
49
|
+
* - AUTOPLAY
|
|
50
|
+
* @typedef {number} QueueRepeatMode
|
|
51
|
+
*/
|
|
52
|
+
var QueueRepeatMode;
|
|
53
|
+
(function (QueueRepeatMode) {
|
|
54
|
+
QueueRepeatMode[QueueRepeatMode["OFF"] = 0] = "OFF";
|
|
55
|
+
QueueRepeatMode[QueueRepeatMode["TRACK"] = 1] = "TRACK";
|
|
56
|
+
QueueRepeatMode[QueueRepeatMode["QUEUE"] = 2] = "QUEUE";
|
|
57
|
+
QueueRepeatMode[QueueRepeatMode["AUTOPLAY"] = 3] = "AUTOPLAY";
|
|
58
|
+
})(QueueRepeatMode = exports.QueueRepeatMode || (exports.QueueRepeatMode = {}));
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AudioFilters = void 0;
|
|
4
|
-
const bass = (g) => `bass=g=${g}:f=110:w=0.3`;
|
|
5
|
-
/**
|
|
6
|
-
* The available audio filters
|
|
7
|
-
* @typedef {object} AudioFilters
|
|
8
|
-
* @property {string} bassboost_low The bassboost filter (+15dB)
|
|
9
|
-
* @property {string} bassboost The bassboost filter (+20dB)
|
|
10
|
-
* @property {string} bassboost_high The bassboost filter (+30dB)
|
|
11
|
-
* @property {string} 8D The 8D filter
|
|
12
|
-
* @property {string} vaporwave The vaporwave filter
|
|
13
|
-
* @property {string} nightcore The nightcore filter
|
|
14
|
-
* @property {string} phaser The phaser filter
|
|
15
|
-
* @property {string} tremolo The tremolo filter
|
|
16
|
-
* @property {string} vibrato The vibrato filter
|
|
17
|
-
* @property {string} reverse The reverse filter
|
|
18
|
-
* @property {string} treble The treble filter
|
|
19
|
-
* @property {string} normalizer The normalizer filter (dynamic audio normalizer based)
|
|
20
|
-
* @property {string} normalizer2 The normalizer filter (audio compressor based)
|
|
21
|
-
* @property {string} surrounding The surrounding filter
|
|
22
|
-
* @property {string} pulsator The pulsator filter
|
|
23
|
-
* @property {string} subboost The subboost filter
|
|
24
|
-
* @property {string} karaoke The kakaoke filter
|
|
25
|
-
* @property {string} flanger The flanger filter
|
|
26
|
-
* @property {string} gate The gate filter
|
|
27
|
-
* @property {string} haas The haas filter
|
|
28
|
-
* @property {string} mcompand The mcompand filter
|
|
29
|
-
* @property {string} mono The mono filter
|
|
30
|
-
* @property {string} mstlr The mstlr filter
|
|
31
|
-
* @property {string} mstrr The mstrr filter
|
|
32
|
-
* @property {string} compressor The compressor filter
|
|
33
|
-
* @property {string} expander The expander filter
|
|
34
|
-
* @property {string} softlimiter The softlimiter filter
|
|
35
|
-
* @property {string} chorus The chorus filter
|
|
36
|
-
* @property {string} chorus2d The chorus2d filter
|
|
37
|
-
* @property {string} chorus3d The chorus3d filter
|
|
38
|
-
* @property {string} fadein The fadein filter
|
|
39
|
-
* @property {string} dim The dim filter
|
|
40
|
-
* @property {string} earrape The earrape filter
|
|
41
|
-
*/
|
|
42
|
-
const FilterList = {
|
|
43
|
-
bassboost_low: bass(15),
|
|
44
|
-
bassboost: bass(20),
|
|
45
|
-
bassboost_high: bass(30),
|
|
46
|
-
"8D": "apulsator=hz=0.09",
|
|
47
|
-
vaporwave: "aresample=48000,asetrate=48000*0.8",
|
|
48
|
-
nightcore: "aresample=48000,asetrate=48000*1.25",
|
|
49
|
-
phaser: "aphaser=in_gain=0.4",
|
|
50
|
-
tremolo: "tremolo",
|
|
51
|
-
vibrato: "vibrato=f=6.5",
|
|
52
|
-
reverse: "areverse",
|
|
53
|
-
treble: "treble=g=5",
|
|
54
|
-
normalizer: "dynaudnorm=g=101",
|
|
55
|
-
normalizer2: "acompressor",
|
|
56
|
-
surrounding: "surround",
|
|
57
|
-
pulsator: "apulsator=hz=1",
|
|
58
|
-
subboost: "asubboost",
|
|
59
|
-
karaoke: "stereotools=mlev=0.03",
|
|
60
|
-
flanger: "flanger",
|
|
61
|
-
gate: "agate",
|
|
62
|
-
haas: "haas",
|
|
63
|
-
mcompand: "mcompand",
|
|
64
|
-
mono: "pan=mono|c0=.5*c0+.5*c1",
|
|
65
|
-
mstlr: "stereotools=mode=ms>lr",
|
|
66
|
-
mstrr: "stereotools=mode=ms>rr",
|
|
67
|
-
compressor: "compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6",
|
|
68
|
-
expander: "compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3",
|
|
69
|
-
softlimiter: "compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8",
|
|
70
|
-
chorus: "chorus=0.7:0.9:55:0.4:0.25:2",
|
|
71
|
-
chorus2d: "chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3",
|
|
72
|
-
chorus3d: "chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3",
|
|
73
|
-
fadein: "afade=t=in:ss=0:d=10",
|
|
74
|
-
dim: `afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"`,
|
|
75
|
-
earrape: "channelsplit,sidechaingate=level_in=64",
|
|
76
|
-
*[Symbol.iterator]() {
|
|
77
|
-
for (const [k, v] of Object.entries(this)) {
|
|
78
|
-
if (typeof this[k] === "string")
|
|
79
|
-
yield { name: k, value: v };
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
get names() {
|
|
83
|
-
return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this[p] !== "function");
|
|
84
|
-
},
|
|
85
|
-
get length() {
|
|
86
|
-
return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this[p] !== "function").length;
|
|
87
|
-
},
|
|
88
|
-
toString() {
|
|
89
|
-
return this.names.map((m) => this[m]).join(","); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
90
|
-
},
|
|
91
|
-
create(filter) {
|
|
92
|
-
if (!filter || !Array.isArray(filter))
|
|
93
|
-
return this.toString();
|
|
94
|
-
return filter
|
|
95
|
-
.filter((predicate) => typeof predicate === "string")
|
|
96
|
-
.map((m) => this[m])
|
|
97
|
-
.join(",");
|
|
98
|
-
},
|
|
99
|
-
define(filterName, value) {
|
|
100
|
-
if (typeof this[filterName] && typeof this[filterName] === "function")
|
|
101
|
-
return;
|
|
102
|
-
this[filterName] = value;
|
|
103
|
-
},
|
|
104
|
-
defineBulk(filterArray) {
|
|
105
|
-
filterArray.forEach((arr) => this.define(arr.name, arr.value));
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
exports.AudioFilters = FilterList;
|
|
109
|
-
exports.default = FilterList;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AudioFilters = void 0;
|
|
4
|
+
const bass = (g) => `bass=g=${g}:f=110:w=0.3`;
|
|
5
|
+
/**
|
|
6
|
+
* The available audio filters
|
|
7
|
+
* @typedef {object} AudioFilters
|
|
8
|
+
* @property {string} bassboost_low The bassboost filter (+15dB)
|
|
9
|
+
* @property {string} bassboost The bassboost filter (+20dB)
|
|
10
|
+
* @property {string} bassboost_high The bassboost filter (+30dB)
|
|
11
|
+
* @property {string} 8D The 8D filter
|
|
12
|
+
* @property {string} vaporwave The vaporwave filter
|
|
13
|
+
* @property {string} nightcore The nightcore filter
|
|
14
|
+
* @property {string} phaser The phaser filter
|
|
15
|
+
* @property {string} tremolo The tremolo filter
|
|
16
|
+
* @property {string} vibrato The vibrato filter
|
|
17
|
+
* @property {string} reverse The reverse filter
|
|
18
|
+
* @property {string} treble The treble filter
|
|
19
|
+
* @property {string} normalizer The normalizer filter (dynamic audio normalizer based)
|
|
20
|
+
* @property {string} normalizer2 The normalizer filter (audio compressor based)
|
|
21
|
+
* @property {string} surrounding The surrounding filter
|
|
22
|
+
* @property {string} pulsator The pulsator filter
|
|
23
|
+
* @property {string} subboost The subboost filter
|
|
24
|
+
* @property {string} karaoke The kakaoke filter
|
|
25
|
+
* @property {string} flanger The flanger filter
|
|
26
|
+
* @property {string} gate The gate filter
|
|
27
|
+
* @property {string} haas The haas filter
|
|
28
|
+
* @property {string} mcompand The mcompand filter
|
|
29
|
+
* @property {string} mono The mono filter
|
|
30
|
+
* @property {string} mstlr The mstlr filter
|
|
31
|
+
* @property {string} mstrr The mstrr filter
|
|
32
|
+
* @property {string} compressor The compressor filter
|
|
33
|
+
* @property {string} expander The expander filter
|
|
34
|
+
* @property {string} softlimiter The softlimiter filter
|
|
35
|
+
* @property {string} chorus The chorus filter
|
|
36
|
+
* @property {string} chorus2d The chorus2d filter
|
|
37
|
+
* @property {string} chorus3d The chorus3d filter
|
|
38
|
+
* @property {string} fadein The fadein filter
|
|
39
|
+
* @property {string} dim The dim filter
|
|
40
|
+
* @property {string} earrape The earrape filter
|
|
41
|
+
*/
|
|
42
|
+
const FilterList = {
|
|
43
|
+
bassboost_low: bass(15),
|
|
44
|
+
bassboost: bass(20),
|
|
45
|
+
bassboost_high: bass(30),
|
|
46
|
+
"8D": "apulsator=hz=0.09",
|
|
47
|
+
vaporwave: "aresample=48000,asetrate=48000*0.8",
|
|
48
|
+
nightcore: "aresample=48000,asetrate=48000*1.25",
|
|
49
|
+
phaser: "aphaser=in_gain=0.4",
|
|
50
|
+
tremolo: "tremolo",
|
|
51
|
+
vibrato: "vibrato=f=6.5",
|
|
52
|
+
reverse: "areverse",
|
|
53
|
+
treble: "treble=g=5",
|
|
54
|
+
normalizer: "dynaudnorm=g=101",
|
|
55
|
+
normalizer2: "acompressor",
|
|
56
|
+
surrounding: "surround",
|
|
57
|
+
pulsator: "apulsator=hz=1",
|
|
58
|
+
subboost: "asubboost",
|
|
59
|
+
karaoke: "stereotools=mlev=0.03",
|
|
60
|
+
flanger: "flanger",
|
|
61
|
+
gate: "agate",
|
|
62
|
+
haas: "haas",
|
|
63
|
+
mcompand: "mcompand",
|
|
64
|
+
mono: "pan=mono|c0=.5*c0+.5*c1",
|
|
65
|
+
mstlr: "stereotools=mode=ms>lr",
|
|
66
|
+
mstrr: "stereotools=mode=ms>rr",
|
|
67
|
+
compressor: "compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6",
|
|
68
|
+
expander: "compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3",
|
|
69
|
+
softlimiter: "compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8",
|
|
70
|
+
chorus: "chorus=0.7:0.9:55:0.4:0.25:2",
|
|
71
|
+
chorus2d: "chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3",
|
|
72
|
+
chorus3d: "chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3",
|
|
73
|
+
fadein: "afade=t=in:ss=0:d=10",
|
|
74
|
+
dim: `afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"`,
|
|
75
|
+
earrape: "channelsplit,sidechaingate=level_in=64",
|
|
76
|
+
*[Symbol.iterator]() {
|
|
77
|
+
for (const [k, v] of Object.entries(this)) {
|
|
78
|
+
if (typeof this[k] === "string")
|
|
79
|
+
yield { name: k, value: v };
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
get names() {
|
|
83
|
+
return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this[p] !== "function");
|
|
84
|
+
},
|
|
85
|
+
get length() {
|
|
86
|
+
return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this[p] !== "function").length;
|
|
87
|
+
},
|
|
88
|
+
toString() {
|
|
89
|
+
return this.names.map((m) => this[m]).join(","); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
90
|
+
},
|
|
91
|
+
create(filter) {
|
|
92
|
+
if (!filter || !Array.isArray(filter))
|
|
93
|
+
return this.toString();
|
|
94
|
+
return filter
|
|
95
|
+
.filter((predicate) => typeof predicate === "string")
|
|
96
|
+
.map((m) => this[m])
|
|
97
|
+
.join(",");
|
|
98
|
+
},
|
|
99
|
+
define(filterName, value) {
|
|
100
|
+
if (typeof this[filterName] && typeof this[filterName] === "function")
|
|
101
|
+
return;
|
|
102
|
+
this[filterName] = value;
|
|
103
|
+
},
|
|
104
|
+
defineBulk(filterArray) {
|
|
105
|
+
filterArray.forEach((arr) => this.define(arr.name, arr.value));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.AudioFilters = FilterList;
|
|
109
|
+
exports.default = FilterList;
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueryResolver = void 0;
|
|
4
|
-
const ytdl_core_1 = require("ytdl-core");
|
|
5
|
-
const youtube_sr_1 = require("youtube-sr");
|
|
6
|
-
const types_1 = require("../types/types");
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
const soundcloud_scraper_1 = require("soundcloud-scraper");
|
|
10
|
-
// scary things below *sigh*
|
|
11
|
-
const spotifySongRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/;
|
|
12
|
-
const spotifyPlaylistRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:playlist\/|\?uri=spotify:playlist:)((\w|-){22})/;
|
|
13
|
-
const spotifyAlbumRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:album\/|\?uri=spotify:album:)((\w|-){22})/;
|
|
14
|
-
const vimeoRegex = /(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/;
|
|
15
|
-
const facebookRegex = /(https?:\/\/)(www\.|m\.)?(facebook|fb).com\/.*\/videos\/.*/;
|
|
16
|
-
const reverbnationRegex = /https:\/\/(www.)?reverbnation.com\/(.+)\/song\/(.+)/;
|
|
17
|
-
const attachmentRegex = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/;
|
|
18
|
-
// scary things above *sigh*
|
|
19
|
-
class QueryResolver {
|
|
20
|
-
/**
|
|
21
|
-
* Query resolver
|
|
22
|
-
*/
|
|
23
|
-
constructor() { } // eslint-disable-line @typescript-eslint/no-empty-function
|
|
24
|
-
/**
|
|
25
|
-
* Resolves the given search query
|
|
26
|
-
* @param {string} query The query
|
|
27
|
-
* @returns {QueryType}
|
|
28
|
-
*/
|
|
29
|
-
static resolve(query) {
|
|
30
|
-
if ((0, soundcloud_scraper_1.validateURL)(query, "track"))
|
|
31
|
-
return types_1.QueryType.SOUNDCLOUD_TRACK;
|
|
32
|
-
if ((0, soundcloud_scraper_1.validateURL)(query, "playlist") || query.includes("/sets/"))
|
|
33
|
-
return types_1.QueryType.SOUNDCLOUD_PLAYLIST;
|
|
34
|
-
if (youtube_sr_1.YouTube.isPlaylist(query))
|
|
35
|
-
return types_1.QueryType.YOUTUBE_PLAYLIST;
|
|
36
|
-
if ((0, ytdl_core_1.validateID)(query) || (0, ytdl_core_1.validateURL)(query))
|
|
37
|
-
return types_1.QueryType.YOUTUBE_VIDEO;
|
|
38
|
-
if (spotifySongRegex.test(query))
|
|
39
|
-
return types_1.QueryType.SPOTIFY_SONG;
|
|
40
|
-
if (spotifyPlaylistRegex.test(query))
|
|
41
|
-
return types_1.QueryType.SPOTIFY_PLAYLIST;
|
|
42
|
-
if (spotifyAlbumRegex.test(query))
|
|
43
|
-
return types_1.QueryType.SPOTIFY_ALBUM;
|
|
44
|
-
if (vimeoRegex.test(query))
|
|
45
|
-
return types_1.QueryType.VIMEO;
|
|
46
|
-
if (facebookRegex.test(query))
|
|
47
|
-
return types_1.QueryType.FACEBOOK;
|
|
48
|
-
if (reverbnationRegex.test(query))
|
|
49
|
-
return types_1.QueryType.REVERBNATION;
|
|
50
|
-
if (attachmentRegex.test(query))
|
|
51
|
-
return types_1.QueryType.ARBITRARY;
|
|
52
|
-
return types_1.QueryType.YOUTUBE_SEARCH;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Parses vimeo id from url
|
|
56
|
-
* @param {string} query The query
|
|
57
|
-
* @returns {string}
|
|
58
|
-
*/
|
|
59
|
-
static getVimeoID(query) {
|
|
60
|
-
return QueryResolver.resolve(query) === types_1.QueryType.VIMEO
|
|
61
|
-
? query
|
|
62
|
-
.split("/")
|
|
63
|
-
.filter((x) => !!x)
|
|
64
|
-
.pop()
|
|
65
|
-
: null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.QueryResolver = QueryResolver;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryResolver = void 0;
|
|
4
|
+
const ytdl_core_1 = require("ytdl-core");
|
|
5
|
+
const youtube_sr_1 = require("youtube-sr");
|
|
6
|
+
const types_1 = require("../types/types");
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const soundcloud_scraper_1 = require("soundcloud-scraper");
|
|
10
|
+
// scary things below *sigh*
|
|
11
|
+
const spotifySongRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/;
|
|
12
|
+
const spotifyPlaylistRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:playlist\/|\?uri=spotify:playlist:)((\w|-){22})/;
|
|
13
|
+
const spotifyAlbumRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:album\/|\?uri=spotify:album:)((\w|-){22})/;
|
|
14
|
+
const vimeoRegex = /(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/;
|
|
15
|
+
const facebookRegex = /(https?:\/\/)(www\.|m\.)?(facebook|fb).com\/.*\/videos\/.*/;
|
|
16
|
+
const reverbnationRegex = /https:\/\/(www.)?reverbnation.com\/(.+)\/song\/(.+)/;
|
|
17
|
+
const attachmentRegex = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/;
|
|
18
|
+
// scary things above *sigh*
|
|
19
|
+
class QueryResolver {
|
|
20
|
+
/**
|
|
21
|
+
* Query resolver
|
|
22
|
+
*/
|
|
23
|
+
constructor() { } // eslint-disable-line @typescript-eslint/no-empty-function
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the given search query
|
|
26
|
+
* @param {string} query The query
|
|
27
|
+
* @returns {QueryType}
|
|
28
|
+
*/
|
|
29
|
+
static resolve(query) {
|
|
30
|
+
if ((0, soundcloud_scraper_1.validateURL)(query, "track"))
|
|
31
|
+
return types_1.QueryType.SOUNDCLOUD_TRACK;
|
|
32
|
+
if ((0, soundcloud_scraper_1.validateURL)(query, "playlist") || query.includes("/sets/"))
|
|
33
|
+
return types_1.QueryType.SOUNDCLOUD_PLAYLIST;
|
|
34
|
+
if (youtube_sr_1.YouTube.isPlaylist(query))
|
|
35
|
+
return types_1.QueryType.YOUTUBE_PLAYLIST;
|
|
36
|
+
if ((0, ytdl_core_1.validateID)(query) || (0, ytdl_core_1.validateURL)(query))
|
|
37
|
+
return types_1.QueryType.YOUTUBE_VIDEO;
|
|
38
|
+
if (spotifySongRegex.test(query))
|
|
39
|
+
return types_1.QueryType.SPOTIFY_SONG;
|
|
40
|
+
if (spotifyPlaylistRegex.test(query))
|
|
41
|
+
return types_1.QueryType.SPOTIFY_PLAYLIST;
|
|
42
|
+
if (spotifyAlbumRegex.test(query))
|
|
43
|
+
return types_1.QueryType.SPOTIFY_ALBUM;
|
|
44
|
+
if (vimeoRegex.test(query))
|
|
45
|
+
return types_1.QueryType.VIMEO;
|
|
46
|
+
if (facebookRegex.test(query))
|
|
47
|
+
return types_1.QueryType.FACEBOOK;
|
|
48
|
+
if (reverbnationRegex.test(query))
|
|
49
|
+
return types_1.QueryType.REVERBNATION;
|
|
50
|
+
if (attachmentRegex.test(query))
|
|
51
|
+
return types_1.QueryType.ARBITRARY;
|
|
52
|
+
return types_1.QueryType.YOUTUBE_SEARCH;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parses vimeo id from url
|
|
56
|
+
* @param {string} query The query
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
static getVimeoID(query) {
|
|
60
|
+
return QueryResolver.resolve(query) === types_1.QueryType.VIMEO
|
|
61
|
+
? query
|
|
62
|
+
.split("/")
|
|
63
|
+
.filter((x) => !!x)
|
|
64
|
+
.pop()
|
|
65
|
+
: null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.QueryResolver = QueryResolver;
|