Beispiel #1
0
 def test_game_moves_exhaust(self):
     movie = Movie("Hera Pheri")
     game = Game(movie)
     for i in range(7):
         game.play("j")
     self.assertFalse(game.is_playable())
     self.assertEqual(game.result(), "NO MOVES LEFT")
Beispiel #2
0
def find(table, id):
    cnx = connectToDatabase()
    cursor = createCursor(cnx)
    query = findQuery(table, id)
    cursor.execute(query)
    results = cursor.fetchall()

    entity = None
    if (cursor.rowcount == 1):
        row = results[0]
        if (table == "movies"):
            entity = Movie(row['title'], row['original_title'], row['duration'], row['release_date'], row['rating'])

        if (table == "people"):
            entity = Person(
                row['firstname'],
                row['lastname']
            )
        
        entity.id = row['id']

    closeCursor(cursor)
    disconnectDatabase(cnx)

    return entity
Beispiel #3
0
def update(ent_id):
    """ Updates an existing movie or tv series """
    try:
        content = request.json

        if content['type'] == "Movie":
            movie = Movie(ent_id, content['name'], content['year_released'],
                          content['director'], content['rating'],
                          content['type'], content['length'])

            streaming_service.update(movie)

            response = app.response_class(status=200)
            return response

        elif content['type'] == "TV series":
            tv_series = TVSeries(ent_id, content['name'],
                                 content['year_released'], content['director'],
                                 content['rating'], content['type'])

            streaming_service.update(tv_series)

            response = app.response_class(status=200)
            return response

    except ValueError as e:
        if str(e) == "Movie or TV series not found":
            response = app.response_class(status=404, response=str(e))
        else:
            response = app.response_class(status=400, response=str(e))

        return response
Beispiel #4
0
    def getContent(self, category='all', subCategory=None):
        assert category in self.categories.keys(), \
            "category must be one of the following: %s" % ", ".join(self.categories.keys())

        if subCategory:
            subCategory = str(subCategory)
        subCategories = self.getSubCategories(category)

        assert (subCategory == None and subCategories == None) or (subCategory in subCategories.keys()), \
            "subCategory must be one of the following: %s. use method getSubCategories() to get key/title" \
            " pairs." % ", ".join(subCategories.keys())

        if subCategory == None:
            container = self.server.query("/library/sections/%d/%s" % (self.key, category))
        else:
            container = self.server.query("/library/sections/%d/%s/%s" % (self.key, category, subCategory))

        content = []
        for e in container:
            if not 'type' in e.attrib:
                continue
            type_ = e.attrib['type']
            if type_ == 'movie':
                # append movie
                obj = Movie(e, self.server)
            if type_ == 'show':
                # append show
                obj = Show(e, self.server)
            if type_ == 'episode':
                obj = Episode(e, self.server)

            content.append(obj)

        return content
Beispiel #5
0
 def __init__(self):
     self.client = zulip.Client(site="https://fazeup.zulipchat.com/api/")
     self.subscribe_all()
     self.hacknews = Hackernews()
     self.trans = Translate()
     self.movie = Movie()
     self.lyrics = Lyrics()
     self.holiday = Holiday()
     self.currency = Currency()
     self.cricket = Cricket()
     # self.chatbot.train("chatterbot.corpus.english")
     self.crypto = Crypto()
     self.trans = Translate()
     self.g = Giphy()
     self.w = WikiPedia()
     # self.tw = Twimega()
     # self.motivate = Motivate()
     self.shortenedurl = Urlshortener()
     self.geo = Geocode()
     self.weather = Weather()
     self.dict_ = Dictionary()
     self.joke = Joke()
     self.pnr = Pnr()
     self.mustread = Mustread()
     self.ss = Ss()
     self.cricket = Cricket()
     self.poll = Poll()
     print("done init")
     self.subkeys = [
         "crypto", "translate", "define", "joke", "weather", "giphy", "pnr",
         "mustread", "poll", "hackernews", "hn", "HN", "motivate",
         "twitter", "screenshot", "memo", "cricnews", "help", "shorturl",
         "movie", "currency", "holiday", "lyrics"
     ]
