Exemplo n.º 1
0
def people():
  if request.method == 'POST':
    keyword = request.form['keyword']
    res = searchPerson(keyword)
    if len(res) == 0:
      return redirect(url_for('noresults'))
    else:
      return res[0].name
  else:
    return render_template('people.html')
Exemplo n.º 2
0
def people():
  if request.method == 'POST':
    keyword = request.form['search field']
    res = searchPerson(keyword)
    if len(res) == 0:
      return redirect(url_for('noresults'))
    else:
      return render_template('people.html', title='People', pageActive='people', searchValue='PERSON', people=res[0:15])
  else:
    return render_template('people.html', title='People', pageActive='people', searchValue='PERSON')
Exemplo n.º 3
0
def return_metadata(actor, genre):
    try:
        movies = searchMovie(str(genre))
        genre_movie = movies[randrange(len(movies))]
        featured_actor = searchPerson(str(actor))[0]
    except IndexError:
        print 'Genre or actor entered is not valid. Please try again'
        return None

    actor_roles = featured_actor.roles
    rand_role = actor_roles[randrange(len(actor_roles))]
    actor_movie = searchMovie(str(rand_role).split('\'')[-2])[0]

    output = ''
    output += str(genre_movie.title) + '\n' + str(actor_movie.title)
    output += '\n'
    output += genre_movie.overview + '\n' + actor_movie.overview

    return output
Exemplo n.º 4
0
def return_metadata(actor, genre):
  try:
    movies = searchMovie(str(genre))
    genre_movie = movies[randrange(len(movies))]
    featured_actor = searchPerson(str(actor))[0]
  except IndexError:
    print 'Genre or actor entered is not valid. Please try again'
    return None

  actor_roles = featured_actor.roles
  rand_role = actor_roles[randrange(len(actor_roles))]
  actor_movie = searchMovie(str(rand_role).split('\'')[-2])[0]


  output = ''
  output += str(genre_movie.title) + '\n' + str(actor_movie.title)
  output += '\n'
  output += genre_movie.overview + '\n' + actor_movie.overview
  
  return output
Exemplo n.º 5
0
import requests
import os

API = '259f7fc6b26292afaf6ec1dabe6fdd6a'
set_key(API)

from tmdb3 import set_cache
set_cache('null')
set_cache(filename='/full/path/to/cache')  # the 'file' engine is assumed
set_cache(filename='tmdb3.cache')  # relative paths are put in /tmp
set_cache(engine='file', filename='~/.tmdb3cache')

from tmdb3 import get_locale, set_locale
set_locale()
print(get_locale())
#locale has bet set to english and United States...yes
print
print
'''import urllib2 #import Request#, urlopen headers = {"Accept": "application/json"}

request = urllib2.Request("https://api.themoviedb.org/3/search/movie?api_key="+API+"&query=Foxx")
responsebody = urllib2.urlopen(request).read()
print responsebody
print
print'''

import tmdb3
search = 'Hanks'
a = tmdb3.searchPerson(search)
print a[0:]