Skip to content

Commit

Permalink
Disable plex on failure to connect in startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 5, 2024
1 parent 50f613a commit 9fe17e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/lib/Downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export class VideoDownloader {
promDownloadedTotal.inc();
}
}
return;
} catch (error) {
let message = error instanceof Error ? error.message : `Something weird happened, whatever was thrown was not a error! ${error}`;
if (message.includes("ffmpeg")) {
Expand Down
13 changes: 7 additions & 6 deletions src/quickStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export const promptPlexSections = async (): Promise<void> => {
settings.plex.sectionsToUpdate,
serverSections.flatMap((sections) => sections),
);
if (settings.plex.sectionsToUpdate.length === 0) {
console.log("No sectionsToUpdate in config! Disabling plex integration...\n");
settings.plex.enabled = false;
}
await validatePlexSettings();
};

export const validatePlexSettings = async (): Promise<void> => {
Expand All @@ -34,9 +31,13 @@ export const validatePlexSettings = async (): Promise<void> => {
settings.plex.token = await loginPlex();
}
if (settings.plex.sectionsToUpdate.length === 0) {
console.log("No plex sections specified to update!");
await promptPlexSections();
console.log("No sectionsToUpdate in config! Disabling plex integration...\n");
settings.plex.enabled = false;
}
await new MyPlexAccount(undefined, undefined, undefined, settings.plex.token).connect().catch((err) => {
console.error(`Failed to connect to plex, disabling plex refreshing! ${err.message}`);
settings.plex.enabled = false;
});
}
};

Expand Down

0 comments on commit 9fe17e9

Please sign in to comment.