def main(): setup_logging() #Look busy while everything gets initialized show_busy_dialog() #Surround the rest of the init process try: #Set font & include manager vars fm = None im = None #And perform the rest of the import statements from utils.environment import set_dll_paths from skinutils import reload_skin from skinutils.fonts import FontManager from skinutils.includes import IncludeManager from _spotify import unload_library #Add the system specific library path set_dll_paths('resources/dlls') #Install custom fonts fm = FontManager() skin_dir = os.path.join(__addon_path__, "resources/skins/DefaultSkin") xml_path = os.path.join(skin_dir, "720p/font.xml") font_dir = os.path.join(skin_dir, "fonts") fm.install_file(xml_path, font_dir) #Install custom includes im = IncludeManager() include_path = os.path.join(skin_dir, "720p/includes.xml") im.install_file(include_path) reload_skin() #Show the busy dialog again after reload_skin(), as it may go away show_busy_dialog() #Load & start the actual gui, no init code beyond this point gui_main(__addon_path__) show_busy_dialog() #Do a final garbage collection after main gc.collect() #from _spotify.utils.moduletracker import _tracked_modules #print "tracked modules after: %d" % len(_tracked_modules) #import objgraph #objgraph.show_backrefs(_tracked_modules, max_depth=5) except (SystemExit, Exception) as ex: if str(ex) != '': dlg = xbmcgui.Dialog() dlg.ok(ex.__class__.__name__, str(ex)) traceback.print_exc() finally: unload_library("libspotify") #Cleanup includes and fonts if im is not None: del im if fm is not None: del fm #Close the background loading window #loadingwin.close() hide_busy_dialog()
#Load & start the actual gui, no init code beyond this point from spotimcgui import main session = main(__addon_path__) gc.collect() session = None #Some debug info... from _spotify import _library_refs print _library_refs from spotify.utils.finalize import _finalize_refs print _finalize_refs import threading print 'threads: %d' % threading.activeCount() #import objgraph #objgraph.show_backrefs(objs, max_depth=5) from _spotify import unload_library unload_library() finally: #Cleanup includes and fonts if im is not None: del im if fm is not None: del fm #Close the background loading window loadingwin.close()
#Do a final garbage collection after main gc.collect() #from _spotify.utils.moduletracker import _tracked_modules #print "tracked modules after: %d" % len(_tracked_modules) #import objgraph #objgraph.show_backrefs(_tracked_modules, max_depth=5) except (SystemExit, Exception) as ex: if str(ex) != '': dlg = xbmcgui.Dialog() dlg.ok(ex.__class__.__name__, str(ex)) traceback.print_exc() finally: unload_library("libspotify") #Cleanup includes and fonts if im is not None: del im if fm is not None: del fm #Close the background loading window loadingwin.close()
im = IncludeManager() include_path = os.path.join( __addon_path__, "resources/skins/DefaultSkin/720p/includes.xml") im.install_file(include_path) reload_skin() #Import spotify & friends sys.path.insert(0, os.path.join(libs_dir, "CherryPy.egg")) sys.path.insert(0, os.path.join(libs_dir, "PyspotifyCtypes.egg")) sys.path.insert(0, os.path.join(libs_dir, "PyspotifyCtypesProxy.egg")) #Load & start the actual gui, no init code beyond this point from spotimcgui import main session = main(__addon_path__) gc.collect() session = None from _spotify import unload_library unload_library() finally: #Cleanup includes and fonts if im is not None: del im if fm is not None: del fm #Close the background loading window loadingwin.close()