def setUp(self): self.series = Series(Mongo('movies')) self.a_film = Film() self.a_film.id = 1 self.a_film.description = "description" self.a_film.director = "director" self.a_film.name = "name" self.a_film.seasons = "season" self.a_film.year = "2016" self.other_film = Film() self.other_film.id = 2 self.other_film.description = "description_other" self.other_film.director = "director_other" self.other_film.name = "name_other" self.other_film.seasons = "season_other" self.other_film.year = "2017"
def LoadData(jsonPath): with open(jsonPath) as film_file: jsFilm = json.load(film_file) movieFrame = [] for jsFrame in jsFilm["frames"]: movieFrame.append(Frame(jsFrame["num"], jsFrame["primalColor"])) film = Film(jsFilm["titre"], movieFrame) return film
def test_add_new_movie(app): app.session.login(username="******", password="******") app.film.click_on_add_movie() app.film.fill_movie_details( Film(imdbid="10", title="My_Film1", year="1990", duration="94", rating="100", format="strange format", known_as="Also known as brbrbr"))
def GetFilmFromDataDir(path): movieNameArray = os.path.basename(path).split("/")[ -1] #Remove the extension movieName = "".join(movieNameArray) monFilm = Film(movieName, []) for file in os.listdir(path): framePath = os.path.join(path, file) if (file.endswith((".jpg"))): monFilm.frames.append( Frame(int(file.replace(".jpg", "")), GetAvgColor(framePath))) return monFilm
def data2obj(dict): film = Film() if 'title' in dict: film.name = dict['title'] if 'year' in dict: film.year = dict['year'] if 'director' in dict: film.director = dict['director'] if 'summary' in dict: film.summary = dict['summary'] if 'seasons' in dict: film.seasons = dict['seasons'] if 'description' in dict: film.description = dict['description'] return film
def __add_film(): gui.print_title_new_producer() name = gui.input_data(strings.input_name) location = gui.input_data(strings.input_location) date = gui.input_data(strings.input_date) __show_producers() res = 0 while not res: producer_id = raw_input(strings.input_producer_id) res = __validate_int(producer_id) if res: if not __producers_lab.get_producers().has_key(int(producer_id)): print strings.wrong_input res = 0 __films_lab.add_film( Film(name=name, location=location, date=date, producer_id=producer_id))
def action(self, menu_item): if menu_item == 1: name = str(raw_input("Enter name of new producer: ")) surname = str(raw_input("Enter surname: ")) self.__add_producer(name, surname) elif menu_item == 2: name = raw_input("Enter name of film: ") country = raw_input("Enter country: ") self.__display_producers() producer = int(raw_input("Enter producer index: ")) - 1 if 0 <= producer < len(self.__list_of_producers): self.__add_film(Film(name, country), self.__list_of_producers[producer]) else: print "Incorrect index" elif menu_item == 3: self.__display_producers() elif menu_item == 4: self.__display_films() elif menu_item == 5: self.__display_producers() index = int(input("Enter producer index: ") - 1) if 0 <= index < len(self.__list_of_producers): self.__delete_producer(self.__list_of_producers[index]) else: print "Failed index!" elif menu_item == 6: self.__display_films() index = int(input("Enter film index: ")) - 1 if 0 <= index < len(self.__list_of_films): self.__delete_film(self.__list_of_films[index]) else: print "Failed index!" elif menu_item == 7: self.__display_producers() index = int(input("Enter producer index: ")) - 1 if index < 0 or index >= len(self.__list_of_producers): print "Failed index!" else: producer = self.__list_of_producers[index] name = raw_input("Enter new name: ") if name == "": name = producer.name surname = raw_input("Enter new surname: ") if surname == "": surname = producer.surname self.__edit_producer(producer, name, surname) elif menu_item == 8: self.__display_films() index = int(input("Enter film index: ")) - 1 if 0 <= index < len(self.__list_of_films): film = self.__list_of_films[index] name = raw_input("Enter new name of film: ") country = raw_input("Enter new country of filmed: ") self.__display_producers() producer_index = int(input("Enter producer index: ")) - 1 if not 0 <= index < len(self.__list_of_producers): print "Incorrect producer!" return if name == "": name = film.name if country == "": country = film.country self.__edit_film(film, name, country, self.__list_of_producers[producer_index]) elif menu_item == 9: self.__display_filmed_in_ukraine()
def test_add_movie(app): app.movie.create(Film(name="Test", year="1234", description="Goes here"))