def reviews_rating(movie_id): try: positive_reviews,neutral_reviews,negative_reviews = comments_analysis.get_movie_reviews(movie_id=movie_id) rating = rating_calculation.calculate_rating(positive_reviews=positive_reviews,negative_reviews=negative_reviews) return rating # {'Success':True, # 'Rating':rating} except: raise DoesNotExist("Movie does not exist")
def reviews_rating(movie_id): try: positive_reviews, neutral_reviews, negative_reviews = comments_analysis.get_movie_reviews( movie_id=movie_id) rating = rating_calculation.calculate_rating( positive_reviews=positive_reviews, negative_reviews=negative_reviews) return rating # {'Success':True, # 'Rating':rating} except: raise DoesNotExist("Movie does not exist")
def top_movie_reviews(movie_id,offset=0,limit=10): try: positive_reviews,neutral_reviews,negative_reviews = comments_analysis.get_movie_reviews(movie_id=movie_id) if len(positive_reviews)==0 and len(neutral_reviews)==0 and len(negative_reviews)==0: return {'Body': 'No reviews'} return {'Success':True, 'positive_reviews':positive_reviews, 'neutral_reviews':neutral_reviews, 'negative_reviews':negative_reviews } except: raise DoesNotExist("Movie does not exist")
def top_movie_reviews(movie_id, offset=0, limit=10): try: positive_reviews, neutral_reviews, negative_reviews = comments_analysis.get_movie_reviews( movie_id=movie_id) if len(positive_reviews) == 0 and len(neutral_reviews) == 0 and len( negative_reviews) == 0: return {'Body': 'No reviews'} return { 'Success': True, 'positive_reviews': positive_reviews, 'neutral_reviews': neutral_reviews, 'negative_reviews': negative_reviews } except: raise DoesNotExist("Movie does not exist")