From dc916c6ef0099f7b2a43c2c9d1e1640c77e6150f Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Sat, 2 Dec 2017 12:31:54 -0800 Subject: [PATCH] Added functionality to use custom Library names (i.e. 'Movies' : ['Films']) - Hasn't been thoroughly tested --- PseudoChannel.py | 20 ++++++++------------ src/PseudoChannelDatabase.py | 1 + 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/PseudoChannel.py b/PseudoChannel.py index d6cea19..dbab6a4 100644 --- a/PseudoChannel.py +++ b/PseudoChannel.py @@ -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]) diff --git a/src/PseudoChannelDatabase.py b/src/PseudoChannelDatabase.py index 4d97ab2..f6f7397 100644 --- a/src/PseudoChannelDatabase.py +++ b/src/PseudoChannelDatabase.py @@ -229,6 +229,7 @@ class PseudoChannelDatabase(): customSectionName ): + print "sectionType", sectionType print "customSectionName", customSectionName unix = int(time.time()) try: