def __init__(self, username=None, password=None, filter=None, uid=None): ContentProvider.__init__(self, name='czsklib', base_url=sctop.BASE_URL, username=username, password=password, filter=filter) self.tr = tracker.TrackerInfo().getSystemInfo() self.uid = uid util.UA = self.tr['useragent'] + ' ver' + str(sctop.addonInfo('version')) #util.debug("[SC] tr: %s" % str(self.tr)) self.cache = sctop.cache util.debug("[SC] init cache %s" % self.cache.__class__.__name__) util.init_urllib(self.cache) cookies = self.cache.get('cookies') #if not cookies or len(cookies) == 0: # util.request(self._url(self.base_url)) self.ws = None
def trackUsage(params): for param in ['id', 'host', 'tc']: if not param in params: raise Exception(param + ' param is required') if not 'service' in params: params['service'] = 'google' if not 'cond' in params: params['cond'] = -1 else: try: params['cond'] = int(params['cond']) except: pass if not 'action' in params: params['action'] = params['id'] if 'dry' in params: try: params['dry'] = bool(params['dry']) except: params['dry'] = False else: params['dry'] = False xbmc.log(msg='Parsed input params %s' % (str(params)), level=xbmc.LOGDEBUG) try: if not xbmcaddon.Addon( params['id']).getAddonInfo('id') == params['id']: raise Exception('') except: print 'Unable to create addon instance for %s, invalid addon ID?!' % ( params['id']) return if register(params): print 'Tracking usage ...' sett = tracker.TrackerSettings(__addon__) info = tracker.TrackerInfo().getSystemInfo() # retrieve per-installation-unique ID info['instanceid'] = sett.getInstanceID(params['service']) if 'google' == params['service']: return googletracker.track_usage(params['host'], params['action'], params['tc'], params['dry'], info) else: print 'Reporting for %s disabled by user' % (params['id'])
def __init__(self, username=None, password=None, filter=None, uid=None): ContentProvider.__init__(self, name='czsklib', base_url=sctop.BASE_URL, username=username, password=password, filter=filter) self.tr = tracker.TrackerInfo().getSystemInfo() self.uid = uid util.UA = self.tr['useragent'] #util.debug("[SC] tr: %s" % str(self.tr)) util.init_urllib(self.cache) cookies = self.cache.get('cookies') if not cookies or len(cookies) == 0: util.request(self.base_url) self.ws = None
def __init__(self, username=None, password=None, filter=None, uid=None): ContentProvider.__init__(self, name='czsklib', base_url=sctop.BASE_URL, username=username, password=password, filter=filter) self.tr = tracker.TrackerInfo().getSystemInfo() self.uid = uid util.UA = self.tr['useragent'] + ' ver' + str( sctop.addonInfo('version')) #util.debug("[SC] tr: %s" % str(self.tr)) self.cache = sctop.cache self.ws = wx(sctop.getSetting('wsuser'), sctop.getSetting('wspass'), self.cache) util.debug("[SC] init cache %s" % self.cache.__class__.__name__) util.init_urllib(self.cache) cookies = self.cache.get('cookies') hasTrakt = str(sctop.getSetting('trakt.token') != '') util.debug('[SC] has trakt: %s' % hasTrakt) sctop.win.setProperty('sc.trakt', hasTrakt)