Exemplo n.º 1
0
    def reloadDB(self, cache=False):
        debug('ReloadDB')
        from resources.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') + '/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') + '/icon.png', 3000, False)
        _library_.make_library()
        xbmc.executebuiltin("Dialog.Close(busydialog)")

        self.close()
Exemplo n.º 2
0
#    along with zattooHiQ.  If not, see <http://www.gnu.org/licenses/>.
#

print 'ZattooHiq-Service started'

import xbmc, xbmcgui, xbmcaddon, datetime, time
import os, urlparse
from resources.library import library
from resources.zattooDB import ZattooDB
from resources.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()