Example #1
0
	def find_movie(self,user_action):
		self.header_output("Finding....")
		print "\n Example: find iron or find Iron Man 3 \n"
		movies = Movie.read_movies_from_file()
		if user_action != []:
			arg    = user_action.pop(0)
			found  = [x for x in movies if self.search(x,arg)]
			self.movie_table_output(found)
Example #2
0
	def list_movie(self,kwargs):
		print "\n Example: list name, list rating, list date or list by name etc. \n"
		sort_order = 'name'
		if kwargs != []:
			if kwargs[0] == 'by':
				sort_order = kwargs.pop(1)
			else: 
				sort_order = kwargs.pop(0)
		
		movies = Movie.read_movies_from_file()
		if sort_order == 'date':
			movies.sort(cmp = lambda x, y: cmp(x.date, y.date))
		elif sort_order == 'rating':
			movies.sort(cmp = lambda x, y: cmp(x.rating, y.rating))			
		else:
			movies.sort(cmp = lambda x, y: cmp(x.movie, y.movie))
		self.movie_table_output(movies)