mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-01-24 17:06:11 +00:00
Pylint + Fix initial setup for fresh installs
This commit is contained in:
parent
d36bb3d232
commit
3d31568518
13 changed files with 37 additions and 45 deletions
|
@ -26,31 +26,31 @@ class ClientInfo(object):
|
|||
|
||||
self.addon = xbmcaddon.Addon()
|
||||
|
||||
def getAddonName(self):
|
||||
def get_addon_name(self):
|
||||
# Used for logging
|
||||
return self.addon.getAddonInfo('name').upper()
|
||||
|
||||
@classmethod
|
||||
def getAddonId(cls):
|
||||
def get_addon_id(cls):
|
||||
return "plugin.video.emby"
|
||||
|
||||
def getVersion(self):
|
||||
def get_version(self):
|
||||
return self.addon.getAddonInfo('version')
|
||||
|
||||
@classmethod
|
||||
def getDeviceName(cls):
|
||||
def get_device_name(cls):
|
||||
|
||||
if settings('deviceNameOpt') == "false":
|
||||
# Use Kodi's deviceName
|
||||
deviceName = xbmc.getInfoLabel('System.FriendlyName').decode('utf-8')
|
||||
device_name = xbmc.getInfoLabel('System.FriendlyName').decode('utf-8')
|
||||
else:
|
||||
deviceName = settings('deviceName')
|
||||
deviceName = deviceName.replace("\"", "_")
|
||||
deviceName = deviceName.replace("/", "_")
|
||||
device_name = settings('deviceName')
|
||||
device_name = device_name.replace("\"", "_")
|
||||
device_name = device_name.replace("/", "_")
|
||||
|
||||
return deviceName
|
||||
return device_name
|
||||
|
||||
def getPlatform(self):
|
||||
def get_platform(self):
|
||||
|
||||
if xbmc.getCondVisibility('system.platform.osx'):
|
||||
return "OSX"
|
||||
|
@ -69,7 +69,7 @@ class ClientInfo(object):
|
|||
else:
|
||||
return "Unknown"
|
||||
|
||||
def getDeviceId(self, reset=False):
|
||||
def get_device_id(self, reset=False):
|
||||
|
||||
client_id = window('emby_deviceId')
|
||||
if client_id:
|
||||
|
|
|
@ -35,9 +35,9 @@ class ConnectManager(object):
|
|||
client_info = clientinfo.ClientInfo()
|
||||
self.emby = embyserver.Read_EmbyServer()
|
||||
|
||||
version = client_info.getVersion()
|
||||
device_name = client_info.getDeviceName()
|
||||
device_id = client_info.getDeviceId()
|
||||
version = client_info.get_version()
|
||||
device_name = client_info.get_device_name()
|
||||
device_id = client_info.get_device_id()
|
||||
|
||||
self._connect = connectionmanager.ConnectionManager(appName="Kodi",
|
||||
appVersion=version,
|
||||
|
|
|
@ -132,7 +132,7 @@ class DownloadUtils():
|
|||
|
||||
def startSession(self):
|
||||
|
||||
self.deviceId = self.clientInfo.getDeviceId()
|
||||
self.deviceId = self.clientInfo.get_device_id()
|
||||
|
||||
# User is identified from this point
|
||||
# Attach authenticated header to the session
|
||||
|
@ -163,10 +163,10 @@ class DownloadUtils():
|
|||
|
||||
def getHeader(self, authenticate=True):
|
||||
|
||||
deviceName = self.clientInfo.getDeviceName()
|
||||
deviceName = self.clientInfo.get_device_name()
|
||||
deviceName = deviceName.encode('utf-8')
|
||||
deviceId = self.clientInfo.getDeviceId()
|
||||
version = self.clientInfo.getVersion()
|
||||
deviceId = self.clientInfo.get_device_id()
|
||||
version = self.clientInfo.get_version()
|
||||
|
||||
if authenticate:
|
||||
auth = (
|
||||
|
|
|
@ -143,7 +143,7 @@ def resetDeviceId():
|
|||
deviceId_old = window('emby_deviceId')
|
||||
try:
|
||||
window('emby_deviceId', clear=True)
|
||||
deviceId = clientinfo.ClientInfo().getDeviceId(reset=True)
|
||||
deviceId = clientinfo.ClientInfo().get_device_id(reset=True)
|
||||
except Exception as e:
|
||||
log.error("Failed to generate a new device Id: %s" % e)
|
||||
dialog.ok(
|
||||
|
@ -208,8 +208,8 @@ def addUser():
|
|||
doUtils = downloadutils.DownloadUtils()
|
||||
art = artwork.Artwork()
|
||||
clientInfo = clientinfo.ClientInfo()
|
||||
deviceId = clientInfo.getDeviceId()
|
||||
deviceName = clientInfo.getDeviceName()
|
||||
deviceId = clientInfo.get_device_id()
|
||||
deviceName = clientInfo.get_device_name()
|
||||
userid = window('emby_currUser')
|
||||
dialog = xbmcgui.Dialog()
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class InitialSetup(object):
|
|||
|
||||
def __init__(self):
|
||||
|
||||
self.addon_id = clientinfo.ClientInfo().getAddonId()
|
||||
self.addon_id = clientinfo.ClientInfo().get_addon_id()
|
||||
self.user_client = userclient.UserClient()
|
||||
self.connectmanager = connectmanager.ConnectManager()
|
||||
|
||||
|
@ -43,7 +43,9 @@ class InitialSetup(object):
|
|||
###$ Begin migration $###
|
||||
if settings('server') == "":
|
||||
current_server = self.user_client.get_server()
|
||||
if current_server is not None:
|
||||
server = self.connectmanager.get_server(current_server)
|
||||
log.info(server)
|
||||
settings('ServerId', value=server['Id'])
|
||||
self.user_client.get_userid()
|
||||
self.user_client.get_token()
|
||||
|
|
|
@ -13,7 +13,6 @@ import xbmcvfs
|
|||
|
||||
import api
|
||||
import artwork
|
||||
import clientinfo
|
||||
import downloadutils
|
||||
import embydb_functions as embydb
|
||||
import kodidb_functions as kodidb
|
||||
|
@ -36,8 +35,6 @@ class Items(object):
|
|||
self.embycursor = embycursor
|
||||
self.kodicursor = kodicursor
|
||||
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.addonName = self.clientInfo.getAddonName()
|
||||
self.doUtils = downloadutils.DownloadUtils()
|
||||
|
||||
self.kodiversion = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
|
|
|
@ -8,7 +8,6 @@ import xbmc
|
|||
|
||||
import api
|
||||
import artwork
|
||||
import clientinfo
|
||||
|
||||
#################################################################################################
|
||||
|
||||
|
@ -25,8 +24,6 @@ class Kodidb_Functions():
|
|||
|
||||
self.cursor = cursor
|
||||
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.addonName = self.clientInfo.getAddonName()
|
||||
self.artwork = artwork.Artwork()
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import logging
|
|||
import xbmc
|
||||
import xbmcgui
|
||||
|
||||
import clientinfo
|
||||
import downloadutils
|
||||
import embydb_functions as embydb
|
||||
import playbackutils as pbutils
|
||||
|
@ -26,8 +25,6 @@ class KodiMonitor(xbmc.Monitor):
|
|||
|
||||
def __init__(self):
|
||||
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.addonName = self.clientInfo.getAddonName()
|
||||
self.doUtils = downloadutils.DownloadUtils()
|
||||
|
||||
log.info("Kodi monitor started.")
|
||||
|
|
|
@ -53,7 +53,6 @@ class LibrarySync(threading.Thread):
|
|||
self.monitor = xbmc.Monitor()
|
||||
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.addonName = self.clientInfo.getAddonName()
|
||||
self.doUtils = downloadutils.DownloadUtils().downloadUrl
|
||||
self.user = userclient.UserClient()
|
||||
self.emby = embyserver.Read_EmbyServer()
|
||||
|
@ -313,7 +312,7 @@ class LibrarySync(threading.Thread):
|
|||
embycursor.close()
|
||||
|
||||
settings('SyncInstallRunDone', value="true")
|
||||
settings("dbCreatedWithVersion", self.clientInfo.getVersion())
|
||||
settings("dbCreatedWithVersion", self.clientInfo.get_version())
|
||||
self.saveLastSync()
|
||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||
elapsedtotal = datetime.now() - starttotal
|
||||
|
|
|
@ -480,7 +480,7 @@ class Player(xbmc.Player):
|
|||
# Stop transcoding
|
||||
if playMethod == "Transcode":
|
||||
log.info("Transcoding for %s terminated." % itemid)
|
||||
deviceId = self.clientInfo.getDeviceId()
|
||||
deviceId = self.clientInfo.get_device_id()
|
||||
url = "{server}/emby/Videos/ActiveEncodings?DeviceId=%s" % deviceId
|
||||
self.doUtils(url, action_type="DELETE")
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ class PlayUtils():
|
|||
playurl = self.directPlay()
|
||||
else:
|
||||
itemid = self.item['Id']
|
||||
deviceId = self.clientInfo.getDeviceId()
|
||||
deviceId = self.clientInfo.get_device_id()
|
||||
playurl = (
|
||||
"%s/emby/Videos/%s/master.m3u8?MediaSourceId=%s"
|
||||
% (self.server, itemid, itemid)
|
||||
|
|
|
@ -39,7 +39,7 @@ class WebSocket_Client(threading.Thread):
|
|||
|
||||
self.doUtils = downloadutils.DownloadUtils()
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.deviceId = self.clientInfo.getDeviceId()
|
||||
self.deviceId = self.clientInfo.get_device_id()
|
||||
self.librarySync = librarysync.LibrarySync()
|
||||
|
||||
threading.Thread.__init__(self)
|
||||
|
|
|
@ -58,7 +58,7 @@ class Service(object):
|
|||
def __init__(self):
|
||||
|
||||
self.clientInfo = clientinfo.ClientInfo()
|
||||
self.addonName = self.clientInfo.getAddonName()
|
||||
self.addonName = self.clientInfo.get_addon_name()
|
||||
logLevel = settings('logLevel')
|
||||
self.monitor = xbmc.Monitor()
|
||||
|
||||
|
@ -68,9 +68,9 @@ class Service(object):
|
|||
# Initial logging
|
||||
log.warn("======== START %s ========" % self.addonName)
|
||||
log.warn("Python Version: %s", sys.version)
|
||||
log.warn("Platform: %s" % (self.clientInfo.getPlatform()))
|
||||
log.warn("Platform: %s" % (self.clientInfo.get_platform()))
|
||||
log.warn("KODI Version: %s" % xbmc.getInfoLabel('System.BuildVersion'))
|
||||
log.warn("%s Version: %s" % (self.addonName, self.clientInfo.getVersion()))
|
||||
log.warn("%s Version: %s" % (self.addonName, self.clientInfo.get_version()))
|
||||
log.warn("Using plugin paths: %s" % (settings('useDirectPaths') == "0"))
|
||||
log.warn("Log Level: %s" % logLevel)
|
||||
|
||||
|
|
Loading…
Reference in a new issue