Skip to content

Commit

Permalink
switch to token for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
mtimkovich committed Dec 27, 2020
1 parent f9effcc commit 4cce42d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions config.ini.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[auth]
# Rename this file to 'config.ini' before running the script.
# Plex username and password.
username =
password =
# The name of your Plex server.
server =
# Plex server URL e.g. localhost:32400
baseurl =
# https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
token =
7 changes: 3 additions & 4 deletions plex2letterboxd/plex2letterboxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import csv
import sys

from plexapi.myplex import MyPlexAccount
from plexapi.server import PlexServer


def parse_args():
Expand All @@ -26,7 +26,7 @@ def parse_config(ini):
config = configparser.ConfigParser()
config.read(ini)
auth = config['auth']
missing = {'username', 'password', 'server'} - set(auth.keys())
missing = {'baseurl', 'token'} - set(auth.keys())
if missing:
print(f'Missing the following config values: {missing}')
sys.exit(1)
Expand Down Expand Up @@ -55,8 +55,7 @@ def main():
args = parse_args()
auth = parse_config(args.ini)

account = MyPlexAccount(auth['username'], auth['password'])
plex = account.resource(auth['server']).connect()
plex = PlexServer(auth['baseurl'], auth['token'])

sections = [plex.library.section(s) for s in args.sections]
write_csv(sections, args.output)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name='plex2letterboxd',
url='https://github.com/mtimkovich/plex2letterboxd',
version='1.1',
version='1.2',
author='Max Timkovich',
author_email='max@timkovi.ch',
license='MIT',
Expand Down

0 comments on commit 4cce42d

Please sign in to comment.