def __init__(self,title = None, ID = None): """ In order to initialise this object, either a title is required or imdbID is required. One can also specify a year while title is given. """ if (title is None) and (ID is None): print "Error: Either title or ID must be specified.\n No title or ID" del(self) elif (title and ID): print "Error: Both title and ID given." del(self) else: options = {} if title: options['t'] = title else: options['i'] = ID self.data = imdb.get_json(options)
def search(self): if self.keyword == "": raise NoKeywordException options = {} options['s'] = self.keyword self.results = get_json(options)['Search']
def _get_by_title(self,title): options = {} options['t'] = title self.data = imdb.get_json(options)
def _get_by_id(self,ID): options = {} options['i'] = ID self.data = imdb.get_json(options)
def get_movie(title): options = {} options['t'] = title json = imdb.get_json(options) return json