Improve some code

This commit is contained in:
croneter 2021-01-03 17:17:47 +01:00
parent a9a4d43cb2
commit 8d34e66764
5 changed files with 5 additions and 6 deletions

View file

@ -14,6 +14,8 @@ class Account(object):
self.plex_username = None self.plex_username = None
self.plex_user_id = None self.plex_user_id = None
self.plex_token = None self.plex_token = None
# Personal access token per specific user and PMS
# As a rule of thumb, always use this token!
self.pms_token = None self.pms_token = None
self.avatar = None self.avatar = None
self.myplexlogin = None self.myplexlogin = None

View file

@ -280,7 +280,6 @@ class InitialSetup(object):
} }
or None if unsuccessful or None if unsuccessful
""" """
server = None
# If no server is set, let user choose one # If no server is set, let user choose one
if not app.CONN.server or not app.CONN.machine_identifier: if not app.CONN.server or not app.CONN.machine_identifier:
showDialog = True showDialog = True

View file

@ -157,7 +157,7 @@ def check_connection(url, token=None, verifySSL=None):
def discover_pms(token=None): def discover_pms(token=None):
""" """
Optional parameter: Optional parameter:
token token for plex.tv token token for plex.tv - WARNING: for the main Plex user only!
Returns a list of available PMS to connect to, one entry is the dict: Returns a list of available PMS to connect to, one entry is the dict:
{ {

View file

@ -76,15 +76,14 @@ def switch_home_user(userid, pin, token, machine_identifier):
# Set to empty iterable list for loop # Set to empty iterable list for loop
xml = [] xml = []
found = 0
LOG.debug('Our machine_identifier is %s', machine_identifier) LOG.debug('Our machine_identifier is %s', machine_identifier)
for device in xml: for device in xml:
identifier = device.attrib.get('clientIdentifier') identifier = device.attrib.get('clientIdentifier')
LOG.debug('Found the Plex clientIdentifier: %s', identifier) LOG.debug('Found the Plex clientIdentifier: %s', identifier)
if identifier == machine_identifier: if identifier == machine_identifier:
found += 1
token = device.attrib.get('accessToken') token = device.attrib.get('accessToken')
if found == 0: break
else:
LOG.info('No tokens found for your server! Using empty string') LOG.info('No tokens found for your server! Using empty string')
token = '' token = ''
LOG.info('Plex.tv switch HomeUser change successfull for user %s', LOG.info('Plex.tv switch HomeUser change successfull for user %s',

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
:module: plexkodiconnect.userselect
:synopsis: Prompts the user to add network paths and username passwords for :synopsis: Prompts the user to add network paths and username passwords for
e.g. smb paths e.g. smb paths
""" """