Beispiel #6
0
def main(cfg_path):
    app = Application("video", cfg_path, setup_input=False, verbose=True)
    app.log = logging.getLogger(__name__)
    if app.config['settings']['system']['audio']:
        app.audio = pyaudio.PyAudio()
    else:
        app.audio = None
    app.suspended = False
    app.finished = False
    app.play = app.config['settings']['play']
    app.current_video = app.config['settings']['video']
    app.current_hash = _get_playlist_item_hash(app)
    app.movie = Movie(app.config['settings']['video'],
                      desired_size=get_out_shape(app),
                      audio=app.audio)

    app.movie.video_callback(partial(render, app))
    app.set_redis_callback(channel_update)
    app.add_periodic_callback(update_app, 1 / 60.)
    try:
        app.movie.start()
        app.run()
    except KeyboardInterrupt:
        if app.movie:
            app.movie.pause()
    finally:
        if app.movie:
            app.movie.cleanup()
        app.audio.terminate()
        app.cleanup()
Beispiel #7
0
    def omdb_get_movie(self, id):
        movie_id = id
        r = requests.get(
            f"http://www.omdbapi.com/?i={movie_id}&apikey={omdb_api_key}")
        data = r.json()
        imdb_id = data['imdbID']
        original_title = data['Title']
        title = data['Title']
        release_date = datetime.strptime(data['Released'], '%d %b %Y').date()
        duration = None
        score = data['imdbRating']
        rating = data['Rated']
        if rating == "PG-13":
            rating = "-12"
        elif rating in ["PG", "G", "R"]:
            rating = "TP"
        synopsis = data['Plot']

        #print(imdb_id)
        #print(title)
        #print(original_title)
        #print(release_date)
        #print(duration)
        #print(rating)
        #print(score)

        movie = Movie(title, original_title, duration, release_date, rating)
        movie.imdb_id = imdb_id
        movie.score = score
        movie.synopsis = synopsis
        return movie
Beispiel #8
0
def check_problem():
    movie = Movie()
    f = 1

    def aff(x, y):
        return P(x, y)

    stone = Polygon([
        aff(0.09897029702970297, 0.27443716679360247),
        aff(0.11047372429550648, 0.2750952018278751),
        aff(0.10981568926123382, 0.2865955826351866),
        aff(0.09831530845392232, 0.285940594059406)
    ])
    center = aff(0.08183068719268435, 0.28569424117242365)
    radius = 0.0164719687883 * f
    step = 0.000823598439415 * f

    stones = PolygonSet()
    stones.add(stone)
    allowable = stones.open_direction_for_circle(center, radius, step)

    l = [(stone, "red"), (Circle(center, radius), "green"),
         (allowable, "black")]

    movie.background(l)
    movie.just_draw()
    exit(0)
    def get_imdb_movie_releases(self):
        '''
        Retrieves upcoming movie releases from the IMDB page.
        Returns a list of Movie objects with populated "title", "year", "release_date", "imdb_id" and "imdb_link" values.
        '''
        imdb_movie_releases_link = 'https://www.imdb.com/calendar/?region=sg'
        movies = []

        # Fetch IMDB page
        response = requests.get(imdb_movie_releases_link)
        page = response.content

        # Parse the page and get movie releases info
        soup = BeautifulSoup(page, 'html.parser')
        main_div = soup.find(id='main')
        release_dates_h4 = main_div.find_all('h4')
        for release_date_element in release_dates_h4:
            release_date = self.__imdb_date_to_datetime(
                release_date_element.text)
            titles_li = release_date_element.find_next('ul').find_all('li')
            for title_element in titles_li:
                title, year = title_element.text.strip().strip('\n').rsplit(
                    ' ', 1)
                year = year.strip('(').strip(')')
                imdb_link = title_element.a['href']
                imdb_id = imdb_link.split('/')[2]
                movies.append(
                    Movie(title=title,
                          year=year,
                          imdb_link=imdb_link,
                          imdb_id=imdb_id,
                          release_date=release_date))

        return movies
Beispiel #10
0
def check_open_directions_for_circle_avoiding_segment3():
    placements = []
    radius = 0.25
    step = 0.15
    center = P(0.5, 0.5)
    circ = Circle(center, radius)
    for i in range(1000):
        p = P.polar(0.37, i / 1000 * 2 * np.pi) + P(0.43, 0.38)
        q = p + P(0.1, 0.2)
        seg = S(p, q)
        directions = GRegion.open_directions_for_circle_avoiding_segment(
            circ, seg, step)
        if len(directions.regions) > 1:
            shift = seg.dir.perp().resize(radius)
            print(seg.p.x, seg.p.y, seg.q.x, seg.q.y)
            box = Polygon([p - shift, p + shift, q + shift, q - shift])
            l = [(Circle(center, step), "lightgreen"), (box, "lightgrey"),
                 (Circle(p, radius), "lightgrey"),
                 (Circle(q, radius), "lightgrey"), (directions, "black"),
                 (seg, "red"), (Circle(center, 0.004), "red")]
            placements.append(l)
            movie = Movie()
            movie.background(l)
            movie.just_draw()
            break
    exit(0)
