-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.py
29 lines (24 loc) · 1.04 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
import os
from argparse import ArgumentParser
from resources.log import getLogger
from resources.settings import Settings
from resources.skipper import Skipper
from resources.server import getPlexServer
if __name__ == '__main__':
log = getLogger(__name__)
parser = ArgumentParser(description="Plex Autoskip")
parser.add_argument('-c', '--config', help='Specify an alternate configuration file location')
args = vars(parser.parse_args())
if args['config'] and os.path.exists(args['config']):
settings = Settings(args['config'], logger=log)
elif args['config'] and os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), args['config'])):
settings = Settings(os.path.join(os.path.dirname(sys.argv[0]), args['config']), logger=log)
else:
settings = Settings(logger=log)
plex, sslopt = getPlexServer(settings, log)
if plex:
skipper = Skipper(plex, settings, log)
skipper.start(sslopt=sslopt)
else:
log.error("Unable to establish Plex Server object via PlexAPI")