Skip to content

Commit

Permalink
[Fix] fixed soundcloud not working with all links, using play-dl now …
Browse files Browse the repository at this point in the history
…for the playbacks
  • Loading branch information
naseif committed Oct 7, 2021
1 parent 13e8967 commit e16de26
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions commands/Music/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ module.exports = {
bufferingTimeout: 200,
leaveOnEmpty: true,
async onBeforeCreateStream(track, source, _queue) {
if (source === "soundcloud") {
if (await playdl.so_validate(track.url)) {
let soundCloudInfo = await playdl.soundcloud(track.url);
console.log(soundCloudInfo);
return (await playdl.stream_from_info(soundCloudInfo)).stream;
}
return;
}

if (source === "youtube") {
if (playdl.sp_validate(track.url)) {
if (playdl.is_expired()) {
Expand All @@ -69,6 +78,7 @@ module.exports = {
});
return (await playdl.stream(youtube[0].url)).stream;
}

return (await playdl.stream(track.url)).stream;
}
},
Expand Down Expand Up @@ -195,6 +205,15 @@ module.exports = {
bufferingTimeout: 200,
leaveOnEmpty: true,
async onBeforeCreateStream(track, source, _queue) {
if (source === "soundcloud") {
if (await playdl.so_validate(track.url)) {
let soundCloudInfo = await playdl.soundcloud(track.url);
console.log(soundCloudInfo);
return (await playdl.stream_from_info(soundCloudInfo)).stream;
}
return;
}

if (source === "youtube") {
if (playdl.sp_validate(track.url)) {
if (playdl.is_expired()) {
Expand All @@ -206,6 +225,7 @@ module.exports = {
});
return (await playdl.stream(youtube[0].url)).stream;
}

return (await playdl.stream(track.url)).stream;
}
},
Expand Down

0 comments on commit e16de26

Please sign in to comment.