Beispiel #11
0
def check_open_directions_for_circle_avoiding_segment2():
    radius = 0.25
    step = 0.15
    center = P(0.5, 0.5)
    circ = Circle(center, radius)
    p = P(0.12661771955, 0.59179988647)
    q = P(0.22661771955, 0.79179988647)

    seg = S(p, q)
    directions = GRegion.open_directions_for_circle_avoiding_segment(
        circ, seg, step)
    shift = seg.dir.perp().resize(radius)
    box = Polygon([p - shift, p + shift, q + shift, q - shift])
    l = [
        (Circle(center, step), "lightgreen"),
        (box, "lightgrey"),
        # (Circle(p, radius), "lightgrey"),
        # (Circle(q, radius), "lightgrey"),
        (directions, "black"),
        (seg, "red"),
        (Circle(center, 0.004), "red")
    ]
    movie = Movie()
    movie.background(l)
    movie.just_draw()
    exit(0)
Beispiel #12
0
def check_open_directions_for_circle_avoiding_segment():
    placements = []
    radius = 0.25
    step = 0.15
    center = P(0.5, 0.5)
    circ = Circle(center, radius)
    m = 0
    for i in range(10000):
        p = P.polar(0.35, i / 1000 * 2 * np.pi) + P(0.5, 0.5)
        q = p + P.polar(0.2, i / 314 * 2 * np.pi)
        seg = S(p, q)
        directions = GRegion.open_directions_for_circle_avoiding_segment(
            circ, seg, step)
        shift = seg.dir.perp().resize(radius)
        box = Polygon([p - shift, p + shift, q + shift, q - shift])
        l = [(Circle(center, step), "lightgreen"), (box, "lightgrey"),
             (Circle(p, radius), "lightgrey"),
             (Circle(q, radius), "lightgrey"), (directions, "black"),
             (seg, "red"), (Circle(center, 0.004), "red")]
        pp, dist = seg.closest_point(center)
        if dist >= radius:
            for r in directions.regions:
                for t in r:
                    cut = seg.intersect_with_circle(center + t.resize(step),
                                                    radius)
                    if cut and cut.length() > 0.00000001:
                        l += [(Circle(center + t.resize(step),
                                      radius), "pink")]
                        m = max(m, cut.length())
                        print(m)
        placements.append(l)

    movie = Movie()
    movie.run_animation(placements, 10)
    exit()
Beispiel #13
0
    def get_movie_byid(self, id):

        string = "&i=" + id
        response = requests.get(self._link + string)
        result_dictionay = response.json()
        if result_dictionay['Response'] == "False":
            return None
        movie = Movie(
            id, result_dictionay['Rated'], result_dictionay['Runtime'], result_dictionay['Director'])
        movie.setTitle(result_dictionay['Title'])
        movie.setDate(self.date_convert(result_dictionay['Released']))
        movie.setPoster(result_dictionay['Poster'])

        movie.setSynopsis(result_dictionay['Plot'])

        casts = result_dictionay['Actors']

        casts_list = casts.split(", ")
        for name in casts_list:
            movie.add_cast(name)

        ratings = result_dictionay['Ratings']

        for tmp in ratings:
            if tmp['Source'] == "Rotten Tomatoes":
                movie.setRtRating(tmp['Value'])
            if tmp['Source'] == "Metacritic":
                movie.setMtRating(tmp['Value'])

        movie.setImdbRating(result_dictionay['imdbRating'])

        return movie
Beispiel #14
0
    def scrape(self, movies_set):
        """
        Gathers the required data from each movie in movies_set and creates
        a new Movie object. Stores the Movie object in self.movies.
        
        movies_set: a ResultSet of div elements that contain information about movies
        
        """
        for movie in movies_set:

            #get the movie title (without the release year)
            movie_title = movie.h4.a.text[1:-7]

            #get the genres of the movie
            movie_genres = movie.p.find_all("span", itemprop="genre")

            #extract the text of the span elements and store them in a new list
            movie_genres_text = []
            for genre in movie_genres:
                movie_genres_text.append(genre.text)

            #get the description
            movie_description = movie.find("div",
                                           itemprop="description").text[:-20]

            self.movies.append(
                Movie(movie_title, movie_genres_text, movie_description))
