General bug squishing
This commit is contained in:
parent
c2ecdacec4
commit
4e44579c1f
12 changed files with 62 additions and 61 deletions
|
@ -57,7 +57,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if embyid:
|
if embyid:
|
||||||
item = emby.getItem(embyid)
|
item = emby.getItem(embyid)
|
||||||
API = api.API(item)
|
API = PlexAPI.API(item)
|
||||||
userdata = API.getUserData()
|
userdata = API.getUserData()
|
||||||
likes = userdata['Likes']
|
likes = userdata['Likes']
|
||||||
favourite = userdata['Favorite']
|
favourite = userdata['Favorite']
|
||||||
|
@ -83,7 +83,7 @@ if __name__ == '__main__':
|
||||||
options.append(utils.language(30407))
|
options.append(utils.language(30407))
|
||||||
|
|
||||||
#delete item
|
#delete item
|
||||||
options.append(utils.language(30409))
|
# options.append(utils.language(30409))
|
||||||
|
|
||||||
#addon settings
|
#addon settings
|
||||||
options.append(utils.language(30408))
|
options.append(utils.language(30408))
|
||||||
|
|
|
@ -380,9 +380,7 @@
|
||||||
<string id="39301">Enter password for plex.tv user </string>
|
<string id="39301">Enter password for plex.tv user </string>
|
||||||
<string id="39302">Could not sign in user </string>
|
<string id="39302">Could not sign in user </string>
|
||||||
<string id="39303">Problems trying to contact plex.tv. Try again later</string>
|
<string id="39303">Problems trying to contact plex.tv. Try again later</string>
|
||||||
<string id="39304">Go to https://plex.tv/pin and enter the code:
|
<string id="39304">Go to https://plex.tv/pin and enter the code: </string>
|
||||||
|
|
||||||
</string>
|
|
||||||
<string id="39305">Could not sign in to plex.tv. Try again later</string>
|
<string id="39305">Could not sign in to plex.tv. Try again later</string>
|
||||||
<string id="39306">: Select User</string>
|
<string id="39306">: Select User</string>
|
||||||
<string id="39307">Enter PIN for user </string>
|
<string id="39307">Enter PIN for user </string>
|
||||||
|
|
|
@ -308,9 +308,7 @@
|
||||||
<string id="39301">Passwort eingeben für plex.tv Benutzer </string>
|
<string id="39301">Passwort eingeben für plex.tv Benutzer </string>
|
||||||
<string id="39302">Anmeldung fehlgeschlagen für Benutzer </string>
|
<string id="39302">Anmeldung fehlgeschlagen für Benutzer </string>
|
||||||
<string id="39303">Probleme beim Verbinden mit plex.tv. Bitte später erneut versuchen.</string>
|
<string id="39303">Probleme beim Verbinden mit plex.tv. Bitte später erneut versuchen.</string>
|
||||||
<string id="39304">https://plex.tv/pin besuchen und den folgenden Code eingeben:
|
<string id="39304">https://plex.tv/pin besuchen und den folgenden Code eingeben: </string>
|
||||||
|
|
||||||
</string>
|
|
||||||
<string id="39305">Anmeldung bei plex.tv fehlgeschlagen. Bitte später erneut versuchen.</string>
|
<string id="39305">Anmeldung bei plex.tv fehlgeschlagen. Bitte später erneut versuchen.</string>
|
||||||
<string id="39306">: Benutzer auswählen</string>
|
<string id="39306">: Benutzer auswählen</string>
|
||||||
<string id="39307">PIN eingeben für Benutzer </string>
|
<string id="39307">PIN eingeben für Benutzer </string>
|
||||||
|
|
|
@ -172,7 +172,7 @@ class PlexAPI():
|
||||||
return False
|
return False
|
||||||
# Go to https://plex.tv/pin and enter the code:
|
# Go to https://plex.tv/pin and enter the code:
|
||||||
answer = dialog.yesno(self.addonName,
|
answer = dialog.yesno(self.addonName,
|
||||||
string(39304),
|
string(39304) + "\n\n",
|
||||||
code)
|
code)
|
||||||
if not answer:
|
if not answer:
|
||||||
return False
|
return False
|
||||||
|
@ -1167,7 +1167,12 @@ class PlexAPI():
|
||||||
self.logMsg('Error: plex.tv switch HomeUser change failed', -1)
|
self.logMsg('Error: plex.tv switch HomeUser change failed', -1)
|
||||||
return ('', '')
|
return ('', '')
|
||||||
self.logMsg('Plex.tv switch HomeUser change successfull', 0)
|
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)
|
return (username, token)
|
||||||
|
|
||||||
def MyPlexListHomeUsers(self, authtoken):
|
def MyPlexListHomeUsers(self, authtoken):
|
||||||
|
|
|
@ -506,11 +506,11 @@ def getAllArtwork(self, item, parentInfo=False):
|
||||||
maxWidth = 10000
|
maxWidth = 10000
|
||||||
customquery = ""
|
customquery = ""
|
||||||
|
|
||||||
if utils.settings('compressArt') == "true":
|
# if utils.settings('compressArt') == "true":
|
||||||
customquery = "&Quality=90"
|
# customquery = "&Quality=90"
|
||||||
|
|
||||||
if utils.settings('enableCoverArt') == "false":
|
# if utils.settings('enableCoverArt') == "false":
|
||||||
customquery += "&EnableImageEnhancers=false"
|
# customquery += "&EnableImageEnhancers=false"
|
||||||
|
|
||||||
allartworks = {
|
allartworks = {
|
||||||
|
|
||||||
|
|
|
@ -114,32 +114,32 @@ class DownloadUtils():
|
||||||
utils.window('emby_sessionId', value=sessionId)
|
utils.window('emby_sessionId', value=sessionId)
|
||||||
|
|
||||||
# Post any permanent additional users
|
# Post any permanent additional users
|
||||||
additionalUsers = utils.settings('additionalUsers')
|
# additionalUsers = utils.settings('additionalUsers')
|
||||||
if additionalUsers:
|
# if additionalUsers:
|
||||||
|
|
||||||
additionalUsers = additionalUsers.split(',')
|
# additionalUsers = additionalUsers.split(',')
|
||||||
self.logMsg(
|
# self.logMsg(
|
||||||
"List of permanent users added to the session: %s"
|
# "List of permanent users added to the session: %s"
|
||||||
% additionalUsers, 1)
|
# % additionalUsers, 1)
|
||||||
|
|
||||||
# Get the user list from server to get the userId
|
# # Get the user list from server to get the userId
|
||||||
url = "{server}/emby/Users?format=json"
|
# url = "{server}/emby/Users?format=json"
|
||||||
result = self.downloadUrl(url)
|
# result = self.downloadUrl(url)
|
||||||
|
|
||||||
for additional in additionalUsers:
|
# for additional in additionalUsers:
|
||||||
addUser = additional.decode('utf-8').lower()
|
# addUser = additional.decode('utf-8').lower()
|
||||||
|
|
||||||
# Compare to server users to list of permanent additional users
|
# # Compare to server users to list of permanent additional users
|
||||||
for user in result:
|
# for user in result:
|
||||||
username = user['Name'].lower()
|
# username = user['Name'].lower()
|
||||||
|
|
||||||
if username in addUser:
|
# if username in addUser:
|
||||||
userId = user['Id']
|
# userId = user['Id']
|
||||||
url = (
|
# url = (
|
||||||
"{server}/emby/Sessions/%s/Users/%s?format=json"
|
# "{server}/emby/Sessions/%s/Users/%s?format=json"
|
||||||
% (sessionId, userId)
|
# % (sessionId, userId)
|
||||||
)
|
# )
|
||||||
self.downloadUrl(url, postBody={}, type="POST")
|
# self.downloadUrl(url, postBody={}, type="POST")
|
||||||
|
|
||||||
|
|
||||||
def startSession(self):
|
def startSession(self):
|
||||||
|
|
|
@ -358,7 +358,7 @@ def switchPlexUser():
|
||||||
# Pause library sync thread - user needs to be auth in order to sync
|
# Pause library sync thread - user needs to be auth in order to sync
|
||||||
utils.window('suspend_LibraryThread', value='true')
|
utils.window('suspend_LibraryThread', value='true')
|
||||||
# Wait to ensure that any sync already going on has finished
|
# 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)
|
xbmc.sleep(1000)
|
||||||
# Log out currently signed in user:
|
# Log out currently signed in user:
|
||||||
utils.window('emby_serverStatus', value="401")
|
utils.window('emby_serverStatus', value="401")
|
||||||
|
|
|
@ -36,11 +36,10 @@ class Items(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.doUtils = downloadutils.DownloadUtils()
|
self.doUtils = downloadutils.DownloadUtils()
|
||||||
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
||||||
self.directpath = utils.settings('useDirectPaths') == "1"
|
# self.directpath = utils.settings('useDirectPaths') == "1"
|
||||||
self.music_enabled = utils.settings('enableMusic') == "true"
|
self.directpath = False
|
||||||
self.contentmsg = utils.settings('newContent') == "true"
|
# self.music_enabled = utils.settings('enableMusic') == "true"
|
||||||
self.newvideo_time = int(utils.settings('newvideotime'))*1000
|
# self.contentmsg = utils.settings('newContent') == "true"
|
||||||
self.newmusic_time = int(utils.settings('newmusictime'))*1000
|
|
||||||
|
|
||||||
self.artwork = artwork.Artwork()
|
self.artwork = artwork.Artwork()
|
||||||
self.emby = embyserver.Read_EmbyServer()
|
self.emby = embyserver.Read_EmbyServer()
|
||||||
|
|
|
@ -1095,7 +1095,11 @@ class LibrarySync(Thread):
|
||||||
def compareDBVersion(self, current, minimum):
|
def compareDBVersion(self, current, minimum):
|
||||||
# It returns True is database is up to date. False otherwise.
|
# It returns True is database is up to date. False otherwise.
|
||||||
self.logMsg("current: %s minimum: %s" % (current, minimum), 1)
|
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(".")
|
minMajor, minMinor, minPatch = minimum.split(".")
|
||||||
|
|
||||||
if currMajor > minMajor:
|
if currMajor > minMajor:
|
||||||
|
|
|
@ -285,7 +285,7 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
# Start DownloadUtils session
|
# Start DownloadUtils session
|
||||||
doUtils.startSession()
|
doUtils.startSession()
|
||||||
self.getAdditionalUsers()
|
# self.getAdditionalUsers()
|
||||||
# Set user preferences in settings
|
# Set user preferences in settings
|
||||||
self.currUser = username
|
self.currUser = username
|
||||||
self.setUserPref()
|
self.setUserPref()
|
||||||
|
@ -367,7 +367,7 @@ class UserClient(threading.Thread):
|
||||||
window('plex_machineIdentifier', plex_machineIdentifier)
|
window('plex_machineIdentifier', plex_machineIdentifier)
|
||||||
self.retry = 0
|
self.retry = 0
|
||||||
# Make sure that lib sync thread is not paused
|
# Make sure that lib sync thread is not paused
|
||||||
utils.window('suspend_LibraryThread', value='false')
|
utils.window('suspend_LibraryThread', clear=True)
|
||||||
else:
|
else:
|
||||||
self.logMsg("Error: user authentication failed.", -1)
|
self.logMsg("Error: user authentication failed.", -1)
|
||||||
settings('accessToken', value="")
|
settings('accessToken', value="")
|
||||||
|
@ -385,19 +385,22 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
def resetClient(self):
|
def resetClient(self):
|
||||||
self.logMsg("Reset UserClient authentication.", 1)
|
self.logMsg("Reset UserClient authentication.", 1)
|
||||||
username = self.getUsername()
|
|
||||||
|
|
||||||
utils.settings('accessToken', value="")
|
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.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.auth = True
|
||||||
self.currUser = None
|
self.currUser = None
|
||||||
|
self.currUserId = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
log = self.logMsg
|
log = self.logMsg
|
||||||
window = utils.window
|
window = utils.window
|
||||||
|
# Start library sync thread in a suspended mode, until signed in
|
||||||
|
utils.window('suspend_LibraryThread', value="true")
|
||||||
|
|
||||||
log("----===## Starting UserClient ##===----", 0)
|
log("----===## Starting UserClient ##===----", 0)
|
||||||
while not self.threadStopped():
|
while not self.threadStopped():
|
||||||
|
@ -420,7 +423,6 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
if self.auth and (self.currUser is None):
|
if self.auth and (self.currUser is None):
|
||||||
# Try to authenticate user
|
# Try to authenticate user
|
||||||
status = window('emby_serverStatus')
|
|
||||||
if not status or status == "Auth":
|
if not status or status == "Auth":
|
||||||
# Set auth flag because we no longer need
|
# Set auth flag because we no longer need
|
||||||
# to authenticate the user
|
# to authenticate the user
|
||||||
|
@ -431,7 +433,6 @@ class UserClient(threading.Thread):
|
||||||
# If authenticate failed.
|
# If authenticate failed.
|
||||||
server = self.getServer()
|
server = self.getServer()
|
||||||
username = self.getUsername()
|
username = self.getUsername()
|
||||||
status = window('emby_serverStatus')
|
|
||||||
|
|
||||||
# The status Stop is for when user cancelled password dialog.
|
# The status Stop is for when user cancelled password dialog.
|
||||||
if server and username and status != "Stop":
|
if server and username and status != "Stop":
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</category>
|
</category>
|
||||||
<category label="30506"><!-- Sync Options -->
|
<category label="30506"><!-- Sync Options -->
|
||||||
<setting id="serverSync" type="bool" label="30514" default="true" visible="false"/><!-- Enable fast startup (requires server plugin) -->
|
<setting id="serverSync" type="bool" label="30514" default="true" visible="false"/><!-- Enable fast startup (requires server plugin) -->
|
||||||
<setting id="dbSyncIndicator" label="30507" type="bool" default="false" />
|
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" />
|
||||||
<setting type="sep" /><!-- show syncing progress -->
|
<setting type="sep" /><!-- show syncing progress -->
|
||||||
<setting id="limitindex" type="number" label="30515" default="200" option="int" visible="false"/><!-- Maximum items to request from the server at once -->
|
<setting id="limitindex" type="number" label="30515" default="200" option="int" visible="false"/><!-- Maximum items to request from the server at once -->
|
||||||
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Force Artwork Caching -->
|
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Force Artwork Caching -->
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<setting id="connectMsg" type="bool" label="30249" default="true" visible="false" />
|
<setting id="connectMsg" type="bool" label="30249" default="true" visible="false" />
|
||||||
<setting id="restartMsg" type="bool" label="30530" default="false" visible="false" />
|
<setting id="restartMsg" type="bool" label="30530" default="false" visible="false" />
|
||||||
<setting id="newContent" type="bool" label="30531" default="false" visible="false" />
|
<setting id="newContent" type="bool" label="30531" default="false" visible="false" />
|
||||||
<setting id="newvideotime" type="number" label="30532" visible="false" default="5" option="int" subsetting="true" />
|
<setting id="newvideotime" type="number" label="30532" visible="false" default="5" option="int" subsetting="true" />
|
||||||
<setting id="newmusictime" type="number" label="30533" visible="false" default="2" option="int" subsetting="true" />
|
<setting id="newmusictime" type="number" label="30533" visible="false" default="2" option="int" subsetting="true" />
|
||||||
</category>
|
</category>
|
||||||
-->
|
-->
|
||||||
|
|
16
service.py
16
service.py
|
@ -1,26 +1,23 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
# import time
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import _strptime
|
|
||||||
import xbmcvfs
|
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
|
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
|
||||||
addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
||||||
base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
|
base_resource = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
|
||||||
sys.path.append(base_resource)
|
sys.path.append(base_resource)
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
import userclient
|
import userclient
|
||||||
import clientinfo
|
import clientinfo
|
||||||
|
@ -34,7 +31,7 @@ import videonodes
|
||||||
import PlexAPI
|
import PlexAPI
|
||||||
import PlexCompanion
|
import PlexCompanion
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
@utils.logging
|
@utils.logging
|
||||||
|
@ -50,7 +47,6 @@ class Service():
|
||||||
kodimonitor_running = False
|
kodimonitor_running = False
|
||||||
plexCompanion_running = False
|
plexCompanion_running = False
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
log = self.logMsg
|
log = self.logMsg
|
||||||
|
@ -170,7 +166,7 @@ class Service():
|
||||||
else:
|
else:
|
||||||
# Start up events
|
# Start up events
|
||||||
self.warn_auth = True
|
self.warn_auth = True
|
||||||
if utils.settings('connectMsg') == "true" and self.welcome_msg:
|
if self.welcome_msg:
|
||||||
# Reset authentication warnings
|
# Reset authentication warnings
|
||||||
self.welcome_msg = False
|
self.welcome_msg = False
|
||||||
# Get additional users
|
# Get additional users
|
||||||
|
@ -184,7 +180,7 @@ class Service():
|
||||||
message=("%s %s%s!"
|
message=("%s %s%s!"
|
||||||
% (lang(33000), user.currUser.decode('utf-8'),
|
% (lang(33000), user.currUser.decode('utf-8'),
|
||||||
add.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,
|
time=2000,
|
||||||
sound=False)
|
sound=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue