From 6a71c56e7121fc491d8977b7224f064065c79237 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 3 Aug 2018 00:50:34 +0200 Subject: [PATCH 1/2] fall back to position 0 instead of undefined --- recommendation_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recommendation_engine.py b/recommendation_engine.py index 0fdf31e..8d0fa4b 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -137,10 +137,10 @@ class Engine: next_playlist_index.append(i) break # Discuss how this behavour should be: should it switch to a new playlist if it is the end of the playlist clip sequence already? - elif prev_grid_list[i].get('playlistPosition') + 1 == len(playlist['clips']): + elif prev_grid_list[i].get('playlistPosition', 0) + 1 == len(playlist['clips']): playlist_pos = 0 else: - playlist_pos = prev_grid_list[i].get('playlistPosition') + 1 + playlist_pos = prev_grid_list[i].get('playlistPosition', 0) + 1 rec_list.append((i, { 'clips': playlist['clips'], From 24bd733ef0efc777a44e993bb8e068a6d15d8fed Mon Sep 17 00:00:00 2001 From: j Date: Fri, 3 Aug 2018 00:58:54 +0200 Subject: [PATCH 2/2] fix default grid --- recommendation_engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recommendation_engine.py b/recommendation_engine.py index 8d0fa4b..59a26cd 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -50,7 +50,7 @@ class Engine: } if 'gridChange' not in self.state: self.state['gridChange'] = { - 'nextClip': {'locked': False, 'value': 4}, + 'nextClip': {'locked': True, 'value': 4}, 'nextPlaylist': {'locked': False, 'value': 4}, 'staySame': {'locked': False, 'value': 8} }