Beispiel #15
0
    def add_movie(self, i, j, k):
        self.video_lib.append(Movie(title=i, year=j, gener=k))
        with open('movie_lib.csv', 'a', newline='') as csvfile:
            fieldnames = ['Title', 'Year', 'Type']
            writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

            writer.writerow({'Title': i, 'Year': j, 'Type': k})
Beispiel #16
0
def add_movies():
    new_name = input("Title :")
    while not new_name:  # Check user input for blank
        print("Input can not be blank")
        new_name = input("Title :")
    # Check user input for blank, valid number and input 0
    valid = False
    while not valid:
        try:
            new_year = int(input("Year: "))
            while new_year <= 0:
                print("Number must be more than 0.")
                new_year = int(input("Year: "))
                valid = True
            valid = True
        except ValueError:
            print("Invalid input, please enter a valid number.")

    new_category = input("Category :")
    category_filter = [
        "Action", "Comedy", "Documentary", "Drama", "Fanstay", "Thriller"
    ]
    while not new_category:  # Check user input for blank
        print("Input can not be blank")
        new_category = input("Category :")

    # store user input of new data as nested list
    moviecollection.add_movie(Movie(new_name, new_year, new_category, False))
    moviecollection.sort("category")
    print("{:s} ({:s} from {:d}) added to movie ".format(
        new_name, new_category, new_year))
    print("")
Beispiel #17
0
 def _insert(self):
     parser = argparse.ArgumentParser(
         description="Insert an item of the given context in the databse")
     if self.context == "movies":
         parser.add_argument('--title', help='Titre du film', required=True)
         parser.add_argument('--imdb-id', help='Id sur IMDB', required=True)
         parser.add_argument('--duration',
                             help='Durée du film',
                             required=True)
         parser.add_argument('--original-title', help='Titre original')
         parser.add_argument('--origin-country', help='Pays d\'origine')
         parser.add_argument('--rating',
                             help='Classification',
                             default='TP')
         parser.add_argument('--release-date',
                             help="Date de sortie, AAAA-MM-JJ")
         args = self.second_parser(parser)
         movie = Movie(title=args.title,
                       imdb_id=args.imdb_id,
                       original_title=args.original_title,
                       duration=args.duration,
                       rating=args.rating,
                       release_date=args.release_date)
         movie_id = self.db._insert(table="movies", object=movie)
         print(f"Nouveau film inséré avec l'id {movie_id}")
     else:
         parser.add_argument('--firstname', help='Prénom', required=True)
         parser.add_argument('--lastname',
                             help='Nom de famille',
                             required=True)
         args = self.second_parser(parser)
         person = Person(firstname=args.firstname, lastname=args.lastname)
         person_id = self.db._insert(table="people", object=person)
         print(f"Nouvelle personne insérée avec l'id {person_id}")
Beispiel #18
0
def initialize_data():
    """
    initialize database using actor and movie data from scraped json files
    """
    actor_data = json.load(open("actor.json"))
    movie_data = json.load(open("movie.json"))
    movie_objects = {}
    actor_objects = {}
    #logger.info('load data from json and prepare to construct data structure')

    for movie in movie_data:
        new_movie = Movie(movie["movieName"], movie["movieYear"], normalize_grossing(movie["movieGrossing"]), [])
        movie_objects[new_movie.name] = new_movie
        for actor in movie["movieStaring"]:

            for available_actor in actor_data:
                if available_actor["actorName"] == actor:

                    if available_actor["actorName"] not in actor_objects:
                        actor_objects[available_actor["actorName"]] = Actor(available_actor["actorName"], normalize_age(available_actor["actorAge"]), [], 0)
                    actor_objects[available_actor["actorName"]].act_movie.append(new_movie)
                    if new_movie.grossing != None:
                        actor_objects[available_actor["actorName"]].total_grossing+=new_movie.grossing

                    new_movie.attend_actor.append(actor_objects[available_actor["actorName"]])
                    break

    for actor in actor_data:
        if actor["actorName"] not in actor_objects:
            actor_objects[actor["actorName"]] = Actor(actor["actorName"], normalize_age(actor["actorAge"]), [], 0)

    return movie_objects, actor_objects
