This commit is contained in:
KGT1 2020-10-06 00:47:26 +02:00
parent 927049f9a4
commit 9ec2d2aa73
4 changed files with 34 additions and 38 deletions

View File

@ -126,7 +126,6 @@ class InterActivePlayMessage {
updateProgress (ticks) {
if (typeof this.musicplayermessage !== "undefined" && typeof this.musicplayermessage.embeds[0] !== "undefined" && typeof this.musicplayermessage.embeds[0].fields[0] !== "undefined") {
this.musicplayermessage.embeds[0].fields[0] = {
name: getProgressString(ticks / this.ticksLength),
value: `${secondsToHms(ticksToSeconds(ticks))} / ${secondsToHms(ticksToSeconds(this.ticksLength))}`,

View File

@ -57,16 +57,17 @@ async function searchForItemID (searchString) {
case "Audio":
return [response.SearchHints[0].ItemId];
case "Playlist":
case "MusicAlbum":
let resp = await jellyfinClientManager.getJellyfinClient().getItems(jellyfinClientManager.getJellyfinClient().getCurrentUserId(),{sortBy:"SortName", sortOrder:"Ascending",parentId:response.SearchHints[0].ItemId});
let itemArray = [];
case "MusicAlbum": {
const resp = await jellyfinClientManager.getJellyfinClient().getItems(jellyfinClientManager.getJellyfinClient().getCurrentUserId(), { sortBy: "SortName", sortOrder: "Ascending", parentId: response.SearchHints[0].ItemId });
const itemArray = [];
resp.Items.forEach(element => {
itemArray.push(element.Id)
itemArray.push(element.Id);
});
return itemArray;
}
}
}
}
function summon (voiceChannel) {
voiceChannel.join();
@ -126,7 +127,6 @@ async function addThis (message) {
} else {
try {
items = await searchForItemID(argument);
console.log(items);
} catch (e) {
const noSong = getDiscordEmbedError(e);
message.channel.send(noSong);
@ -204,12 +204,10 @@ function handleChannelMessage (message) {
message.channel.send(errorMessage);
}
} else if (message.content.startsWith(CONFIG["discord-prefix"] + "add")) {
const indexOfArgument = message.content.indexOf(CONFIG["discord-prefix"] + "add") + (CONFIG["discord-prefix"] + "add").length + 1;
const argument = message.content.slice(indexOfArgument);
addThis(message);
} else if (message.content.startsWith(CONFIG["discord-prefix"] + "spawn")) {
try {
playbackmanager.spawnPlayMessage(message)
playbackmanager.spawnPlayMessage(message);
} catch (error) {
const errorMessage = getDiscordEmbedError(error);
message.channel.send(errorMessage);

View File

@ -54,7 +54,7 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
getAudioDispatcher().on("finish", () => {
if (isRepeat) {
startPlaying(voiceconnection,undefined,currentPlayingPlaylistIndex,0)
startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex, 0);
} else {
if (currentPlayingPlaylist.length < playlistIndex) {
if (disconnectOnFinish) {
@ -64,7 +64,8 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
}
} else {
startPlaying(voiceconnection, undefined, currentPlayingPlaylistIndex + 1, 0);
}}
}
}
});
}
playasync().catch((rsn) => {
@ -83,7 +84,7 @@ async function spawnPlayMessage (message) {
playPause,
() => { stop(_disconnectOnFinish ? discordclientmanager.getDiscordClient().user.client.voice.connections.first() : undefined); },
nextTrack,
()=>{setIsRepeat(!isRepeat)},
() => { setIsRepeat(!isRepeat); },
currentPlayingPlaylist.length);
if (typeof CONFIG["interactive-seek-bar-update-intervall"] === "number") {
interactivemsghandler.startUpate(getPostitionTicks);
@ -99,7 +100,6 @@ async function updatePlayMessage () {
const imageURL = await jellyfinClientManager.getJellyfinClient().getImageUrl(itemIdDetails.AlbumId, { type: "Primary" });
interactivemsghandler.updateCurrentSongMessage(itemIdDetails.Name, itemIdDetails.Artists[0] || "VA", imageURL,
`${jellyfinClientManager.getJellyfinClient().serverAddress()}/web/index.html#!/details?id=${itemIdDetails.AlbumId}`, itemIdDetails.RunTimeTicks, currentPlayingPlaylistIndex + 1, currentPlayingPlaylist.length);
}
}
@ -263,7 +263,6 @@ function setIsRepeat (arg) {
isRepeat = !isRepeat;
}
}
console.log("img being called and setting",arg,isRepeat);
isRepeat = arg;
}