Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/adipai/PopcornPicks
Browse files Browse the repository at this point in the history
  • Loading branch information
huygensCortex committed Oct 15, 2023
2 parents e81f71c + dd98873 commit 2984f90
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pylint
pip install pandas
pip install -U Flask
pip install -U flask-cors
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
Binary file removed Code/recommenderapp/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# <i>Movie Recommendation 🎥 </i>
# <i> PopcornPicks: Your Destination for Movie Recommendations 🎥 </i>
A collaborative filtering based recommendation engine!


[![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://GitHub.com/ssp4all/)



[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://gitHub.com/git-ankit/MovieRecommender/graphs/commit-activity) [![Contributors Activity](https://img.shields.io/github/commit-activity/m/git-ankit/MovieRecommender)](https://github.com/git-ankit/MovieRecommender/pulse) [![GitHub issues](https://img.shields.io/github/issues/git-ankit/MovieRecommender.svg)](https://github.com/git-ankit/MovieRecommender/issues/) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/git-ankit/MovieRecommender.svg)](https://github.com/git-ankit/MovieRecommender/issues?q=is%3Aissue+is%3Aclosed) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4127507.svg)](https://doi.org/10.5281/zenodo.4127507) [![Build Status](https://travis-ci.com/git-ankit/MovieRecommender.svg?branch=master)](https://travis-ci.com/git-ankit/MovieRecommender) [![codecov](https://codecov.io/gh/git-ankit/MovieRecommender/branch/master/graph/badge.svg?token=8K0VL8106C)](undefined) [![GitHub release](https://img.shields.io/github/release/git-ankit/MovieRecommender.svg)](https://GitHub.com/git-ankit/MovieRecommenderreleases/) [![black](https://img.shields.io/badge/StyleChecker-black-purple.svg)](https://pypi.org/project/black/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://gitHub.com/adipai/PopcornPicks/graphs/commit-activity) [![Contributors Activity](https://img.shields.io/github/commit-activity/m/adipai/PopcornPicks)](https://github.com/adipai/PopcornPicks/pulse) [![GitHub issues](https://img.shields.io/github/issues/adipai/PopcornPicks.svg)](https://github.com/adipai/PopcornPicks/issues/) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/adipai/PopcornPicks.svg)](https://github.com/adipai/PopcornPicks/issues?q=is%3Aissue+is%3Aclosed) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4127507.svg)](https://doi.org/10.5281/zenodo.4127507) [![Build Status](https://travis-ci.com/adipai/PopcornPicks.svg?branch=master)](https://travis-ci.com/adipai/PopcornPicks) [![codecov](https://codecov.io/gh/adipai/PopcornPicks/branch/master/graph/badge.svg?token=8K0VL8106C)](undefined) [![GitHub release](https://img.shields.io/github/release/adipai/PopcornPicks.svg)](https://GitHub.com/adipai/PopcornPicksreleases/) [![black](https://img.shields.io/badge/StyleChecker-black-purple.svg)](https://pypi.org/project/black/)

### Project 3 Plan

Expand Down
11 changes: 11 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""
Movie Recommender Setup Script
This script is used to package and distribute the Movie Recommender project.
It contains information about the project, including its name, version, authors,
description, and other relevant details, to facilitate distribution and installation.
For more information about the Movie Recommender project, visit:
https://github.com/git-ankit/MovieRecommender
"""

import setuptools

with open("README.md", "r", encoding="utf8") as fh:
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions Code/recommenderapp/app.py → src/recommenderapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
Module for routing all calls from the frontend
"""

sys.path.append("../../")
from src.prediction_scripts.item_based import recommend_for_new_user
from utils import send_email_to_user, beautify_feedback_data
from flask_cors import CORS
from flask import Flask, jsonify, render_template, request
from search import Search
import sys
import json
sys.path.append("../../")
from Code.prediction_scripts.item_based import recommend_for_new_user
# pylint: disable=wrong-import-position
# pylint: enable=wrong-import-position


app = Flask(__name__)
Expand Down Expand Up @@ -65,6 +67,7 @@ def feedback():
data = json.loads(request.data)
return data


@app.route("/sendMail", methods=["POST"])
def sendMail():
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 8 additions & 7 deletions Code/recommenderapp/utils.py → src/recommenderapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import logging
import smtplib
from smtplib import SMTPException
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

import constants as c


def beautify_feedback_data(data):
"""
Utility function to beautify the feedback json containing predicted movies for sending in email
Expand Down Expand Up @@ -55,10 +55,10 @@ def send_email_to_user(recipient_email, categorized_data):
message['Subject'] = subject

# Create the email message with HTML content
html_content = c.EMAIL_HTML_CONTENT.format('\n'.join(f'<li>{movie}</li>' for movie in categorized_data['Liked']),
'\n'.join(
f'<li>{movie}</li>' for movie in categorized_data['Disliked']),
'\n'.join(f'<li>{movie}</li>' for movie in categorized_data['Yet to Watch']))
html_content = c.EMAIL_HTML_CONTENT.format(
'\n'.join(f'<li>{movie}</li>' for movie in categorized_data['Liked']),
'\n'.join(f'<li>{movie}</li>' for movie in categorized_data['Disliked']),
'\n'.join(f'<li>{movie}</li>' for movie in categorized_data['Yet to Watch']))

# Attach the HTML email body
message.attach(MIMEText(html_content, 'html'))
Expand All @@ -74,8 +74,9 @@ def send_email_to_user(recipient_email, categorized_data):
server.sendmail(sender_email, recipient_email, message.as_string())
logging.info("Email sent successfully!")

except Exception as e:
logging.warning("Email could not be sent. Error: %s", str(e))
except SMTPException as e:
# Handle SMTP-related exceptions
logging.error("SMTP error while sending email: %s", str(e))

finally:
server.quit()
8 changes: 4 additions & 4 deletions test/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Test suit for search feature
"""

import sys
import unittest
import warnings
import sys
import os

sys.path.append("../")
from Code.recommenderapp.search import Search
#pylint: disable=wrong-import-position
from src.recommenderapp.search import Search
#pylint: enable=wrong-import-position

warnings.filterwarnings("ignore")

Expand Down
9 changes: 5 additions & 4 deletions test/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
Test suite for recommender system
"""

import sys
import unittest
import warnings
import sys

sys.path.append("../")
from Code.prediction_scripts.item_based import recommend_for_new_user
#pylint: disable=wrong-import-position
from src.prediction_scripts.item_based import recommend_for_new_user
#pylint: enable=wrong-import-position

warnings.filterwarnings("ignore")

Expand Down Expand Up @@ -45,7 +46,7 @@ def test_horror_with_cartoon(self):
{"title": "Strangers, The (2008)", "rating": 5.0},
]
recommendations = recommend_for_new_user(ts)
self.assertTrue(("Toy Story (1995)" in recommendations) == False)
self.assertTrue(("Toy Story (1995)" in recommendations) is False)

def test_iron_man(self):
"""
Expand Down

0 comments on commit 2984f90

Please sign in to comment.