Skip to content

Commit

Permalink
Bump version to 2.8.1 and improve source name handling
Browse files Browse the repository at this point in the history
- Update package version to 2.8.1
- Modify discord.js peer dependency to support versions 13.x and 14.x
- Make handleShutdown method public in Manager
- Add source name mapping for track creation to standardize source names
- Add thumbnail generation for tracks from various sources
  • Loading branch information
SxMAbel committed Feb 8, 2025
1 parent 7e4e17c commit eb2b384
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magmastream",
"version": "2.8.0",
"version": "2.8.1",
"description": "A user-friendly Lavalink client designed for NodeJS.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -36,7 +36,7 @@
"ws": "^8.18.0"
},
"peerDependencies": {
"discord.js": "^14.17.3"
"discord.js": ">=13.0.0 <15.0.0"
},
"engines": {
"node": ">=16.0.0"
Expand Down Expand Up @@ -88,4 +88,4 @@
"homepage": "https://docs.magmastream.com",
"author": "Abel Purnwasy",
"license": "Apache-2.0"
}
}
2 changes: 1 addition & 1 deletion src/structures/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export class Manager extends EventEmitter {
* Optionally, it also calls {@link cleanupInactivePlayers} to remove any stale player state files.
* After saving and cleaning up, it exits the process.
*/
private async handleShutdown(): Promise<void> {
public async handleShutdown(): Promise<void> {
console.warn("\x1b[31m%s\x1b[0m", "MAGMASTREAM WARNING: Shutting down! Please wait, saving active players...");

// Create an array of promises for saving player states
Expand Down
13 changes: 12 additions & 1 deletion src/structures/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ export abstract class TrackUtils {
if (typeof data === "undefined") throw new RangeError('Argument "data" must be present.');

try {
const sourceNameMap: Record<string, TrackSourceName> = {
applemusic: "AppleMusic",
bandcamp: "Bandcamp",
deezer: "Deezer",
jiosaavn: "Jiosaavn",
soundcloud: "SoundCloud",
spotify: "Spotify",
tidal: "Tidal",
youtube: "YouTube",
};

const track: Track = {
track: data.encoded,
title: data.info.title,
Expand All @@ -143,7 +154,7 @@ export abstract class TrackUtils {
isStream: data.info.isStream,
uri: data.info.uri,
artworkUrl: data.info?.artworkUrl,
sourceName: data.info?.sourceName,
sourceName: sourceNameMap[data.info?.sourceName?.toLowerCase() ?? ""] ?? data.info?.sourceName,
thumbnail: data.info.uri.includes("youtube") ? `https://img.youtube.com/vi/${data.info.identifier}/default.jpg` : null,
displayThumbnail(size = "default"): string | null {
const finalSize = SIZES.find((s) => s === size) ?? "default";
Expand Down

0 comments on commit eb2b384

Please sign in to comment.