예제 #1
0
def start():
    from resources.lib.zattooDB import ZattooDB
    _zattooDB_ = ZattooDB()
    # reload Account
    xbmcgui.Dialog().notification(
        localString(30104), localString(31024),
        __addon__.getAddonInfo('path') + '/resources/icon.png', 500, False)
    profilePath = xbmc.translatePath(__addon__.getAddonInfo('profile'))
    os.remove(os.path.join(profilePath, 'cookie.cache'))
    os.remove(os.path.join(profilePath, 'session.cache'))
    os.remove(os.path.join(profilePath, 'account.cache'))
    _zattooDB_.zapiSession()

    player = myPlayer()
    VERSION = __addon__.getAddonInfo('version')
    OLDVERSION = _zattooDB_.get_version(VERSION)

    if OLDVERSION != VERSION:

        # reload DB
        _zattooDB_.reloadDB()
        # set Version
        _zattooDB_.set_version(VERSION)

    import urllib
    #xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
    #re-import ZattooDB to prevent "convert_timestamp" error
    from resources.lib.zattooDB import ZattooDB
    _zattooDB_ = ZattooDB()
    _zattooDB_.cleanProg(True)

    #re-import ZattooDB to prevent "convert_timestamp" error
    from resources.lib.zattooDB import ZattooDB
    _zattooDB_ = ZattooDB()
    _zattooDB_.updateChannels()

    #re-import ZattooDB to prevent "convert_timestamp" error
    from resources.lib.zattooDB import ZattooDB
    _zattooDB_ = ZattooDB()
    _zattooDB_.updateProgram()

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

    startTime = datetime.datetime.now()  #-datetime.timedelta(minutes = 60)
    endTime = datetime.datetime.now() + datetime.timedelta(minutes=20)

    #re-import ZattooDB to prevent "convert_timestamp" error
    from resources.lib.zattooDB import ZattooDB
    _zattooDB_ = ZattooDB()
    #xbmcgui.Dialog().notification(localString(31916), localString(30110),  __addon__.getAddonInfo('path') + '/icon.png', 3000, False)

    if __addon__.getSetting('dbonstart') == 'true':
        _zattooDB_.getProgInfo(True, startTime, endTime)
        recInfo()

    #xbmcgui.Dialog().notification(localString(31106), localString(31915),  __addon__.getAddonInfo('path') + '/icon.png', 3000, False)
    refreshProg()
예제 #2
0
import os, urlparse
from resources.lib.library import library
from resources.lib.zattooDB import ZattooDB
from resources.lib.zapisession import ZapiSession

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

_library_ = library()
localString = __addon__.getLocalizedString

DEBUG = __addon__.getSetting('debug')

VERSION = __addon__.getAddonInfo('version')
OLDVERSION = _zattooDB_.get_version(VERSION)


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


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


def log(msg, level=xbmc.LOGNOTICE):
    addon = xbmcaddon.Addon()
    addonID = addon.getAddonInfo('id')
    xbmc.log('%s: %s' % (addonID, msg), level)