def getCriticker(): apikey = settings.getSetting('criticker_apikey') if len(apikey) < 5: common.Notification('Error', 'Please set up Criticker key in settings') settings.openSettings() return url = 'http://api.criticker.com/handler.php?CritickerKey=%%API_KEY%%&Function=RecommendFilm' url = url.replace("%%API_KEY%%", apikey) print url req = urllib2.Request(url) req.add_header( 'User-Agent', "%s %s" % (sys.modules["__main__"].__plugin__, sys.modules["__main__"].__version__)) response = urllib2.urlopen(req) dom = parse(response) try: title = dom.getElementsByTagName("FilmName")[0].firstChild.data year = dom.getElementsByTagName("FilmYear")[0].firstChild.data avgtier = dom.getElementsByTagName("AvgTier")[0].firstChild.data except: common.Notification('Error', 'Please check your Criticker key in settings') settings.openSettings() return s = '{0} ({1}) r:{2}'.format(title, year, avgtier) common.createMovieListItem(s, title, year) url = sys.argv[0] + '?action=' common.createListItem('Another', True, url + 'criticker') common.endofDir() return
def setup(): if FIRST_TIME_STARTUP: dialog = xbmcgui.Dialog() dialog.ok("Furk Library BY alicanlakot", "..", "Welcome to first time", "setup") if not check_sources_xml(MOVIES_PATH) or not check_sources_xml( TV_SHOWS_PATH): if dialog.yesno( "Setup folder", "The directories used are not listed as video sources.", "Do you want to add them to sources.xml now?"): setup_sources() data = traktlib.testUser(settings.getSetting('trakt_login'), settings.getSetting('trakt_password')) if data['status'] == 'failure': common.Notification( data['status'], 'Please check your username for Trakt and Furk in config') settings.openSettings() data = traktlib.testUser(settings.getSetting('trakt_login'), settings.getSetting('trakt_password')) common.Notification('Tried again:', data['status']) if len(settings.getSetting('furk_apikey')) < 5: furklib.login(settings.getSetting('furk_login'), settings.getSetting('furk_password')) dialog.ok("Furk Library BY alicanlakot", "..", "You can start this again", "from menu") settings.setSetting('first_time_startup', 'false')
def getCriticker(): apikey = settings.getSetting('criticker_apikey') if len(apikey) < 5 : common.Notification ('Error','Please set up Criticker key in settings') settings.openSettings() return url = 'http://api.criticker.com/handler.php?CritickerKey=%%API_KEY%%&Function=RecommendFilm' url = url.replace("%%API_KEY%%",apikey) print url req = urllib2.Request(url) req.add_header('User-Agent', "%s %s" % (sys.modules[ "__main__" ].__plugin__, sys.modules[ "__main__" ].__version__)) response = urllib2.urlopen(req) dom = parse(response) try: title = dom.getElementsByTagName("FilmName")[0].firstChild.data year = dom.getElementsByTagName("FilmYear")[0].firstChild.data avgtier = dom.getElementsByTagName("AvgTier")[0].firstChild.data except: common.Notification ('Error','Please check your Criticker key in settings') settings.openSettings() return s= '{0} ({1}) r:{2}'.format(title,year,avgtier) common.createMovieListItem(s,title,year) url = sys.argv[0]+'?action=' common.createListItem('Another',True, url + 'criticker') common.endofDir() return
def startup(): if len(settings.getSetting('username')) < 1: dialog = xbmcgui.Dialog() dialog.ok("Login", "Please login to your Streamcub account.", "Get a free account at www.streamcub.com") settings.openSettings() if len(settings.getSetting('username')) > 0: dialog = xbmcgui.Dialog() login_ok = furklib.login(settings.getSetting('username'),settings.getSetting('password')); if not login_ok and dialog.yesno("Login failed", "Do you want to view your settings?"): settings.openSettings() return login_ok else: return False
def setup(): if FIRST_TIME_STARTUP: dialog = xbmcgui.Dialog() dialog.ok("Furk Library BY alicanlakot","..","Welcome to first time", "setup") if not check_sources_xml(MOVIES_PATH) or not check_sources_xml(TV_SHOWS_PATH): if dialog.yesno("Setup folder", "The directories used are not listed as video sources.", "Do you want to add them to sources.xml now?"): setup_sources() data = traktlib.testUser(settings.getSetting('trakt_login'),settings.getSetting('trakt_password')) if data['status'] =='failure' : common.Notification(data['status'],'Please check your username for Trakt and Furk in config') settings.openSettings() data = traktlib.testUser(settings.getSetting('trakt_login'),settings.getSetting('trakt_password')) common.Notification('Tried again:',data['status']) if len(settings.getSetting('furk_apikey')) < 5: furklib.login(settings.getSetting('furk_login'),settings.getSetting('furk_password')) dialog.ok("Furk Library BY alicanlakot","..","You can start this again", "from menu") settings.setSetting('first_time_startup', 'false')
xbmc.executebuiltin('UpdateLibrary(video)') # if fg=='False': # settings.startTimer() elif(params['action'] == 'download'): id = params['id'] furklib.addDownload(id) Notification('File added') elif(params['action'] == 'delete'): id = params['id'] furklib.deleteDownload(id) elif(params['action'] == 'setup'): settings.openSettings() if len(settings.getSetting('username')) > 0: furklib.login(settings.getSetting('username'),settings.getSetting('password')) else: xbmc.log('argv=%s' % sys.argv) if (MYCONTEXT == 'video'): common.createCachePath() if startup() : AddonMenu() print 'Closing Streamcub' #sys.modules.clear()