コード例 #1
0
 def _integrity_check_db(self):
     db_file_checksum = tools.md5_hash(self._database_layout)
     with GlobalLock(self.__class__.__name__, self._threading_lock, True,
                     db_file_checksum) as lock:
         if lock.runned_once():
             return
         if g.read_all_text("{}.md5".format(
                 self._db_file)) == db_file_checksum:
             return
         g.log("Integrity checked failed - {} - {} - rebuilding db".format(
             self._db_file, db_file_checksum))
         self.rebuild_database()
         g.write_all_text("{}.md5".format(self._db_file), db_file_checksum)
コード例 #2
0
 def _integrity_check_db(self):
     db_file_checksum = tools.md5_hash(self._database_layout)
     try:
         with GlobalLock(self.__class__.__name__, True, db_file_checksum):
             if xbmcvfs.exists(self._db_file) and g.read_all_text(
                     "{}.md5".format(self._db_file)) == db_file_checksum:
                 return
             g.log("Integrity checked failed - {} - {} - rebuilding db".
                   format(self._db_file, db_file_checksum))
             self.rebuild_database()
             g.write_all_text("{}.md5".format(self._db_file),
                              db_file_checksum)
     except RanOnceAlready:
         return
コード例 #3
0
if tools.is_stub():
    # noinspection PyUnresolvedReferences
    from mock_kodi import MOCK

from resources.lib.modules.globals import g

g.init_globals(sys.argv)

from resources.lib.common import maintenance
from resources.lib.database.trakt_sync.activities import TraktSyncDatabase
from resources.lib.modules.serenMonitor import SerenMonitor
from resources.lib.modules.update_news import do_update_news

g.log("##################  STARTING SERVICE  ######################")
g.log("### {} {}-{}".format(g.ADDON_ID, g.VERSION,
                            g.read_all_text(".gitsha") or "local"))
g.log("PLATFORM: {}".format(g.PLATFORM))
g.set_setting("general.tempSilent", "false")
g.log("#############  SERVICE ENTERED KEEP ALIVE  #################")
g.HOME_WINDOW.setProperty("SerenDownloadManagerIndex", "{}")

monitor = SerenMonitor()
xbmc.executebuiltin(
    'RunPlugin("plugin://plugin.video.seren/?action=longLifeServiceManager")')

do_update_news()

maintenance.toggle_reuselanguageinvoker(True if g.get_setting(
    "reuselanguageinvoker.status") == "Enabled" else False)

while not monitor.abortRequested():