Added functionality to use custom Library names (i.e. 'Movies' : ['Films']) - Hasn't been thoroughly tested

This commit is contained in:
Justin Emter
2017-12-02 12:31:54 -08:00
parent b54ef73947
commit dc916c6ef0
2 changed files with 9 additions and 12 deletions

View File

@@ -434,14 +434,16 @@ class PseudoChannel():
"""
movies_list = []
libs_dict = config.plexLibraries
sections = self.PLEX.library.sections()
for section in sections:
for theSection in sections:
for correct_lib_name, user_lib_name in libs_dict.items():
if section.title.lower() in [x.lower() for x in user_lib_name]:
if theSection.title.lower() in [x.lower() for x in user_lib_name]:
print "correct_lib_name", correct_lib_name
if correct_lib_name == "Movies":
print "entry[13]", entry[13]
movies = self.PLEX.library.section(section.title)
movies = self.PLEX.library.section(theSection.title)
try:
thestr = entry[13]
@@ -463,7 +465,7 @@ class PseudoChannel():
pass
if len(movies_list):
if (len(movies_list) > 0):
the_movie = self.db.get_movie(random.choice(movies_list).title)
@@ -471,18 +473,12 @@ class PseudoChannel():
self.db.update_movies_table_with_last_played_date(the_movie[3])
else:
print "movies_list", movies_list
print("For some reason, I've failed getting movie with xtra args.")
the_movie = self.db.get_random_movie()
# Updating movies table in the db with lastPlayedDate entry
self.db.update_movies_table_with_last_played_date(the_movie[3])
except:
print("For some reason, I've failed getting movie with xtra args.")
the_movie = self.db.get_random_movie()
"""Updating movies table in the db with lastPlayedDate entry"""
self.db.update_movies_table_with_last_played_date(the_movie[3])

View File

@@ -229,6 +229,7 @@ class PseudoChannelDatabase():
customSectionName
):
print "sectionType", sectionType
print "customSectionName", customSectionName
unix = int(time.time())
try: