diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 74508e10..318f1adb 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -60,17 +60,8 @@ try: except ImportError: import xml.etree.ElementTree as etree -# from Version import __VERSION__ -# from Debug import * # dprint(), prettyXML() - - -""" -storage for PMS addresses and additional information - now per aTV! (replaces global PMS_list) -syntax: PMS[][PMS_UUID][] - data: name, ip, ...type (local, myplex) -""" - +@utils.logging class PlexAPI(): # CONSTANTS # Timeout for POST/GET commands, I guess in seconds @@ -81,7 +72,6 @@ class PlexAPI(): self.__language__ = xbmcaddon.Addon().getLocalizedString self.g_PMS = {} client = clientinfo.ClientInfo() - self.addonName = client.getAddonName() self.addonId = client.getAddonId() self.clientId = client.getDeviceId() self.deviceName = client.getDeviceName() @@ -93,10 +83,6 @@ class PlexAPI(): self.doUtils = downloadutils.DownloadUtils() - def logMsg(self, msg, lvl=1): - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - def GetPlexLoginFromSettings(self): """ Returns empty strings if not found. @@ -1521,6 +1507,7 @@ class PlexAPI(): return xml +@utils.logging class API(): """ API(item) @@ -1537,7 +1524,6 @@ class API(): # which media part in the XML response shall we look at? self.part = 0 self.clientinfo = clientinfo.ClientInfo() - self.addonName = self.clientinfo.getAddonName() self.clientId = self.clientinfo.getDeviceId() self.userId = utils.window('emby_currUser') self.server = utils.window('emby_server%s' % self.userId) @@ -1545,10 +1531,6 @@ class API(): self.jumpback = int(utils.settings('resumeJumpBack')) - def logMsg(self, msg, lvl=1): - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - def setChildNumber(self, number=0): """ Which child in the XML response shall we look at and work with? diff --git a/resources/lib/PlexCompanion.py b/resources/lib/PlexCompanion.py index 307d348a..fa15836c 100644 --- a/resources/lib/PlexCompanion.py +++ b/resources/lib/PlexCompanion.py @@ -12,12 +12,12 @@ from plexbmchelper import listener, plexgdm, subscribers from plexbmchelper.settings import settings +@utils.logging @utils.ThreadMethods class PlexCompanion(threading.Thread): def __init__(self): self.port = int(utils.settings('companionPort')) ci = clientinfo.ClientInfo() - self.addonName = ci.getAddonName() self.clientId = ci.getDeviceId() self.deviceName = ci.getDeviceName() self.logMsg("----===## Starting PlexBMC Helper ##===----", 1) @@ -34,10 +34,6 @@ class PlexCompanion(threading.Thread): threading.Thread.__init__(self) - def logMsg(self, msg, lvl=1): - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - def run(self): start_count = 0 while True: diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 2af4a4e4..1b039b30 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -12,12 +12,12 @@ import xbmcgui import xbmcvfs import utils -import clientinfo import image_cache_thread ################################################################################################# +@utils.logging class Artwork(): xbmc_host = 'localhost' @@ -29,8 +29,6 @@ class Artwork(): imageCacheLimitThreads = 0 def __init__(self): - self.clientinfo = clientinfo.ClientInfo() - self.addonName = self.clientinfo.getAddonName() self.enableTextureCache = utils.settings('enableTextureCache') == "true" self.imageCacheLimitThreads = int(utils.settings("imageCacheLimit")) @@ -43,11 +41,6 @@ class Artwork(): self.userId = utils.window('emby_currUser') self.server = utils.window('emby_server%s' % self.userId) - def logMsg(self, msg, lvl=1): - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def double_urlencode(self, text): text = self.single_urlencode(text) text = self.single_urlencode(text) @@ -503,6 +496,7 @@ class Artwork(): % (self.server, itemid, itemtype)) return image + def getAllArtwork(self, item, parentInfo=False): server = self.server diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py index f7c55786..dfc0dfb9 100644 --- a/resources/lib/clientinfo.py +++ b/resources/lib/clientinfo.py @@ -14,19 +14,13 @@ import utils ################################################################################################# +@utils.logging class ClientInfo(): def __init__(self): self.addon = xbmcaddon.Addon() - self.addonName = self.getAddonName() - - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - def getAddonName(self): # Used for logging diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index 83a8ab75..92b98943 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -2,11 +2,11 @@ ################################################################################################## -import json +# import json import requests -import logging +# import logging -import xbmc +# import xbmc import xbmcgui import utils @@ -28,28 +28,21 @@ requests.packages.urllib3.disable_warnings(InsecureRequestWarning) ################################################################################################## +@utils.logging class DownloadUtils(): # Borg - multiple instances, shared state _shared_state = {} clientInfo = clientinfo.ClientInfo() - addonName = clientInfo.getAddonName() # Requests session s = None timeout = 30 - def __init__(self): self.__dict__ = self._shared_state - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def setUsername(self, username): # Reserved for userclient only self.username = username diff --git a/resources/lib/embydb_functions.py b/resources/lib/embydb_functions.py index df6cc54c..dd824b08 100644 --- a/resources/lib/embydb_functions.py +++ b/resources/lib/embydb_functions.py @@ -3,26 +3,17 @@ ################################################################################################# import utils -import clientinfo ################################################################################################# +@utils.logging class Embydb_Functions(): - def __init__(self, embycursor): self.embycursor = embycursor - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() - - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - def getViews(self): embycursor = self.embycursor diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 004a5df4..fd13b71b 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -21,7 +21,6 @@ import downloadutils import librarysync import read_embyserver as embyserver import embydb_functions as embydb -import playlist import playbackutils as pbutils import playutils import api diff --git a/resources/lib/image_cache_thread.py b/resources/lib/image_cache_thread.py index 626be481..71ebe574 100644 --- a/resources/lib/image_cache_thread.py +++ b/resources/lib/image_cache_thread.py @@ -3,6 +3,8 @@ import utils import xbmc import requests + +@utils.logging class image_cache_thread(threading.Thread): urlToProcess = None @@ -16,11 +18,7 @@ class image_cache_thread(threading.Thread): def __init__(self): self.monitor = xbmc.Monitor() threading.Thread.__init__(self) - - def logMsg(self, msg, lvl=1): - className = self.__class__.__name__ - utils.logMsg("%s" % className, msg, lvl) - + def setUrl(self, url): self.urlToProcess = url diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 4aac4b84..9dbe5608 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -16,6 +16,7 @@ import PlexAPI ################################################################################################# +@utils.logging class InitialSetup(): def __init__(self): @@ -24,16 +25,10 @@ class InitialSetup(): self.__language__ = self.addon.getLocalizedString self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.addonId = self.clientInfo.getAddonId() self.doUtils = downloadutils.DownloadUtils() self.userClient = userclient.UserClient() self.plx = PlexAPI.PlexAPI() - - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) def setup(self): """ diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 94c91e1d..9f4334d6 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -12,7 +12,6 @@ import xbmcvfs import api import artwork -import clientinfo import downloadutils import utils import embydb_functions as embydb @@ -20,11 +19,11 @@ import kodidb_functions as kodidb import read_embyserver as embyserver import musicutils as musicutils import PlexAPI -import sys ################################################################################################## +@utils.logging class Items(object): """ Items to be called with "with Items as xxx:" to ensure that __enter__ @@ -32,8 +31,6 @@ class Items(object): """ def __init__(self): - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2]) @@ -66,12 +63,6 @@ class Items(object): self.kodiconn.close() return self - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def itemsbyId(self, items, process, pdialog=None): # Process items by itemid. Process can be added, update, userdata, remove emby = self.emby diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 3929bb52..6fb08ed2 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -4,7 +4,6 @@ import xbmc -import api import artwork import clientinfo import utils @@ -12,25 +11,18 @@ import utils ################################################################################################## +@utils.logging class Kodidb_Functions(): kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2]) - def __init__(self, cursor): self.cursor = cursor self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.artwork = artwork.Artwork() - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def addPath(self, path): cursor = self.cursor diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 6adae64e..0c564dbd 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -7,7 +7,6 @@ import json import xbmc import xbmcgui -import clientinfo import downloadutils import embydb_functions as embydb import playbackutils as pbutils @@ -18,23 +17,16 @@ from urllib import urlencode ################################################################################################# +@utils.logging class KodiMonitor(xbmc.Monitor): def __init__(self): - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.logMsg("Kodi monitor started.", 1) - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - - def onScanStarted(self, library): self.logMsg("Kodi library scan %s running." % library, 2) if library == "video": diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index a0ff5781..c0823861 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -177,6 +177,7 @@ class ThreadedShowSyncInfo(threading.Thread): self.dialog.close() +@utils.logging @utils.ThreadMethodsStopsync @utils.ThreadMethods class LibrarySync(threading.Thread): @@ -196,7 +197,6 @@ class LibrarySync(threading.Thread): self.__dict__ = self._shared_state self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.user = userclient.UserClient() self.emby = embyserver.Read_EmbyServer() @@ -206,12 +206,6 @@ class LibrarySync(threading.Thread): threading.Thread.__init__(self) - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def progressDialog(self, title, forced=False): dialog = None diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index d21bbb99..5d1b304f 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -10,7 +10,6 @@ import xbmcgui import xbmcplugin import artwork -import clientinfo import downloadutils import playutils as putils import playlist @@ -22,6 +21,7 @@ import PlexAPI ################################################################################################# +@utils.logging class PlaybackUtils(): @@ -30,8 +30,6 @@ class PlaybackUtils(): self.item = item self.API = PlexAPI.API(self.item) - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.userid = utils.window('emby_currUser') @@ -42,11 +40,6 @@ class PlaybackUtils(): self.emby = embyserver.Read_EmbyServer() self.pl = playlist.Playlist() - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - def play(self, itemid, dbid=None, seektime=None): self.logMsg("Play called.", 1) diff --git a/resources/lib/player.py b/resources/lib/player.py index fde26a59..83feb5ee 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -10,7 +10,6 @@ import xbmcgui import utils import clientinfo import downloadutils -import kodidb_functions as kodidb import websocket_client as wsc from urllib import urlencode @@ -18,6 +17,7 @@ from urllib import urlencode ################################################################################################# +@utils.logging class Player(xbmc.Player): # Borg - multiple instances, shared state @@ -27,25 +27,17 @@ class Player(xbmc.Player): playStats = {} currentFile = None - def __init__(self): self.__dict__ = self._shared_state self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.ws = wsc.WebSocket_Client() self.xbmcplayer = xbmc.Player() self.logMsg("Starting playback monitor.", 2) - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - - def GetPlayStats(self): return self.playStats diff --git a/resources/lib/playlist.py b/resources/lib/playlist.py index c869f288..afc6dc43 100644 --- a/resources/lib/playlist.py +++ b/resources/lib/playlist.py @@ -6,9 +6,7 @@ import json import xbmc import xbmcgui -import xbmcplugin -import clientinfo import playutils import playbackutils import embydb_functions as embydb @@ -18,25 +16,15 @@ import utils ################################################################################################# +@utils.logging class Playlist(): - def __init__(self): - - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() - self.userid = utils.window('emby_currUser') self.server = utils.window('emby_server%s' % self.userid) self.emby = embyserver.Read_EmbyServer() - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - - def playAll(self, itemids, startat): embyconn = utils.kodiSQL('emby') diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index 041b5ed0..27125a8b 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -14,6 +14,7 @@ import PlexAPI ################################################################################################# +@utils.logging class PlayUtils(): @@ -22,7 +23,6 @@ class PlayUtils(): self.item = item self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.userid = utils.window('emby_currUser') self.server = utils.window('emby_server%s' % self.userid) @@ -30,12 +30,6 @@ class PlayUtils(): self.API = PlexAPI.API(item) - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - - def getPlayUrl(self, child=0, partIndex=None): item = self.item # NO, I am not very fond of this construct! diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index 78e0bd91..4c340c1b 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -3,32 +3,23 @@ ################################################################################################# import utils -import clientinfo import downloadutils ################################################################################################# +@utils.logging class Read_EmbyServer(): limitIndex = int(utils.settings('limitindex')) - def __init__(self): - self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.doUtils = downloadutils.DownloadUtils() self.userId = utils.window('emby_currUser') self.server = utils.window('emby_server%s' % self.userId) - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def split_list(self, itemlist, size): # Split up list in pieces of size. Will generate a list of lists return [itemlist[i:i+size] for i in range(0, len(itemlist), size)] diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index 1bfc151c..52cb4774 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -10,7 +10,6 @@ import xbmcaddon import xbmcvfs import utils -import clientinfo import downloadutils import PlexAPI @@ -19,6 +18,7 @@ import librarysync ################################################################################################## +@utils.logging @utils.ThreadMethods class UserClient(threading.Thread): @@ -37,23 +37,15 @@ class UserClient(threading.Thread): userSettings = None - def __init__(self): self.__dict__ = self.__shared_state self.addon = xbmcaddon.Addon() - self.addonName = clientinfo.ClientInfo().getAddonName() self.doUtils = downloadutils.DownloadUtils() threading.Thread.__init__(self) - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def getAdditionalUsers(self): additionalUsers = utils.settings('additionalUsers') diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 75c0246d..6e05a511 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -9,16 +9,18 @@ import sqlite3 import time import unicodedata import xml.etree.ElementTree as etree +from functools import wraps, update_wrapper import xbmc import xbmcaddon import xbmcgui import xbmcvfs -import clientinfo ################################################################################################# +addonName = xbmcaddon.Addon().getAddonInfo('name') + def ThreadMethodsStopsync(cls): """ @@ -82,32 +84,29 @@ def ThreadMethods(cls): return cls -class logDecor(object): +def logging(cls): """ - A decorator adding logging capabilities. + A decorator adding logging capabilities to classes. Also adds + self.addonName to the class Syntax: self.logMsg(message, loglevel) Loglevel: -2 (Error) to 2 (DB debug) """ - def __init__(self, f): - """ - If there are no decorator arguments, the function to be decorated is - passed to the constructor. - """ - self.f = f - self.addonName = clientinfo.ClientInfo().getAddonName() + # Attach new attributes to class + cls.addonName = addonName - def __call__(self, *args, **kwargs): - """ - The __call__ method is not called until the - decorated function is called. - """ - def decorLog(self, msg, lvl=1): - className = self.__class__.__name__ - logMsg("%s %s" % (self.addonName, className), msg, lvl) - # The function itself: - self.f(*args, **kwargs) + # Define new class methods and attach them to class + def newFunction(self, msg, lvl=0): + title = "%s %s" % (self.addonName, cls.__name__) + logMsg(title, msg, lvl) + cls.logMsg = newFunction + + # Override the name, we don't want the decorators name showing up + __name__ = cls.__name__ + + # Return class to render this a decorator + return cls def logMsg(title, msg, level=1): @@ -120,17 +119,21 @@ def logMsg(title, msg, level=1): if logLevel >= level: - if logLevel == 2: # inspect.stack() is expensive + if logLevel == 2: # inspect is expensive + func = inspect.currentframe().f_back.f_back.f_code try: - xbmc.log("%s -> %s : %s" % (title, inspect.stack()[1][3], msg)) + xbmc.log("%s -> %s : %s" % ( + title, func.co_name, msg)) except UnicodeEncodeError: - xbmc.log("%s -> %s : %s" % (title, inspect.stack()[1][3], msg.encode('utf-8'))) + xbmc.log("%s -> %s : %s" % ( + title, func.co_name, msg.encode('utf-8'))) else: try: xbmc.log("%s -> %s" % (title, msg)) except UnicodeEncodeError: xbmc.log("%s -> %s" % (title, msg.encode('utf-8'))) + def window(property, value=None, clear=False, windowid=10000): # Get or set window property WINDOW = xbmcgui.Window(windowid) diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 1356b23a..14d77e4a 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -6,31 +6,19 @@ import shutil import xml.etree.ElementTree as etree import xbmc -import xbmcaddon import xbmcvfs -import clientinfo import utils ################################################################################################# +@utils.logging class VideoNodes(object): - def __init__(self): - - clientInfo = clientinfo.ClientInfo() - self.addonName = clientInfo.getAddonName() - self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2]) - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def commonRoot(self, order, label, tagname, roottype=1): if roottype == 0: diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index dedd7cb8..6ef433a5 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -22,6 +22,7 @@ logging.basicConfig() ################################################################################################# +@utils.logging class WebSocket_Client(threading.Thread): _shared_state = {} @@ -37,18 +38,11 @@ class WebSocket_Client(threading.Thread): self.doUtils = downloadutils.DownloadUtils() self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() self.deviceId = self.clientInfo.getDeviceId() self.librarySync = librarysync.LibrarySync() threading.Thread.__init__(self) - def logMsg(self, msg, lvl=1): - - self.className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, self.className), msg, lvl) - - def sendProgressUpdate(self, data): self.logMsg("sendProgressUpdate", 2) try: diff --git a/service.py b/service.py index 3f1f33d5..55e8a18b 100644 --- a/service.py +++ b/service.py @@ -37,6 +37,7 @@ import PlexCompanion ################################################################################################# +@utils.logging class Service(): welcome_msg = True @@ -53,7 +54,6 @@ class Service(): def __init__(self): self.clientInfo = clientinfo.ClientInfo() - self.addonName = self.clientInfo.getAddonName() logLevel = userclient.UserClient().getLogLevel() self.monitor = xbmc.Monitor() @@ -89,12 +89,6 @@ class Service(): # Set the minimum database version utils.window('emby_minDBVersion', value="1.1.63") - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) - - def ServiceEntryPoint(self): # Important: Threads depending on abortRequest will not trigger # if profile switch happens more than once.