diff --git a/contextmenu.py b/contextmenu.py
index fb789fd1..891cd5e1 100644
--- a/contextmenu.py
+++ b/contextmenu.py
@@ -57,7 +57,7 @@ if __name__ == '__main__':
if embyid:
item = emby.getItem(embyid)
- API = api.API(item)
+ API = PlexAPI.API(item)
userdata = API.getUserData()
likes = userdata['Likes']
favourite = userdata['Favorite']
@@ -83,7 +83,7 @@ if __name__ == '__main__':
options.append(utils.language(30407))
#delete item
- options.append(utils.language(30409))
+ # options.append(utils.language(30409))
#addon settings
options.append(utils.language(30408))
diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index e58348f6..6aa9d3ce 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -380,9 +380,7 @@
Enter password for plex.tv user
Could not sign in user
Problems trying to contact plex.tv. Try again later
- Go to https://plex.tv/pin and enter the code:
-
-
+ Go to https://plex.tv/pin and enter the code:
Could not sign in to plex.tv. Try again later
: Select User
Enter PIN for user
diff --git a/resources/language/German/strings.xml b/resources/language/German/strings.xml
index d5ca8e7d..6ae78fc0 100644
--- a/resources/language/German/strings.xml
+++ b/resources/language/German/strings.xml
@@ -308,9 +308,7 @@
Passwort eingeben für plex.tv Benutzer
Anmeldung fehlgeschlagen für Benutzer
Probleme beim Verbinden mit plex.tv. Bitte später erneut versuchen.
- https://plex.tv/pin besuchen und den folgenden Code eingeben:
-
-
+ https://plex.tv/pin besuchen und den folgenden Code eingeben:
Anmeldung bei plex.tv fehlgeschlagen. Bitte später erneut versuchen.
: Benutzer auswählen
PIN eingeben für Benutzer
diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py
index 77682038..6a2d2bfa 100644
--- a/resources/lib/PlexAPI.py
+++ b/resources/lib/PlexAPI.py
@@ -172,7 +172,7 @@ class PlexAPI():
return False
# Go to https://plex.tv/pin and enter the code:
answer = dialog.yesno(self.addonName,
- string(39304),
+ string(39304) + "\n\n",
code)
if not answer:
return False
@@ -1167,7 +1167,12 @@ class PlexAPI():
self.logMsg('Error: plex.tv switch HomeUser change failed', -1)
return ('', '')
self.logMsg('Plex.tv switch HomeUser change successfull', 0)
- self.logMsg('username: %s, token: xxxx' % username, 0)
+ self.logMsg("username: %s, token: xxxx. "
+ "Saving to window and file settings" % username, 0)
+ utils.window('emby_currUser', value=userId)
+ utils.settings('userId%s' % username, value=userId)
+ utils.settings('username', value=username)
+ utils.window('emby_accessToken%s' % userId, value=token)
return (username, token)
def MyPlexListHomeUsers(self, authtoken):
diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py
index 7469f503..ca9af7ea 100644
--- a/resources/lib/artwork.py
+++ b/resources/lib/artwork.py
@@ -506,11 +506,11 @@ def getAllArtwork(self, item, parentInfo=False):
maxWidth = 10000
customquery = ""
- if utils.settings('compressArt') == "true":
- customquery = "&Quality=90"
+ # if utils.settings('compressArt') == "true":
+ # customquery = "&Quality=90"
- if utils.settings('enableCoverArt') == "false":
- customquery += "&EnableImageEnhancers=false"
+ # if utils.settings('enableCoverArt') == "false":
+ # customquery += "&EnableImageEnhancers=false"
allartworks = {
diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py
index 1e3ce015..e7826709 100644
--- a/resources/lib/downloadutils.py
+++ b/resources/lib/downloadutils.py
@@ -114,32 +114,32 @@ class DownloadUtils():
utils.window('emby_sessionId', value=sessionId)
# Post any permanent additional users
- additionalUsers = utils.settings('additionalUsers')
- if additionalUsers:
+ # additionalUsers = utils.settings('additionalUsers')
+ # if additionalUsers:
- additionalUsers = additionalUsers.split(',')
- self.logMsg(
- "List of permanent users added to the session: %s"
- % additionalUsers, 1)
+ # additionalUsers = additionalUsers.split(',')
+ # self.logMsg(
+ # "List of permanent users added to the session: %s"
+ # % additionalUsers, 1)
- # Get the user list from server to get the userId
- url = "{server}/emby/Users?format=json"
- result = self.downloadUrl(url)
+ # # Get the user list from server to get the userId
+ # url = "{server}/emby/Users?format=json"
+ # result = self.downloadUrl(url)
- for additional in additionalUsers:
- addUser = additional.decode('utf-8').lower()
+ # for additional in additionalUsers:
+ # addUser = additional.decode('utf-8').lower()
- # Compare to server users to list of permanent additional users
- for user in result:
- username = user['Name'].lower()
+ # # Compare to server users to list of permanent additional users
+ # for user in result:
+ # username = user['Name'].lower()
- if username in addUser:
- userId = user['Id']
- url = (
- "{server}/emby/Sessions/%s/Users/%s?format=json"
- % (sessionId, userId)
- )
- self.downloadUrl(url, postBody={}, type="POST")
+ # if username in addUser:
+ # userId = user['Id']
+ # url = (
+ # "{server}/emby/Sessions/%s/Users/%s?format=json"
+ # % (sessionId, userId)
+ # )
+ # self.downloadUrl(url, postBody={}, type="POST")
def startSession(self):
diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py
index d0638b97..ab454064 100644
--- a/resources/lib/entrypoint.py
+++ b/resources/lib/entrypoint.py
@@ -358,7 +358,7 @@ def switchPlexUser():
# Pause library sync thread - user needs to be auth in order to sync
utils.window('suspend_LibraryThread', value='true')
# Wait to ensure that any sync already going on has finished
- while utils.window('emby_dbScan' == 'true'):
+ while utils.window('emby_dbScan') == 'true':
xbmc.sleep(1000)
# Log out currently signed in user:
utils.window('emby_serverStatus', value="401")
diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py
index b19346da..88731aba 100644
--- a/resources/lib/itemtypes.py
+++ b/resources/lib/itemtypes.py
@@ -36,11 +36,10 @@ class Items(object):
def __init__(self):
self.doUtils = downloadutils.DownloadUtils()
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
- self.directpath = utils.settings('useDirectPaths') == "1"
- self.music_enabled = utils.settings('enableMusic') == "true"
- self.contentmsg = utils.settings('newContent') == "true"
- self.newvideo_time = int(utils.settings('newvideotime'))*1000
- self.newmusic_time = int(utils.settings('newmusictime'))*1000
+ # self.directpath = utils.settings('useDirectPaths') == "1"
+ self.directpath = False
+ # self.music_enabled = utils.settings('enableMusic') == "true"
+ # self.contentmsg = utils.settings('newContent') == "true"
self.artwork = artwork.Artwork()
self.emby = embyserver.Read_EmbyServer()
diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py
index 49634699..fa7a760b 100644
--- a/resources/lib/librarysync.py
+++ b/resources/lib/librarysync.py
@@ -1095,7 +1095,11 @@ class LibrarySync(Thread):
def compareDBVersion(self, current, minimum):
# It returns True is database is up to date. False otherwise.
self.logMsg("current: %s minimum: %s" % (current, minimum), 1)
- currMajor, currMinor, currPatch = current.split(".")
+ try:
+ currMajor, currMinor, currPatch = current.split(".")
+ except ValueError:
+ # there WAS no current DB, e.g. deleted.
+ return True
minMajor, minMinor, minPatch = minimum.split(".")
if currMajor > minMajor:
diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py
index a2c6cf17..f4f6dbc2 100644
--- a/resources/lib/userclient.py
+++ b/resources/lib/userclient.py
@@ -285,7 +285,7 @@ class UserClient(threading.Thread):
# Start DownloadUtils session
doUtils.startSession()
- self.getAdditionalUsers()
+ # self.getAdditionalUsers()
# Set user preferences in settings
self.currUser = username
self.setUserPref()
@@ -367,7 +367,7 @@ class UserClient(threading.Thread):
window('plex_machineIdentifier', plex_machineIdentifier)
self.retry = 0
# Make sure that lib sync thread is not paused
- utils.window('suspend_LibraryThread', value='false')
+ utils.window('suspend_LibraryThread', clear=True)
else:
self.logMsg("Error: user authentication failed.", -1)
settings('accessToken', value="")
@@ -385,19 +385,22 @@ class UserClient(threading.Thread):
def resetClient(self):
self.logMsg("Reset UserClient authentication.", 1)
- username = self.getUsername()
utils.settings('accessToken', value="")
- utils.window('emby_accessToken%s' % username, clear=True)
+ utils.window('emby_accessToken%s' % self.currUserId, clear=True)
self.currToken = None
- self.logMsg("User token has been removed.", 1)
+ self.logMsg("User token has been removed. Pausing Lib sync thread", 1)
+ utils.window('suspend_LibraryThread', value="true")
self.auth = True
self.currUser = None
+ self.currUserId = None
def run(self):
log = self.logMsg
window = utils.window
+ # Start library sync thread in a suspended mode, until signed in
+ utils.window('suspend_LibraryThread', value="true")
log("----===## Starting UserClient ##===----", 0)
while not self.threadStopped():
@@ -420,7 +423,6 @@ class UserClient(threading.Thread):
if self.auth and (self.currUser is None):
# Try to authenticate user
- status = window('emby_serverStatus')
if not status or status == "Auth":
# Set auth flag because we no longer need
# to authenticate the user
@@ -431,7 +433,6 @@ class UserClient(threading.Thread):
# If authenticate failed.
server = self.getServer()
username = self.getUsername()
- status = window('emby_serverStatus')
# The status Stop is for when user cancelled password dialog.
if server and username and status != "Stop":
diff --git a/resources/settings.xml b/resources/settings.xml
index d8b26868..faf5a9f2 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -41,7 +41,7 @@
-
+
@@ -86,7 +86,7 @@
-
+
-->
diff --git a/service.py b/service.py
index c7932137..f54c22ca 100644
--- a/service.py
+++ b/service.py
@@ -1,26 +1,23 @@
# -*- coding: utf-8 -*-
-#################################################################################################
+###############################################################################
import os
import sys
-# import time
from datetime import datetime
import xbmc
import xbmcaddon
import xbmcgui
-import _strptime
-import xbmcvfs
-#################################################################################################
+###############################################################################
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
addon_path = _addon.getAddonInfo('path').decode('utf-8')
base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
sys.path.append(base_resource)
-#################################################################################################
+###############################################################################
import userclient
import clientinfo
@@ -34,7 +31,7 @@ import videonodes
import PlexAPI
import PlexCompanion
-#################################################################################################
+###############################################################################
@utils.logging
@@ -50,7 +47,6 @@ class Service():
kodimonitor_running = False
plexCompanion_running = False
-
def __init__(self):
log = self.logMsg
@@ -170,7 +166,7 @@ class Service():
else:
# Start up events
self.warn_auth = True
- if utils.settings('connectMsg') == "true" and self.welcome_msg:
+ if self.welcome_msg:
# Reset authentication warnings
self.welcome_msg = False
# Get additional users
@@ -184,7 +180,7 @@ class Service():
message=("%s %s%s!"
% (lang(33000), user.currUser.decode('utf-8'),
add.decode('utf-8'))),
- icon="special://home/addons/plugin.video.emby/icon.png",
+ icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
time=2000,
sound=False)