Exemplo n.º 1
0
 def today(self):
     xml = functions.get_markup("http://showrss.karmorra.info/feeds/all.rss")
     shows = []
     for show in xml.findAll("item"):
         show_date = datetime.strptime(show.pubdate.string[:-6], "%a, %d %b %Y %H:%M:%S")
         if show_date.date() >= datetime.now().date() - timedelta(1) and not show.title.string.startswith(
             "HD 720p:"
         ):
             shows.append(show.title.string)
     shows.sort()
     return "\n".join(shows)
Exemplo n.º 2
0
	def imdb_info(self, imdb_id):
		api_key = "71e4c2a503c7522113f43f9e04b23fe4"
		imdb_xml = functions.get_markup('http://api.themoviedb.org/2.1/Movie.imdbLookup/en/xml/' + api_key + '/' + imdb_id)
		title = imdb_xml.find('name').text
		release = imdb_xml.find('released').text
		runtime = imdb_xml.find('runtime').text
		rating = imdb_xml.find('rating').text
		plot = imdb_xml.find('overview').text
		return "%s (%s, %s min, %s/10)\n%s." % (title, release, runtime, rating, plot)

	# TODO: Printing trailer url fires title-fetch :(
	# def imdb_url_trailer(self, imdb_id):
	# 	api_key = "71e4c2a503c7522113f43f9e04b23fe4"
	# 	imdb_xml = functions.get_markup('http://api.themoviedb.org/2.1/Movie.imdbLookup/en/xml/' + api_key + '/' + imdb_id)
	# 	tmbd_id = imdb_xml.find('url').text.split('/')[4]

	# 	tmbd_xml = functions.get_markup('http://api.themoviedb.org/2.1/Movie.getInfo/en/xml/' + api_key + '/' + tmbd_id)
	# 	return tmbd_xml.find('trailer').text
Exemplo n.º 3
0
 def tv(self, show):
     soup = functions.get_markup("http://www.tvrage.com/" + show)
     epguide = "http://www.tvrage.com/" + show + "/episode_guide"
     if soup.body.h2 is None:
         return "Can't find show"
     elif soup.body.h2.text.startswith("Next:"):
         return (
             "Next episode: "
             + re.search("\(([^)]*)\)", soup.body.h2.text).group(0).replace("(", "").replace(")", "")
             + "\n"
             + epguide
         )
     elif soup.body.h2.text.startswith("Prev:"):
         return (
             "No information on next episode. Previous episode: "
             + re.search("\(([^)]*)\)", soup.body.h2.text).group(0).replace("(", "").replace(")", "")
             + "\n"
             + epguide
         )
     else:
         return "No information."
Exemplo n.º 4
0
	def spotify_uri(self, uri, isHttp=False):
		xml = functions.get_markup('http://ws.spotify.com/lookup/1/?uri=spotify:' + ':'.join(uri))
		name = xml.findAll('name')
		if not isHttp:
			http = '\nhttp://open.spotify.com/' + uri[0] + '/' + uri[1]
		else:
			http = ""
		
		if uri[0] == "track":
			artist = name[1].string
			title = name[0].string
			album = name[2].string
			return artist + " - "  + title + " (" + album + ")" + http
		
		if uri[0] == "album":
			artist = 'Artist: ' + name[1].string + '\n'
			album = 'Album: ' + name[0].string + '\n'
			released = xml.findAll('released')[0].string + '\n'
			return artist + album + released + http

		if uri[0] == "artist":
			artist = 'Artist: ' + name[0].string + '\n'
			return artist + http
Exemplo n.º 5
0
	def web_title(self, url):
		soup = functions.get_markup(url)
		if hasattr(soup.title, 'string'):
			return functions.convert_html_entities(soup.title.string)
		return None
Exemplo n.º 6
0
	def qkme_url(self, url):
		soup = functions.get_markup(url.replace("i.", "").replace(".jpg", ""))
		if hasattr(soup.title, 'string'):
			return functions.convert_html_entities(soup.title.string)	
Exemplo n.º 7
0
	def food(self):
		soup = functions.get_markup('http://www.vadihelveteskajaglagatillmiddag.nu/')
		food = soup.find("p", { "class" : "headline" }).findAll('a')[0]
		return food.string + '\n' + food.get('href')