feat(api): plex Sync (Movies)

Also adds winston logging
This commit is contained in:
sct
2020-09-27 14:05:32 +00:00
parent 5a43ec5405
commit 1be8b18361
19 changed files with 656 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
import axios, { AxiosInstance } from 'axios';
import xml2js from 'xml2js';
import { getSettings } from '../lib/settings';
import logger from '../logger';
interface PlexAccountResponse {
user: PlexUser;
@@ -79,9 +80,9 @@ class PlexTvAPI {
return account.data.user;
} catch (e) {
console.error(
'Something broke when getting account from plex.tv',
e.message
logger.error(
`Something went wrong getting the account from plex.tv: ${e.message}`,
{ label: 'Plex.tv API' }
);
throw new Error('Invalid auth token');
}
@@ -124,7 +125,7 @@ class PlexTvAPI {
(server) => server.$.machineIdentifier === settings.plex.machineId
);
} catch (e) {
console.log(`Error checking user access: ${e.message}`);
logger.error(`Error checking user access: ${e.message}`);
return false;
}
}