diff --git a/.gitignore b/.gitignore index fe7241d..9f4d1c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ json/* +venv/* __pycache__/ *.swp +*.ipynb +*.pyc +test.py diff --git a/recommendation_engine.py b/recommendation_engine.py index 98c1b26..39138f0 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -46,6 +46,12 @@ class Engine: 'screenings': {'locked': True, 'value': 2} }, 'globalKeywords': {}, + 'gridChange': { + 'nextClip': {'locked': False, 'value': 4}, + 'nextPlaylist': {'locked': False, 'value': 4}, + 'staySame': {'locked': False, 'value': 8} + + } } self.update_keywords() @@ -77,9 +83,14 @@ class Engine: clips[inpoint['index']]['out'] = self.pandora.get(video_id, ['duration'])['duration'] return clips +### TASK 1 ### +# Change this to (1) check if there's no grid event and if so: initialize, and +# (2) if not: add serendipity to the current grid mix using gridChange variables. + def get_videos(self, user): channels = {k: v.get('value', 0) for k, v in self.state['channels'].items()} sliders = {k: v.get('value', 0) for k, v in self.state['globalKeywords'].items()} + gridChange = {k: v.get('value', 0) for k, v in self.state['gridChange'].items()} # For each playlist, compute user keyword score user_keywords = user.get('keywords', {}) score = {} @@ -131,6 +142,10 @@ class Engine: 'tags': video['tags'], } for video in videos] + +### TASK 2 ### +# Change this to make sure the next playlist is not the current playlist +# AND not the playlists displayed in the current grid. Incorporate the change from Task 1. def get_next(self, user, position): video = self.get_videos(user)[position] return video