Skip to content

Commit

Permalink
Merge pull request Schroedinger-Hat#130 from Schroedinger-Hat/bugfix/…
Browse files Browse the repository at this point in the history
…fix-uploading-of-episode

Bugfix/fix uploading of episode
  • Loading branch information
matevskial authored Oct 19, 2024
2 parents 82f133b + 6c6acb4 commit 474b7e9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/anchorfm-pupeteer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ async function postEpisode(youtubeVideoInfo) {
} else {
await spotifyLogin();
}
try {
logger('-- Waiting for navigation after logging in');
await page.waitForNavigation();
} catch (err) {
logger.info('-- The wait for navigation after logging failed or timed-out. Continuing.');
}

return Promise.any([acceptSpotifyAuth(), waitForNewEpisodeWizard()]).then((res) => {
if (res === SPOTIFY_AUTH_ACCEPTED) {
logger.info('-- Spotify auth accepted. Waiting for episode wizard to open again.');
Expand Down
24 changes: 22 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ main()
.then(() => logger.info('Finished successfully.'))
.catch((err) => {
logger.info(err);
exit(1);
exitFailure();
})
.finally(() => shutdownLogger());
.finally(() => {
exitSuccess();
});

function exitSuccess() {
try {
cleanUp();
} catch (err) {
/* empty */
}
exit(0);
}

function exitFailure() {
cleanUp();
exit(1);
}

function cleanUp() {
shutdownLogger();
}

0 comments on commit 474b7e9

Please sign in to comment.