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:
|
||||
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))
|
||||
|
|
|
@ -380,9 +380,7 @@
|
|||
<string id="39301">Enter password for plex.tv 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="39304">Go to https://plex.tv/pin and enter the code:
|
||||
|
||||
</string>
|
||||
<string id="39304">Go to https://plex.tv/pin and enter the code: </string>
|
||||
<string id="39305">Could not sign in to plex.tv. Try again later</string>
|
||||
<string id="39306">: Select 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="39302">Anmeldung fehlgeschlagen für Benutzer </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>
|
||||
<string id="39304">https://plex.tv/pin besuchen und den folgenden Code eingeben: </string>
|
||||
<string id="39305">Anmeldung bei plex.tv fehlgeschlagen. Bitte später erneut versuchen.</string>
|
||||
<string id="39306">: Benutzer auswählen</string>
|
||||
<string id="39307">PIN eingeben für Benutzer </string>
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 = {
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</category>
|
||||
<category label="30506"><!-- Sync Options -->
|
||||
<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 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 -->
|
||||
|
@ -86,7 +86,7 @@
|
|||
<setting id="connectMsg" type="bool" label="30249" default="true" 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="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" />
|
||||
</category>
|
||||
-->
|
||||
|
|
16
service.py
16
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue