コード例 #1
0
def log(msg, level=LOGNOTICE):
    debug_enabled = control.setting('addon_debug')
    debug_log = control.setting('debug.location')

    print DEBUGPREFIX + ' Debug Enabled?: ' + str(debug_enabled)
    print DEBUGPREFIX + ' Debug Log?: ' + str(debug_log)

    if not control.setting('addon_debug') == 'true':
        return

    try:
        if isinstance(msg, unicode):
            msg = '%s (ENCODED)' % (msg.encode('utf-8'))

        if not control.setting('debug.location') == '0':
            log_file = os.path.join(LOGPATH, 'placenta.log')
            if not os.path.exists(log_file):
                f = open(log_file, 'w')
                f.close()
            with open(log_file, 'a') as f:
                line = '[%s %s] %s: %s' % (datetime.now().date(),
                                           str(datetime.now().time())[:8],
                                           DEBUGPREFIX, msg)
                f.write(line.rstrip('\r\n') + '\n')
        else:
            print '%s: %s' % (DEBUGPREFIX, msg)
    except Exception as e:
        try:
            xbmc.log('Logging Failure: %s' % (e), level)
        except:
            pass
コード例 #2
0
 def __init__(self):
     self.priority = 1
     self.language = ['en']
     self.domains = ['moviesplanet.is', 'moviesplanet.tv']
     self.base_link = 'https://www.moviesplanet.tv'
     self.search_link = '/ajax/search.php'
     self.user = control.setting('moviesplanet.user')
     self.password = control.setting('moviesplanet.pass')
コード例 #3
0
 def __init__(self):
     self.priority = 1
     self.language = ['en']
     self.domains = ['streamlord.com']
     self.base_link = 'http://www.streamlord.com'
     self.search_link = '/searchtest.php'
     self.user = control.setting('streamlord.user')
     self.password = control.setting('streamlord.pass')
コード例 #4
0
ファイル: segos.py プロジェクト: danny1990/ScraperPackages
    def __init__(self):
        self.priority = 1
        self.language = ['pl']
        self.domains = ['segos.es']

        self.base_link = 'https://segos.es'
        self.search_link = '/?search=%s'
        self.user_name = control.setting('segos.username')
        self.user_pass = control.setting('segos.password')
コード例 #5
0
 def __init__(self):
     self.priority = 1
     self.language = ['de']
     self.domains = ['serienstream.to']
     self.base_link = 'https://serienstream.to'
     self.search_link = '/ajax/search'
     self.login = control.setting('serienstream.user')
     self.password = control.setting('serienstream.pass')
     self.cookie = ''
     self.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
コード例 #6
0
ファイル: furk.py プロジェクト: danny1990/ScraperPackages
 def __init__(self):
     self.priority = 0
     self.language = ['en']
     self.domain = 'furk.net/'
     self.base_link = 'https://www.furk.net'
     self.meta_search_link = "/api/plugins/metasearch?api_key=%s&q=%s&cached=yes" \
                             "&match=%s&moderated=%s%s&sort=relevance&type=video&offset=0&limit=%s"
     self.tfile_link = "/api/file/get?api_key=%s&t_files=1&id=%s"
     self.login_link = "/api/login/login?login=%s&pwd=%s"
     self.user_name = control.setting('furk.user_name')
     self.user_pass = control.setting('furk.user_pass')
     self.api_key = control.setting('furk.api')
     self.search_limit = control.setting('furk.limit')
コード例 #7
0
 def __init__(self):
     self.priority = 0
     self.language = ['de']
     self.domains = ['pron.ee']
     self.base_link = 'https://www.pron.ee'
     self.search_link = '/api/search/%s/?apikey=%s&getmeta=0&query=%s&count=%d&from=%d'
     self.types = ['stream']
     self.streamLimit = control.setting('pron.limit')
     if self.streamLimit == '': self.streamLimit = 100
     self.streamLimit = int(self.streamLimit)
     self.streamIncrease = 100
     self.api = control.setting('pron.api')
     self.debrid = control.setting('pron.download')
     if self.debrid == 'true': self.types = ['stream', 'download']
     self.extensions = [
         'mp4', 'mpg', 'mpeg', 'mp2', 'm4v', 'm2v', 'mkv', 'avi', 'flv',
         'asf', '3gp', '3g2', 'wmv', 'mov', 'qt', 'webm', 'vob', ''
     ]
