From 29fdf92cfad514bb2dcbadb40e2b1cb0a04a7db9 Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Sun, 3 Dec 2017 09:35:13 -0800 Subject: [PATCH] Applied fix for customSectionName = next_episode[9] IndexError: tuple index out of range, error. --- src/PseudoChannelDatabase.py | 2 +- src/PseudoChannelRandomMovie.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PseudoChannelDatabase.py b/src/PseudoChannelDatabase.py index 5045d41..aa14215 100644 --- a/src/PseudoChannelDatabase.py +++ b/src/PseudoChannelDatabase.py @@ -423,7 +423,7 @@ class PseudoChannelDatabase(): def get_first_episode(self, tvshow): sql = ("SELECT id, unix, mediaID, title, duration, MIN(episodeNumber), MIN(seasonNumber), " - "showTitle FROM episodes WHERE ( showTitle LIKE ?) COLLATE NOCASE") + "showTitle, plexMediaID, customSectionName FROM episodes WHERE ( showTitle LIKE ?) COLLATE NOCASE") self.cursor.execute(sql, (tvshow, )) first_episode = self.cursor.fetchone() return first_episode diff --git a/src/PseudoChannelRandomMovie.py b/src/PseudoChannelRandomMovie.py index 08aaaf1..a97b11d 100644 --- a/src/PseudoChannelRandomMovie.py +++ b/src/PseudoChannelRandomMovie.py @@ -1,20 +1,20 @@ """ PseudoChannelRandomMovie -In order to get a better randomization by avoiding movie repeates, +In order to get a better randomization by avoiding movie repeats, this class helps get a random movie based on its "lastPlayedDate". A list of all the movies are passed into this class ordered by "lastPlayedDate". The function then runs through the array to find the first movie that satisfies the delta of "lastPlayedDate" -and "TIME_GAP_MONTHS". Then a new array with the rest of the movies +and "TIME_GAP_DAYS". Then a new array with the rest of the movies that satisfy the condition is created. From there a random movie is picked and returned. If however, the function hits the end of the array of movies and the condition is not satisfied (all movies have -been played more recently than the "TIME_GAP_MONTHS"), a random movie +been played more recently than the "TIME_GAP_DAYS"), a random movie is then returned. For smaller movie libraries it'll be useful to calculate a reasonable -"TIME_GAP_MONTHS". +"TIME_GAP_DAYS". """ import datetime import random