Exemplo n.º 1
0
def debridIt(do, who):
    if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA)
    if not os.path.exists(REALFOLD): os.makedirs(REALFOLD)
    if who == 'all':
        for log in ORDER:
            if os.path.exists(DEBRIDID[log]['path']):
                try:
                    addonid = wiz.addonId(DEBRIDID[log]['plugin'])
                    default = DEBRIDID[log]['default']
                    user = addonid.getSetting(default)
                    if user == '' and do == 'update': continue
                    updateDebrid(do, log)
                except:
                    pass
            else:
                wiz.log(
                    '[Real Debrid Info] %s(%s) is not installed' %
                    (DEBRIDID[log]['name'], DEBRIDID[log]['plugin']),
                    xbmc.LOGERROR)
        wiz.setS('debridlastsave', str(THREEDAYS))
    else:
        if DEBRIDID[who]:
            if os.path.exists(DEBRIDID[who]['path']):
                updateDebrid(do, who)
        else:
            wiz.log('[Real Debrid Info] Invalid Entry: %s' % who,
                    xbmc.LOGERROR)
Exemplo n.º 2
0
def updateTrakt(do, who):
    file = TRAKTID[who]['file']
    settings = TRAKTID[who]['settings']
    data = TRAKTID[who]['data']
    addonid = wiz.addonId(TRAKTID[who]['plugin'])
    saved = TRAKTID[who]['saved']
    default = TRAKTID[who]['default']
    user = addonid.getSetting(default)
    suser = wiz.getS(saved)
    name = TRAKTID[who]['name']
    icon = TRAKTID[who]['icon']

    if do == 'update':
        if not user == '':
            try:
                with open(file, 'w') as f:
                    for trakt in data:
                        f.write(
                            '<trakt>\n\t<id>%s</id>\n\t<value>%s</value>\n</trakt>\n'
                            % (trakt, addonid.getSetting(trakt)))
                    f.close()
                user = addonid.getSetting(default)
                wiz.setS(saved, user)
                wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                              '[COLOR %s]Trakt Info: Saved![/COLOR]' % COLOR2,
                              2000, icon)
            except Exception, e:
                wiz.log(
                    "[Trakt Info] Unable to Update %s (%s)" % (who, str(e)),
                    xbmc.LOGERROR)
        else:
            wiz.LogNotify(
                "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                '[COLOR %s]Trakt Info: Not Registered![/COLOR]' % COLOR2, 2000,
                icon)
Exemplo n.º 3
0
def traktIt(do, who):
    if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA)
    if not os.path.exists(TRAKTFOLD): os.makedirs(TRAKTFOLD)
    if who == 'all':
        for log in ORDER:
            if os.path.exists(TRAKTID[log]['path']):
                try:
                    addonid = wiz.addonId(TRAKTID[log]['plugin'])
                    default = TRAKTID[log]['default']
                    user = addonid.getSetting(default)
                    if user == '' and do == 'update': continue
                    updateTrakt(do, log)
                except:
                    pass
            else:
                wiz.log(
                    '[Trakt Info] %s(%s) is not installed' %
                    (TRAKTID[log]['name'], TRAKTID[log]['plugin']),
                    xbmc.LOGERROR)
        wiz.setS('traktlastsave', str(THREEDAYS))
    else:
        if TRAKTID[who]:
            if os.path.exists(TRAKTID[who]['path']):
                updateTrakt(do, who)
        else:
            wiz.log('[Trakt Info] Invalid Entry: %s' % who, xbmc.LOGERROR)
Exemplo n.º 4
0
def debridUser(who):
    user = None
    if DEBRIDID[who]:
        if os.path.exists(DEBRIDID[who]['path']):
            try:
                add = wiz.addonId(DEBRIDID[who]['plugin'])
                user = add.getSetting(DEBRIDID[who]['default'])
            except:
                pass
    return user
Exemplo n.º 5
0
def traktUser(who):
    user = None
    if TRAKTID[who]:
        if os.path.exists(TRAKTID[who]['path']):
            try:
                add = wiz.addonId(TRAKTID[who]['plugin'])
                user = add.getSetting(TRAKTID[who]['default'])
            except:
                return None
    return user
Exemplo n.º 6
0
def activateDebrid(who):
    if DEBRIDID[who]:
        if os.path.exists(DEBRIDID[who]['path']):
            act = DEBRIDID[who]['activate']
            addonid = wiz.addonId(DEBRIDID[who]['plugin'])
            if act == '': addonid.openSettings()
            else: url = xbmc.executebuiltin(DEBRIDID[who]['activate'])
        else:
            DIALOG.ok("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE),
                      '%s is not currently installed.' % DEBRIDID[who]['name'])
    else:
        wiz.refresh()
        return
    check = 0
    while debridUser(who) == None:
        if check == 30: break
        check += 1
        time.sleep(10)
    wiz.refresh()
Exemplo n.º 7
0
import shutil
import urllib2, urllib
import re
import time
try:
    from sqlite3 import dbapi2 as database
except:
    from pysqlite2 import dbapi2 as database
from datetime import date, datetime, timedelta

from resources.lib.modules import uservar
from resources.lib.modules import wizard as wiz

ADDONTITLE = uservar.ADDONTITLE
ADDON_ID = uservar.ADDON_ID
ADDON = wiz.addonId(ADDON_ID)
DIALOG = xbmcgui.Dialog()
HOME = xbmc.translatePath('special://home/')
ADDONS = os.path.join(HOME, 'addons')
USERDATA = os.path.join(HOME, 'userdata')
PLUGIN = os.path.join(ADDONS, ADDON_ID)
PACKAGES = os.path.join(ADDONS, 'packages')
ADDONDATA = os.path.join(USERDATA, 'addon_data', ADDON_ID)
ADDOND = os.path.join(USERDATA, 'addon_data')
REALFOLD = os.path.join(ADDONDATA, 'debrid')
ICON = os.path.join(PLUGIN, 'icon.png')
TODAY = date.today()
TOMORROW = TODAY + timedelta(days=1)
THREEDAYS = TODAY + timedelta(days=3)
KEEPTRAKT = wiz.getS('keepdebrid')
REALSAVE = wiz.getS('debridlastsave')