Calculate how long each slide should show

def set_duration(self, duration):
        """ Calculate how long each slide should show """
        fixed = sum(int(x.get('time', 0)) for x in self.slides)

        nfixed = len([x for x in self.slides if x.get('time', 0) > 0])

        unfixed = len(self.slides) - nfixed

        self.wait = max(1, int(duration / unfixed))