示例#1
0
文件: movie.py 项目: sramsubbu/imdbpy
	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)
示例#2
0
 def search(self):
     if self.keyword == "":
         raise NoKeywordException
     options = {}
     options['s'] = self.keyword
     self.results = get_json(options)['Search']
示例#3
0
文件: movie.py 项目: sramsubbu/imdbpy
 def _get_by_title(self,title):
     options = {}
     options['t'] = title
     self.data = imdb.get_json(options)
示例#4
0
文件: movie.py 项目: sramsubbu/imdbpy
 def _get_by_id(self,ID):
     options = {}
     options['i'] = ID
     self.data = imdb.get_json(options)
示例#5
0
文件: movie.py 项目: sramsubbu/imdbpy
def get_movie(title):
    options = {}
    options['t'] = title
    json = imdb.get_json(options)
    return json