This commit is contained in:
KGT1 2020-09-23 17:06:20 +02:00
parent 242ae2ffff
commit 212b9f658b
6 changed files with 17 additions and 34 deletions

View File

@ -15,6 +15,7 @@
"quotes": ["error", "double"], "quotes": ["error", "double"],
"indent": ["error", "tab"], "indent": ["error", "tab"],
"no-unused-vars": ["error"], "no-unused-vars": ["error"],
"no-tabs":["error",{"allowIndentationTabs":true}] "no-tabs":["error",{"allowIndentationTabs":true}],
"no-console":["warn",{"allow":["error"]}]
} }
} }

View File

@ -10,5 +10,5 @@ if (!configfile["jellyfin-password"]) { configfile["jellyfin-password"] = proces
if (!configfile["jellyfin-app-name"]) { configfile["jellyfin-app-name"] = process.env.JELLYFIN_APP_NAME; } if (!configfile["jellyfin-app-name"]) { configfile["jellyfin-app-name"] = process.env.JELLYFIN_APP_NAME; }
fs.writeFile(filename, JSON.stringify(configfile, null, 1), (err) => { fs.writeFile(filename, JSON.stringify(configfile, null, 1), (err) => {
if (err) return console.log(err); if (err) return console.error(err);
}); });

View File

@ -15,10 +15,6 @@ jellyfinClientManager.getJellyfinClient().authenticateUserByName(CONFIG["jellyfi
jellyfinClientManager.getJellyfinClient().setAuthenticationInfo(response.AccessToken, response.SessionInfo.UserId); jellyfinClientManager.getJellyfinClient().setAuthenticationInfo(response.AccessToken, response.SessionInfo.UserId);
}); });
discordClient.on("ready", () => {
console.log("connected to Discord");
});
discordClient.on("message", message => { discordClient.on("message", message => {
handleChannelMessage(message); handleChannelMessage(message);
}); });

View File

@ -29,7 +29,6 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
async function playasync () { async function playasync () {
const url = streamURLbuilder(itemID, voiceconnection.channel.bitrate); const url = streamURLbuilder(itemID, voiceconnection.channel.bitrate);
setAudioDispatcher(voiceconnection.play(url, { seek: seekTo })); setAudioDispatcher(voiceconnection.play(url, { seek: seekTo }));
console.log(seekTo, ticksToSeconds(getPostitionTicks()));
if (seekTo) { if (seekTo) {
jellyfinClientManager.getJellyfinClient().reportPlaybackProgress(getProgressPayload()); jellyfinClientManager.getJellyfinClient().reportPlaybackProgress(getProgressPayload());
} else { } else {
@ -44,7 +43,7 @@ function startPlaying (voiceconnection = discordclientmanager.getDiscordClient()
} }
}); });
} }
playasync().catch((rsn) => { console.log(rsn); }); playasync().catch((rsn) => { console.error(rsn); });
} }
/** /**
* @param {Number} toSeek - where to seek in ticks * @param {Number} toSeek - where to seek in ticks
@ -71,7 +70,6 @@ function stop (disconnectVoiceConnection) {
} }
function pause () { function pause () {
isPaused = true; isPaused = true;
console.log("here paused is changed", isPaused);
jellyfinClientManager.getJellyfinClient().reportPlaybackProgress(getProgressPayload()); jellyfinClientManager.getJellyfinClient().reportPlaybackProgress(getProgressPayload());
getAudioDispatcher().pause(true); getAudioDispatcher().pause(true);
} }

View File

@ -1,5 +1,4 @@
const jellyfinClientManager = require("./jellyfinclientmanager"); const jellyfinClientManager = require("./jellyfinclientmanager");
const discordclientmanager = require("./discordclientmanager");
const playbackmanager = require("./playbackmanager"); const playbackmanager = require("./playbackmanager");
function openSocket () { function openSocket () {
@ -11,17 +10,6 @@ function openSocket () {
SupportedCommands: "Play,Playstate" SupportedCommands: "Play,Playstate"
} }
); );
jellyfinClientManager.getJellyfinClient().ajax({
type: 'POST',
url: jellyfinClientManager.getJellyfinClient().getUrl('system/info/public'),
data: JSON.stringify({}),
contentType: 'application/json'
}).then((resp)=>{console.log(resp)})
jellyfinClientManager.getJellyfinEvents().on(jellyfinClientManager.getJellyfinClient(), "message", (type, data) => { jellyfinClientManager.getJellyfinEvents().on(jellyfinClientManager.getJellyfinClient(), "message", (type, data) => {
if (data.MessageType === "Play") { if (data.MessageType === "Play") {
if (data.Data.PlayCommand === "PlayNow") { if (data.Data.PlayCommand === "PlayNow") {