Applied fix for customSectionName = next_episode[9]

IndexError: tuple index out of range, error.
This commit is contained in:
Justin Emter
2017-12-03 09:35:13 -08:00
parent 91d20a2d5a
commit 29fdf92cfa
2 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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