Exemplo n.º 1
0
  def reloadDB(self, cache=False):
    debug('ReloadDB')
    from resources.lib.library import library
    _library_ = library()
    DB = ZattooDB()
    xbmc.executebuiltin("ActivateWindow(busydialog)")

    DB._createTables()
    time.sleep(5)
    xbmcgui.Dialog().notification(localString(31916), localString(30110),  __addon__.getAddonInfo('path') + '/resources/icon.png', 3000, False)
    DB.updateChannels(True)
    #time.sleep(2)
    DB.updateProgram(datetime.datetime.now(), True)

    try:
        tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)
        DB.updateProgram(tomorrow)
    except:pass

    startTime=datetime.datetime.now()#-datetime.timedelta(minutes = 60)
    endTime=datetime.datetime.now()+datetime.timedelta(minutes = 20)
    #time.sleep(2)
    DB.getProgInfo(True, startTime, endTime)

    xbmcgui.Dialog().notification(localString(31106), localString(31915),  __addon__.getAddonInfo('path') + '/resources/icon.png', 3000, False)
    _library_.make_library()
    xbmc.executebuiltin("Dialog.Close(busydialog)")

    self.close()
Exemplo n.º 2
0
    def reloadDB(self, cache=False):
        debug('ReloadDB')
        from resources.lib.library import library
        _library_ = library()
        DB = ZattooDB()
        news = __addon__.getAddonInfo('path') + '/resources/media/news.png'
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        #delete zapi files to force new login
        profilePath = xbmc.translatePath(__addon__.getAddonInfo('profile'))
        if os.path.isfile(news):
            try:
                os.remove(
                    os.path.join(
                        xbmc.translatePath(
                            __addon__.getAddonInfo('path') +
                            '/resources/media/'), 'news.png'))
            except:
                pass
        if cache:
            try:
                os.remove(os.path.join(profilePath, 'cookie.cache'))
                os.remove(os.path.join(profilePath, 'session.cache'))
                os.remove(os.path.join(profilePath, 'account.cache'))
                #os.remove(os.path.join(profilePath, 'apicall.cache'))
                DB.zapiSession()
                DB._createTables()
                #xbmcgui.Dialog().ok(__addon__.getAddonInfo('name'), local(24074))

            except:
                pass
        #DB.zapi.AccountData = None

        DB._createTables()
        time.sleep(5)
        xbmcgui.Dialog().notification(
            localString(31916), localString(30110),
            __addon__.getAddonInfo('path') + '/resources/icon.png', 3000,
            False)
        DB.updateChannels(True)
        #time.sleep(2)
        DB.updateProgram(datetime.datetime.now(), True)

        try:
            tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)
            DB.updateProgram(tomorrow)
        except:
            pass

        startTime = datetime.datetime.now()  #-datetime.timedelta(minutes = 60)
        endTime = datetime.datetime.now() + datetime.timedelta(minutes=20)
        #time.sleep(2)
        DB.getProgInfo(True, startTime, endTime)

        xbmcgui.Dialog().notification(
            localString(31106), localString(31915),
            __addon__.getAddonInfo('path') + '/rsources/icon.png', 3000, False)
        _library_.make_library()
        xbmc.executebuiltin("Dialog.Close(busydialog)")

        self.close()
Exemplo n.º 3
0
import xbmc, xbmcgui, xbmcaddon, datetime, time
import os, urlparse, sys
import resources.lib.main as main

from resources.lib.library import library
from resources.lib.zattooDB import ZattooDB
from resources.lib.zapisession import ZapiSession

global player

_zattooDB_ = ZattooDB()
__addon__ = xbmcaddon.Addon()
__addondir__ = xbmc.translatePath(__addon__.getAddonInfo('profile'))
__addonId__ = __addon__.getAddonInfo('id')

_library_ = library()
localString = __addon__.getLocalizedString

DEBUG = __addon__.getSetting('debug')
accountData = _zattooDB_.zapi.get_accountData()


def debug(content):
    if DEBUG: log(content, xbmc.LOGDEBUG)


def notice(content):
    log(content, xbmc.LOGNOTICE)


def log(msg, level=xbmc.LOGNOTICE):