From d2abf860b9fcc7ec898acf1d4aa2d5a0e103b345 Mon Sep 17 00:00:00 2001 From: rlx Date: Fri, 26 Jan 2018 12:01:36 +0100 Subject: [PATCH] fix clip patch --- recommendation_engine.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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):