def getVCDQ(url): d = feedparser.parse( url ) common.Notification("Navigating to ",d['feed']['title']) mylist= list() for span in d.entries: rssname = span.title myPlot = span.description parser = MovieParser() parser.data = rssname parser.parse() myName = parser.name myYear = parser.year #year = s[len(s)-7 : len(s)] #year = year.replace('(','').replace(')','') #year = year.strip() #s = s.split('(',1)[0].strip() #s = s.replace(', The','') #print s s = myName + '(' + str(myYear) + ')' if s in mylist: continue else: common.createMovieListItem(s,myName,myYear,len(d.entries)) mylist.append(s) common.endofDir() return
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 getMovieLens(url): req = urllib2.Request(urllib.unquote(url)) req.add_header('User-Agent', "%s %s" % (sys.modules[ "__main__" ].__plugin__, sys.modules[ "__main__" ].__version__)) response = urllib2.urlopen(req) soup = BeautifulSoup(response) mySpans= soup.findAll('span',attrs={"class" : "movieTitle"}) ##mySpans = mySpans[1], mySpans[2] for span in mySpans: s = span.a.string year = s[len(s)-7 : len(s)] year = year.replace('(','').replace(')','') year = year.strip() title = s.split('(',1)[0].strip() title = title.replace(', The','') common.createMovieListItem(s,title,year,len(mySpans)) return
def getVCDQ(url): d = feedparser.parse(url) common.Notification("Navigating to ", d['feed']['title']) mylist = list() for span in d.entries: rssname = span.title myPlot = span.description parser = MovieParser() parser.data = rssname parser.parse() myName = parser.name myYear = parser.year #year = s[len(s)-7 : len(s)] #year = year.replace('(','').replace(')','') #year = year.strip() #s = s.split('(',1)[0].strip() #s = s.replace(', The','') #print s s = myName + '(' + str(myYear) + ')' if s in mylist: continue else: common.createMovieListItem(s, myName, myYear, len(d.entries)) mylist.append(s) common.endofDir() return
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 getMovieLens(url): req = urllib2.Request(urllib.unquote(url)) req.add_header( 'User-Agent', "%s %s" % (sys.modules["__main__"].__plugin__, sys.modules["__main__"].__version__)) response = urllib2.urlopen(req) soup = BeautifulSoup(response) mySpans = soup.findAll('span', attrs={"class": "movieTitle"}) ##mySpans = mySpans[1], mySpans[2] for span in mySpans: s = span.a.string year = s[len(s) - 7:len(s)] year = year.replace('(', '').replace(')', '') year = year.strip() title = s.split('(', 1)[0].strip() title = title.replace(', The', '') common.createMovieListItem(s, title, year, len(mySpans)) return