예제 #1
0
def __loadDB():
    global __dbThread
    __dbThread = Thread.Create(__loadDBInThread)

    # Give the database thread time to start accepting queries
    while not __alive:
        time.sleep(0.1)

    # If the database needs to be created, load the defaults file & call the create function
    if __shouldCreate:
        try:
            path = "%s/Contents/DefaultDatabase.sql" % Plugin.__bundlePath
            if os.path.exists(path):
                f = open(path, "r")
                string = f.read()
                f.close()
                Exec(string)
                PMS.Log("(Framework) Loaded the default database file")
                Commit()
            Plugin.__callNamed("CreateDatabase")
            PMS.Log("(Framework) Created database tables")
        except:
            PMS.Log("(Framework) Error creating database tables", False)
        finally:
            Commit()
def __loadDB():
  global __dbThread
  __dbThread = Thread.Create(__loadDBInThread)
  
  # Give the database thread time to start accepting queries
  while not __alive:
    time.sleep(0.1)
  
  # If the database needs to be created, load the defaults file & call the create function
  if __shouldCreate:
    try:
      path = "%s/Contents/DefaultDatabase.sql" % Plugin.__bundlePath
      if os.path.exists(path):
        f = open(path, "r")
        string = f.read()
        f.close()
        Exec(string)
        PMS.Log("(Framework) Loaded the default database file")
        Commit()
      Plugin.__callNamed("CreateDatabase")
      PMS.Log("(Framework) Created database tables")
    except:
      PMS.Log("(Framework) Error creating database tables", False)
    finally:
      Commit()
def __loadDefaults():
  global __dict
  __dict = {}
  path = "%s/Contents/DefaultDict.json" % Plugin.__bundlePath
  if os.path.exists(path):
    f = open(path, "r")
    string = f.read()
    f.close()
    __dict = JSON.ObjectFromString(string)
    PMS.Log("(Framework) Loaded the default dictionary file")
  Plugin.__callNamed("CreateDict", addToLog=False)
  Set("Framework.LastCompatibilityVersion", PMS.FrameworkCompatibilityVersion, addToLog=False)
예제 #4
0
def __loadDefaults():
    global __dict
    __dict = {}
    path = "%s/Contents/DefaultDict.json" % Plugin.__bundlePath
    if os.path.exists(path):
        f = open(path, "r")
        string = f.read()
        f.close()
        __dict = JSON.ObjectFromString(string)
        PMS.Log("(Framework) Loaded the default dictionary file")
    Plugin.__callNamed("CreateDict", addToLog=False)
    Set("Framework.LastCompatibilityVersion",
        PMS.FrameworkCompatibilityVersion,
        addToLog=False)
def __load():
  global __prefs
  global __prefsPath
  
  path = "%s/Contents/DefaultPrefs.json" % Plugin.__bundlePath
  if os.path.exists(path):
    f = open(path, "r")
    string = f.read()
    f.close()
    __prefs = JSON.ObjectFromString(string)
    PMS.Log("(Framework) Loaded the default preferences file")
  Plugin.__callNamed("CreatePrefs", addToLog=False)
  if os.path.exists(__prefsPath):
    try:
      f = open(__prefsPath, "r")
      userPrefs = XML.ElementFromString(f.read())
      f.close()
      for userPref in userPrefs:
        for pref in __prefs:
          if pref["id"] == userPref.tag:
            pref["value"] = userPref.text
      PMS.Log("(Framework) Loaded the user preferences file")
    except:
      PMS.Log("(Framework) Exception when reading preferences")
예제 #6
0
def __load():
    global __prefs
    global __prefsPath

    path = "%s/Contents/DefaultPrefs.json" % Plugin.__bundlePath
    if os.path.exists(path):
        f = open(path, "r")
        string = f.read()
        f.close()
        __prefs = JSON.ObjectFromString(string)
        PMS.Log("(Framework) Loaded the default preferences file")
    Plugin.__callNamed("CreatePrefs", addToLog=False)
    if os.path.exists(__prefsPath):
        try:
            f = open(__prefsPath, "r")
            userPrefs = XML.ElementFromString(f.read())
            f.close()
            for userPref in userPrefs:
                for pref in __prefs:
                    if pref["id"] == userPref.tag:
                        pref["value"] = userPref.text
            PMS.Log("(Framework) Loaded the user preferences file")
        except:
            PMS.Log("(Framework) Exception when reading preferences")