def service(): ADDON = addon() recordIsActivate = ADDON.getSetting('enregistrement_activer') if recordIsActivate == 'false': return pathRecording = 'special://userdata/addon_data/plugin.video.vstream/Enregistrement' path = ''.join([pathRecording]) if not xbmcvfs.exists(path): xbmcvfs.mkdir(path) recordList = xbmcvfs.listdir(path) interval = ADDON.getSetting('heure_verification') ADDON.setSetting('path_enregistrement_programmation', path) recordInProgress = False monitor = xbmc.Monitor() del ADDON while not monitor.abortRequested() and not recordInProgress == True: if monitor.waitForAbort(int(interval)): break hour = datetime.now().strftime('%d-%H-%M') + '.py' if hour in str(recordList): hour = path + '/' + hour hour = VSPath(hour) recordInProgress = True VSlog('python ' + hour) command = 'python ' + hour proc = subprocess.Popen(command, stdout=subprocess.PIPE) p_status = proc.wait() server_thread.join()
def service(): ADDON = addon() intervalle = ADDON.getSetting('heure_verification') enregistrementIsActif = ADDON.getSetting('enregistrement_activer') if enregistrementIsActif == 'false': return PathProgrammation = "special://userdata/addon_data/plugin.video.vstream/Enregistrement" path = "".join([PathProgrammation]) if not xbmcvfs.exists(path): xbmcvfs.mkdir(path) ListeEnregistrement = xbmcvfs.listdir(path) ADDON.setSetting('path_enregistrement_programmation', path) EnregistrementEnCours = False monitor = xbmc.Monitor() while not monitor.abortRequested() and not EnregistrementEnCours == True: if monitor.waitForAbort(int(intervalle)): break heure = datetime.now().strftime('%d-%H-%M') + '.py' if heure in str(ListeEnregistrement): heure = path + '/' + heure heure = xbmc.translatePath(heure) EnregistrementEnCours = True VSlog('python ' + heure) command = 'python ' + heure proc = subprocess.Popen(command, stdout=subprocess.PIPE) p_status = proc.wait()
def runServer(): from resources.lib.proxy.ProxyHTTPRequestHandler import ProxyHTTPRequestHandler server_address = ('127.0.0.1', 2424) httpd = ThreadingHTTPServer(server_address, ProxyHTTPRequestHandler) server_thread = threading.Thread(target=httpd.serve_forever) server_thread.start() VSlog("Server Start") monitor = xbmc.Monitor() while not monitor.abortRequested(): if monitor.waitForAbort(1): break httpd.shutdown()