# * Credits: # * # * v.0.1.0 # * original VCGenCMD to SpeedFan Log code by pkscout import atexit, datetime, os, random, sys, time import data.config as config from resources.common.xlogger import Logger from resources.common.fileops import deleteFile, writeFile from resources.common.transforms import replaceWords p_folderpath, p_filename = os.path.split(os.path.realpath(__file__)) lw = Logger(logfile=os.path.join(p_folderpath, 'data', 'logfile.log'), numbackups=config.Get('logbackups'), logdebug=str(config.Get('debug'))) def _deletePID(): success, loglines = deleteFile(pidfile) lw.log(loglines) pid = str(os.getpid()) pidfile = os.path.join(p_folderpath, 'data', 'create.pid') atexit.register(_deletePID) class Main: def __init__(self): self._setPID() self._init_vars()
from threading import Thread from resources.common.xlogger import Logger from resources.common.fix_utf8 import smartUTF8 from resources.common.fileops import popenWithTimeout ### get addon info and set globals addon = xbmcaddon.Addon() addonname = addon.getAddonInfo('id') addonversion = addon.getAddonInfo('version') addonpath = addon.getAddonInfo('path').decode('utf-8') addonicon = xbmc.translatePath('%s/icon.png' % addonpath) language = addon.getLocalizedString preamble = '[SpeedFan Info]' logdebug = addon.getSetting('logging') lw = Logger(preamble=preamble, logdebug=logdebug) #global used to tell the worker thread the status of the window windowopen = True #capture a couple of actions to close the window ACTION_PREVIOUS_MENU = 10 ACTION_BACK = 92 def updateWindow(name, w): #this is the worker thread that updates the window information every w seconds #this strange looping exists because I didn't want to sleep the thread for very long #as time.sleep() keeps user input from being acted upon delay = addon.getSetting('update_delay') while windowopen and (not xbmc.abortRequested):