def __init__(self): window('emby_should_stop', clear=True) self.settings['addon_version'] = client.get_version() self.settings['profile'] = xbmc.translatePath('special://profile') self.settings['mode'] = settings('useDirectPaths') self.settings['log_level'] = settings('logLevel') or "1" self.settings['auth_check'] = True self.settings['enable_context'] = settings('enableContext.bool') self.settings['enable_context_transcode'] = settings( 'enableContextTranscode.bool') self.settings['kodi_companion'] = settings('kodiCompanion.bool') window('emby_logLevel', value=str(self.settings['log_level'])) window('emby_kodiProfile', value=self.settings['profile']) settings('platformDetected', client.get_platform()) settings('distroDetected', client.get_distro()) memory = xbmc.getInfoLabel('System.Memory(total)').replace('MB', "") settings('lowPowered.bool', int(memory or 2961) < 2961) # Use shield (~3GB) as cutoff if self.settings['enable_context']: window('emby_context.bool', True) if self.settings['enable_context_transcode']: window('emby_context_transcode.bool', True) LOG.warn("--->>>[ %s ]", client.get_addon_name()) LOG.warn("Version: %s", client.get_version()) LOG.warn("KODI Version: %s", xbmc.getInfoLabel('System.BuildVersion')) LOG.warn("Platform: %s", settings('platformDetected')) LOG.warn("OS: %s/%sMB", settings('distroDetected'), memory) LOG.warn("Python Version: %s", sys.version) LOG.warn("Using dynamic paths: %s", settings('useDirectPaths') == "0") LOG.warn("Log Level: %s", self.settings['log_level']) self.check_version() verify_kodi_defaults() try: Views().get_nodes() except Exception as error: LOG.error(error) self.patch = patch.Patch() self.patch.check_update() test_databases() window('emby.connected.bool', True) settings('groupedSets.bool', objects.utils.get_grouped_set()) xbmc.Monitor.__init__(self)
def generate_mesh(reference_element): """ Generate the mesh of patches for the 1D domain. :param reference_element: The reference element for each patch on the mesh """ # Generate the patches that form the 1D mesh delta_x = float(parameters.CONST_X_RANGE[-1] - parameters.CONST_X_RANGE[0]) / parameters.CONST_NUM_PATCH patches = [] for i in range(parameters.CONST_NUM_PATCH): patch_x_range = [i * delta_x, (i + 1) * delta_x] patches.append(patch.Patch(patch_x_range, reference_element, i)) # Generate the patch faces. Impose periodic BCs here patch_faces = [] for i in range(parameters.CONST_NUM_PATCH): patch_face = patch.PatchFace() if i == parameters.CONST_NUM_PATCH - 1: # Periodic BC patch_face.set_patch_pointer(patches[i], 0) # left face patch_face.set_patch_pointer(patches[0], 1) # right face else: patch_face.set_patch_pointer(patches[i], 0) # left face patch_face.set_patch_pointer(patches[i + 1], 1) # right face patch_faces.append(patch_face) return patches, patch_faces
def __init__(self, in_memory_store): self.firebase = in_memory_store.firebase self.local_patch = patch.Patch(in_memory_store.instance) self.has_mutation = False self.committed = False
if __name__ == '__main__': main(sys.argv) """In memory model datastore""" import db_helpers as helpers import patch import path_utils from google.appengine.ext import deferred from functools import partial import threading accessor_mutex = threading.Lock() patch_mutex = threading.Lock() enqueued_patch = patch.Patch() def enqueue_patch(firebase, data): """ Enqueue a patch to be sent to firebase. If a patch to firebase is ongoing, just leave the data in the patch queue and assume that once the ongoing patch completes, this data will be sent in the next patch. If no request is ongoing, acquire the lock to prevent accessors to firebase before it is up to date with all patches. """ patch_mutex.acquire() enqueued_patch.patch('/', data) patch_mutex.release() print "getting accessor_mutex:", str(accessor_mutex)
# -*- coding: utf-8 -*- ################################################################################################# import _strptime # Workaround for threads using datetime: _striptime is locked import logging import patch from hooks import webservice ################################################################################################# WEBSERVICE = webservice.WebService() WEBSERVICE.start() LOG = logging.getLogger("EMBY." + __name__) PATCH = patch.Patch() PATCH.check_update() ################################################################################################# import json import sys import threading from datetime import datetime import xbmc import xbmcgui import objects import connect import client import library