diff --git a/recommendation_engine.py b/recommendation_engine.py index 90ab662..c2d921a 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -127,18 +127,19 @@ class Engine: # Sort clips clips = sorted( clips, - key=lambda clip: order[clip['id'].split('/')[0]] * 1000000 + clip['in'] + key=lambda clip: (order[clip['id'].split('/')[0]], clip['in']) ) # Get and cache playlists self.playlists = [playlist for playlist in [{ 'id': storyline['id'], 'name': storyline['nodename'], 'tags': storyline['tags'], - 'clips': self._patch_clips([{ + 'clips': [{ + 'item': clip['id'].split('/')[0], 'id': clip['id'], 'in': clip['in'], 'out': clip['out'] - } for clip in clips if clip['value'] == storyline['name']]) + } for clip in clips if clip['value'] == storyline['name']] } for storyline in storylines] if playlist['clips']] with open(os.path.join(self.path, 'playlists.json'), 'w') as f: f.write(json.dumps(self.playlists, indent=4, sort_keys=True))