コード例 #8
0
ファイル: ororo.py プロジェクト: danny1990/ScraperPackages
    def __init__(self):
        self.priority = 1
        self.language = ['en']
        self.domains = ['ororo.tv']
        self.base_link = 'https://ororo.tv'
        self.moviesearch_link = '/api/v2/movies'
        self.tvsearch_link = '/api/v2/shows'
        self.movie_link = '/api/v2/movies/%s'
        self.show_link = '/api/v2/shows/%s'
        self.episode_link = '/api/v2/episodes/%s'

        self.user = control.setting('ororo.user')
        self.password = control.setting('ororo.pass')
        self.headers = {
            'Authorization':
            'Basic %s' % base64.b64encode('%s:%s' %
                                          (self.user, self.password)),
            'User-Agent':
            'Placenta for Kodi'
        }
コード例 #9
0
ファイル: trakt.py プロジェクト: danny1990/ScraperPackages
def timeoutsyncTVShows():
    timeout = cache.timeout(syncTVShows, control.setting('trakt.user').strip())
    return timeout
コード例 #10
0
ファイル: trakt.py プロジェクト: danny1990/ScraperPackages
def cachesyncTVShows(timeout=0):
    indicators = cache.get(syncTVShows, timeout,
                           control.setting('trakt.user').strip())
    return indicators
コード例 #11
0
ファイル: trakt.py プロジェクト: danny1990/ScraperPackages
def __getTrakt(url, post=None):
    try:
        url = urlparse.urljoin(BASE_URL, url)
        post = json.dumps(post) if post else None
        headers = {
            'Content-Type': 'application/json',
            'trakt-api-key': V2_API_KEY,
            'trakt-api-version': 2
        }

        if getTraktCredentialsInfo():
            headers.update({
                'Authorization':
                'Bearer %s' % control.setting('trakt.token')
            })

        result = client.request(url,
                                post=post,
                                headers=headers,
                                output='extended',
                                error=True)

        resp_code = result[1]
        resp_header = result[2]
        result = result[0]

        if resp_code in [
                '500', '502', '503', '504', '520', '521', '522', '524'
        ]:
            log_utils.log('Temporary Trakt Error: %s' % resp_code,
                          log_utils.LOGWARNING)
            return
        elif resp_code in ['404']:
            log_utils.log('Object Not Found : %s' % resp_code,
                          log_utils.LOGWARNING)
            return


#        elif resp_code in ['429']:
#            log_utils.log('Trakt Rate Limit Reached: %s' % resp_code, log_utils.LOGWARNING)
#            return

        if resp_code not in ['401', '405']:
            return result, resp_header

        oauth = urlparse.urljoin(BASE_URL, '/oauth/token')
        opost = {
            'client_id': V2_API_KEY,
            'client_secret': CLIENT_SECRET,
            'redirect_uri': REDIRECT_URI,
            'grant_type': 'refresh_token',
            'refresh_token': control.setting('trakt.refresh')
        }

        result = client.request(oauth, post=json.dumps(opost), headers=headers)
        result = utils.json_loads_as_str(result)

        token, refresh = result['access_token'], result['refresh_token']

        control.setSetting(id='trakt.token', value=token)
        control.setSetting(id='trakt.refresh', value=refresh)

        headers['Authorization'] = 'Bearer %s' % token

        result = client.request(url,
                                post=post,
                                headers=headers,
                                output='extended',
                                error=True)
        return result[0], result[2]
    except Exception as e:
        log_utils.log('Unknown Trakt Error: %s' % e, log_utils.LOGWARNING)
        pass
コード例 #12
0
ファイル: trakt.py プロジェクト: danny1990/ScraperPackages
def getTraktIndicatorsInfo():
    indicators = control.setting('indicators') if getTraktCredentialsInfo(
    ) == False else control.setting('indicators.alt')
    indicators = True if indicators == '1' else False
    return indicators
コード例 #13
0
ファイル: trakt.py プロジェクト: danny1990/ScraperPackages
def getTraktCredentialsInfo():
    user = control.setting('trakt.user').strip()
    token = control.setting('trakt.token')
    refresh = control.setting('trakt.refresh')
    if (user == '' or token == '' or refresh == ''): return False
    return True