Fix more bugs

initialsetup, librarysync, videonodes, capture version error so it can
be fixed - currently don't know what's causing this particular error.
This commit is contained in:
angelblue05 2016-10-22 20:21:00 -05:00
parent 47cc86eeb9
commit 8d7aaac10f
4 changed files with 17 additions and 12 deletions

View file

@ -95,11 +95,7 @@ class InitialSetup(object):
if settings('server'): if settings('server'):
current_state = self.connectmanager.get_state() current_state = self.connectmanager.get_state()
if current_state['State'] == STATE['ConnectSignIn']: try:
# Failed to identify server
return True
elif 'Servers' in current_state:
for server in current_state['Servers']: for server in current_state['Servers']:
if server['Id'] == settings('serverId'): if server['Id'] == settings('serverId'):
# Update token # Update token
@ -110,6 +106,8 @@ class InitialSetup(object):
server_address = self.connectmanager.get_address(server) server_address = self.connectmanager.get_address(server)
self._set_server(server_address, server) self._set_server(server_address, server)
log.info("Found server!") log.info("Found server!")
except Exception as error:
log.error(error)
return True return True

View file

@ -396,7 +396,7 @@ class LibrarySync(threading.Thread):
# Get views # Get views
result = self.doUtils("{server}/emby/Users/{UserId}/Views?format=json") result = self.doUtils("{server}/emby/Users/{UserId}/Views?format=json")
grouped_views = result['Items'] grouped_views = result['Items'] if 'Items' in result else []
ordered_views = self.emby.getViews(sortedlist=True) ordered_views = self.emby.getViews(sortedlist=True)
all_views = [] all_views = []
sorted_views = [] sorted_views = []
@ -830,8 +830,11 @@ class LibrarySync(threading.Thread):
# It returns True is database is up to date. False otherwise. # It returns True is database is up to date. False otherwise.
log.info("current: %s minimum: %s" % (current, minimum)) log.info("current: %s minimum: %s" % (current, minimum))
try:
currMajor, currMinor, currPatch = current.split(".") currMajor, currMinor, currPatch = current.split(".")
minMajor, minMinor, minPatch = minimum.split(".") minMajor, minMinor, minPatch = minimum.split(".")
except ValueError as error:
raise ValueError("Unable to compare versions: %s, %s" % (current, minimum))
if currMajor > minMajor: if currMajor > minMajor:
return True return True

View file

@ -421,7 +421,7 @@ def reset():
cursor.execute("DELETE FROM " + tablename) cursor.execute("DELETE FROM " + tablename)
cursor.execute('DROP table IF EXISTS emby') cursor.execute('DROP table IF EXISTS emby')
cursor.execute('DROP table IF EXISTS view') cursor.execute('DROP table IF EXISTS view')
cursor.execute("DELETE FROM version") cursor.execute("DROP table IF EXISTS version")
connection.commit() connection.commit()
cursor.close() cursor.close()

View file

@ -62,9 +62,13 @@ class VideoNodes(object):
# Verify the video directory # Verify the video directory
if not xbmcvfs.exists(path): if not xbmcvfs.exists(path):
try:
shutil.copytree( shutil.copytree(
src=xbmc.translatePath("special://xbmc/system/library/video").decode('utf-8'), src=xbmc.translatePath("special://xbmc/system/library/video").decode('utf-8'),
dst=xbmc.translatePath("special://profile/library/video").decode('utf-8')) dst=xbmc.translatePath("special://profile/library/video").decode('utf-8'))
except Exception as error:
log.error(error)
xbmcvfs.exists(path) xbmcvfs.exists(path)
if delete: if delete: