added gridChange variables and TODO comments
This commit is contained in:
parent
bb579f2f6f
commit
2eae1aa2a7
2 changed files with 19 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,7 @@
|
|||
json/*
|
||||
venv/*
|
||||
__pycache__/
|
||||
*.swp
|
||||
*.ipynb
|
||||
*.pyc
|
||||
test.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
|
||||
|
|
Loading…
Reference in a new issue