diff --git a/recommendation_engine.py b/recommendation_engine.py index 4e09bdd..a8d9542 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -37,15 +37,13 @@ class Engine: 'position': clip['in'] }] for video_id in inpoints: - for i, inpoint in sorted( + for i, inpoint in enumerate(sorted( inpoints[video_id], key=lambda inpoint: inpoint['position'] - ): + )): if i < len(inpoints[video_id]) - 1: - clips[inpoint['index']]['out'] = inpoints[video_id][i + 1] + clips[inpoint['index']]['out'] = inpoints[video_id][i + 1]['position'] else: - clips[inpoint['index']]['out'] self.pandora.get({ - 'id': id, keys: ['duration'] - })['duration'] + clips[inpoint['index']]['out'] = self.pandora.get(video_id, ['duration'])['duration'] return clips def _shift_clips(self, clips):