Beispiel #19
0
def update_app(app):
    if app.play != app.config['settings']['play']:
        app.play = app.config['settings']['play']
        if app.movie:
            if not app.play:
                app.movie.pause()
            else:
                app.movie.resume()

    curr_video = app.config['settings']['video']
    curr_hash = _get_playlist_item_hash(app)
    if app.current_hash != curr_hash or (app.finished
                                         and app.config['settings']['loop']):
        # New video file.
        app.log.info('switching from %s to %s', app.current_video, curr_video)
        app.finished = False
        if app.movie:
            app.movie.cleanup()
            app.movie = None
        if curr_video:
            app.movie = Movie(curr_video,
                              desired_size=get_out_shape(app),
                              audio=app.audio)
            app.movie.video_callback(partial(render, app))
            app.movie.start()
            if not app.play:
                app.movie.pause()
        app.current_video = curr_video
        app.current_hash = curr_hash
Beispiel #20
0
def add_movie():
    movie_data = request.get_json()
    Movie(movie_data['title'],
          movie_data['genre'],
          movie_data['platform']
          )
    return 'Done', 201
def read_movie(line):
    """
    -------------------------------------------------------
    Creates and returns a Movie object from a line of formatted string data.
    Use: movie = read_movie(line)
    -------------------------------------------------------
    Preconditions:
        line - a vertical bar-delimited line of movie data in the format
          title|year|director|rating|genre codes (str)
    Postconditions:
        returns
        movie - contains the data from line (Movie)
    -------------------------------------------------------
    """
    data = line.strip().split("|")
    # Convert genres string to a genres list
    genres = data[4].split(",")
    n = len(genres)
    i = 0

    while i < n:
        genres[i] = int(genres[i])
        i += 1

    movie = Movie(data[0], int(data[1]), data[2], float(data[3]), genres)
    return movie
	def test_customer_method(self):
		"""Test method in customer class"""
		eiei = Customer("eiei")
		self.assertEqual("eiei",eiei.get_name())
		eiei.add_rental(Rental(Movie("UmuUmu", Movie.NEW_RELEASE), 5))
		self.assertEqual(eiei.all_frequent_points(), 5)
		self.assertEqual(eiei.all_amount(), 15)
Beispiel #23
0
def deploy():
    db.drop_all()
    db.create_all()
    StevenSpielberg = Director(name='Steven Spielberg', about='Steven Spielberg is an American filmmaker and the highest grossing filmmaker of all time')
    RyanCoogler = Director(name='Ryan Coogler', about='Ryan Coogler is an up and coming director known for his movies Creed and Black Panther')
    JJAbrams = Director(name='JJ Abrams', about='JJ Abrams is a director well known for his Star Trek and Star Wars movies')
    movie1 = Movie(name='Jurassic Park', year=1993, ratings="IMDb: 8.1, Rotten Tomatoes: 92%", director=StevenSpielberg)
    movie2 = Movie(name='BlackPanther', year=2018, ratings="IMDb: 7.6, Rotten Tomatoes: 97%", director=RyanCoogler)
    movie3 = Movie(name='Star Wars: The Force Awakens', year=2015, ratings="IMDb: 8, Rotten Tomatoes: 93%", director=JJAbrams)
    db.session.add(StevenSpielberg)
    db.session.add(RyanCoogler)
    db.session.add(JJAbrams)
    db.session.add(movie1)
    db.session.add(movie2)
    db.session.add(movie3)
    db.session.commit()
Beispiel #24
0
    def load_from_file(cls,filename):
      with open(filename,'r') as f:
        content = f.readlines();
        username = content[0]
        allMovies = []
        print(content,'content===')
        for movie in content:
            movies_data = movie.split(",")
            print(movies_data,'datttttt')
            if  len(movies_data)>1:    
                allMovies.append(Movie(movies_data[0] , movies_data[1] , movies_data[2]=="True"))

        user = cls(username)
        user.movies = allMovies
        return user        
      def convert_to_json(self):
          return{
            "name":self.name,
            "movies":[
              movies.json() for movie in self.movies

            ]
        
        
           }  
def findAll(table):
    cnx = connectToDatabase()
    cursor = createCursor(cnx)
    cursor.execute(findAllQuery(table))
    results = cursor.fetchall(
    )  # liste de dictionnaires contenant des valeurs scalaires
    closeCursor(cursor)
    disconnectDatabase(cnx)
    if (table == "movies"):
        movies = []
        for result in results:  # result: dictionnaire avec id, title, ...
            movie = Movie(title=result['title'],
                          original_title=result['original_title'],
                          duration=result['duration'],
                          release_date=result['release_date'],
                          rating=result['rating'])
            movie.id = result['id']
            movies.append(movie)
        return movies

    if (table == "people"):
        people = []
        for result in results:  # result: dictionnaire avec id, title, ...
            person = Person(
                firstname=result['firstname'],
                lastname=result['lastname'],
            )
            person.id = result['id']
            people.append(person)
        return people
