Merge pull request #1275 from croneter/beta-version

Bump master
This commit is contained in:
croneter 2021-01-11 16:27:33 +01:00 committed by GitHub
commit acf446dcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 35 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.12.6" provider-name="croneter"> <addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.12.8" provider-name="croneter">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="2.9.1" /> <import addon="script.module.requests" version="2.9.1" />
@ -83,7 +83,14 @@
<summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary> <summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary>
<description lang="lt_LT">Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika!</description> <description lang="lt_LT">Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika!</description>
<disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer> <disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer>
<news>version 2.12.6: <news>version 2.12.8:
- version 2.12.7 for everyone
version 2.12.7 (beta only):
- Fix PKC suddenly using main Plex user's credentials, e.g. when the PMS address changed
- Fix missing Kodi tags for movie collections/sets
version 2.12.6:
- Fix rare KeyError when using PKC widgets - Fix rare KeyError when using PKC widgets
- Fix suspension of artwork caching and PKC becoming unresponsive - Fix suspension of artwork caching and PKC becoming unresponsive
- Update translations - Update translations

View file

@ -1,3 +1,10 @@
version 2.12.8:
- version 2.12.7 for everyone
version 2.12.7 (beta only):
- Fix PKC suddenly using main Plex user's credentials, e.g. when the PMS address changed
- Fix missing Kodi tags for movie collections/sets
version 2.12.6: version 2.12.6:
- Fix rare KeyError when using PKC widgets - Fix rare KeyError when using PKC widgets
- Fix suspension of artwork caching and PKC becoming unresponsive - Fix suspension of artwork caching and PKC becoming unresponsive

View file

@ -15,6 +15,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

@ -287,7 +287,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
@ -435,7 +434,6 @@ class InitialSetup(object):
utils.settings('plex_servername', server['name']) utils.settings('plex_servername', server['name'])
utils.settings('plex_serverowned', utils.settings('plex_serverowned',
'true' if server['owned'] else 'false') 'true' if server['owned'] else 'false')
utils.settings('accessToken', server['token'])
# Careful to distinguish local from remote PMS # Careful to distinguish local from remote PMS
if server['local']: if server['local']:
scheme = server['scheme'] scheme = server['scheme']

View file

@ -195,9 +195,10 @@ class Movie(ItemBase):
return True return True
def _process_collections(self, api, tags, kodi_id, section_id, children): def _process_collections(self, api, tags, kodi_id, section_id, children):
for _, set_name in api.collections():
tags.append(set_name)
for plex_set_id, set_name in api.collections(): for plex_set_id, set_name in api.collections():
set_api = None set_api = None
tags.append(set_name)
# Add any sets from Plex collection tags # Add any sets from Plex collection tags
kodi_set_id = self.kodidb.create_collection(set_name) kodi_set_id = self.kodidb.create_collection(set_name)
self.kodidb.assign_collection(kodi_set_id, kodi_id) self.kodidb.assign_collection(kodi_set_id, kodi_id)

View file

@ -164,7 +164,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

@ -35,18 +35,6 @@ class HomeUser(utils.AttributeDict):
return self.restricted == '1' return self.restricted == '1'
def homeuser_to_settings(user):
"""
Writes one HomeUser to the Kodi settings file
"""
utils.settings('myplexlogin', 'true')
utils.settings('plexLogin', user.title)
utils.settings('plexToken', user.authToken)
utils.settings('plexid', user.id)
utils.settings('plexAvatar', user.thumb)
utils.settings('plex_status', value=utils.lang(39227))
def switch_home_user(userid, pin, token, machine_identifier): def switch_home_user(userid, pin, token, machine_identifier):
""" """
Retrieves Plex home token for a Plex home user. Returns None if this fails Retrieves Plex home token for a Plex home user. Returns None if this fails
@ -59,8 +47,6 @@ def switch_home_user(userid, pin, token, machine_identifier):
Output: Output:
usertoken Might be empty strings if no token found usertoken Might be empty strings if no token found
for the machine_identifier that was chosen for the machine_identifier that was chosen
utils.settings('userid') and utils.settings('username') with new plex token
""" """
LOG.info('Switching to user %s', userid) LOG.info('Switching to user %s', userid)
url = 'https://plex.tv/api/home/users/%s/switch' % userid url = 'https://plex.tv/api/home/users/%s/switch' % userid
@ -79,16 +65,6 @@ def switch_home_user(userid, pin, token, machine_identifier):
username = xml.get('title', '') username = xml.get('title', '')
token = xml.get('authenticationToken', '') token = xml.get('authenticationToken', '')
# Write to settings file
utils.settings('username', username)
utils.settings('accessToken', token)
utils.settings('userid', xml.get('id', ''))
utils.settings('plex_restricteduser',
'true' if xml.get('restricted', '0') == '1'
else 'false')
app.CONN.restricted_user = True if \
xml.get('restricted', '0') == '1' else False
# Get final token to the PMS we've chosen # Get final token to the PMS we've chosen
url = 'https://plex.tv/api/resources?includeHttps=1' url = 'https://plex.tv/api/resources?includeHttps=1'
xml = DU().downloadUrl(url, xml = DU().downloadUrl(url,
@ -101,15 +77,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',
@ -232,7 +207,11 @@ def sign_in_with_pin():
if xml is None: if xml is None:
return return
user = HomeUser(xml.attrib) user = HomeUser(xml.attrib)
homeuser_to_settings(user) utils.settings('myplexlogin', 'true')
utils.settings('plex_status', value=utils.lang(39227))
utils.settings('plexLogin', user.title)
utils.settings('plexid', user.id)
utils.settings('plexToken', user.authToken)
return user return user

View file

@ -416,8 +416,11 @@ class Service(object):
utils.settings('username', value=username) utils.settings('username', value=username)
utils.settings('userid', value=user_id) utils.settings('userid', value=user_id)
utils.settings('accessToken', value=token) utils.settings('accessToken', value=token)
utils.settings('plex_restricteduser',
'true' if user.isManaged else 'false')
app.ACCOUNT.load() app.ACCOUNT.load()
app.ACCOUNT.set_authenticated() app.ACCOUNT.set_authenticated()
app.CONN.restricted_user = user.isManaged
return True return True
def ServiceEntryPoint(self): def ServiceEntryPoint(self):

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
""" """