Beispiel #26
0
 def add_movie(self):
     # Variable for the text in the widget for instantiate an object Movie
     movie = self.ln_MovieTitle.text()
     date = self.date_Calendar.selectedDate()
     print(date.getDate())
     # Here, condition for check if widget line edit not null
     if not movie:
         return False
     # Here, instance an object Movie with the widget
     m = Movie(movie)
     # Condition for add movie in the widget and check if it's True
     if m.add_to_movie():
         # If it's True about add movie title directly in the list widget
         # We create a widget list item for configure a method for instance a object
         list_movies = QtWidgets.QListWidgetItem(m.title)
         # Here, we instance object with data in the widget, it's most facility after for different request
         list_movies.setData(QtCore.Qt.UserRole, m)
         # Finally add the title of object
         self.list_View.addItem(list_movies)
         # And clear the widget line edit
         self.ln_MovieTitle.clear()
         return True
     # If no, about return False
     else:
         return False
Beispiel #27
0
    def add_movie(self, movie_name, actors):
        # find whether movie name exist in movie list
        target_moive = next(
            (x for x in self.__movie_list if x.get_movie_name() == movie_name),
            None)
        if target_moive is None:
            target_moive = Movie(movie_name)
            self.__movie_list.append(target_moive)

        movie_actors = target_moive.get_actors()
        for actor in actors:
            # find whether actor name exist in actor list
            target_actor = next(
                (x for x in self.__actor_list if x.get_actor_name() == actor),
                None)
            if target_actor is None:
                target_actor = Actor(actor)
                self.__actor_list.append(target_actor)

            # add the new movie to target_actor
            new_movie_list = target_actor.get_movies()
            new_movie_list.append(target_moive)
            target_actor.set_movies(new_movie_list)

            # add the new actor to target_moive pending list
            movie_actors.append(target_actor)

        target_moive.set_actors(movie_actors)
Beispiel #28
0
def FindMovies(update, context):
    status_message = context.bot.sendMessage(
        chat_id=update.message.chat_id,
        text='Searching for similar movies ...')
    movie_label = update.message.text.split()[-1]
    try:
        movie = Movie(movie_label)
        movie.make()
    except FindMovieError as error:
        if error.code == 404:
            context.bot.sendMessage(
                chat_id=update.message.chat_id,
                text='Movie not found 🤷‍♂️\nAnother movie ? 🙄',
                reply_markup=reply_markup,
                parse_mode=telegram.ParseMode.HTML)
        else:
            context.bot.sendMessage(chat_id=update.message.chat_id,
                                    text='500 Internal Serevr Error !')
        return
    context.bot.sendPhoto(chat_id=update.message.chat_id,
                          photo=movie.thumb,
                          caption=make_movie_details_message(movie),
                          parse_mode=telegram.ParseMode.HTML)
    second_reply_markup = InlineKeyboardMarkup([[
        InlineKeyboardButton("Search Another Movie 🔎",
                             switch_inline_query_current_chat='')
    ]])
    context.bot.sendMessage(chat_id=update.message.chat_id,
                            text=make_similar_movies_message(movie),
                            reply_markup=second_reply_markup,
                            parse_mode=telegram.ParseMode.HTML,
                            disable_web_page_preview=True)
    status_message.delete()
Beispiel #29
0
    def get_infos(self, content):

        if 'status_code' not in content:

            #### Infos générale sur le film
            title = content['title'].replace("'", " ")

            if 'original_title' in content:
                original_title = content['original_title'].replace("'", " ")
            else:
                original_title = title

            synopsis = content['overview'].replace("'", " ")
            production_budget = content['budget']
            tmdb_id = content['id']
            vote_average = content['vote_average']
            revenue = content['revenue']

            if content['runtime'] == None:
                duration = 0
            else:
                duration = content['runtime']

            if content['release_date'] == '':
                release_date = None
            else:
                release_date = content['release_date']

            movie = Movie(title, original_title, synopsis, duration,
                          production_budget, release_date, vote_average,
                          revenue)
            movie.tmdb_id = tmdb_id
            return movie
        return None
Beispiel #30
0
    def testMovieWeekend(self):
        m = Movie(121, "Saturday", True, True)

        m.addTicket(20, False)
        price = m.finishPurchase()

        self.assertEquals(price, 17.0)