Use server_id when retrieving library details

This commit is contained in:
JonnyWong16 2020-04-23 22:30:32 -07:00
parent 976154ed6c
commit ecfc3ed74f
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -739,7 +739,7 @@ class Libraries(object):
except Exception as e: except Exception as e:
logger.warn(u"Tautulli Libraries :: Unable to execute database query for set_config: %s." % e) logger.warn(u"Tautulli Libraries :: Unable to execute database query for set_config: %s." % e)
def get_details(self, section_id=None): def get_details(self, section_id=None, server_id=None):
default_return = {'row_id': 0, default_return = {'row_id': 0,
'server_id': '', 'server_id': '',
'section_id': 0, 'section_id': 0,
@ -760,7 +760,10 @@ class Libraries(object):
if not section_id: if not section_id:
return default_return return default_return
def get_library_details(section_id=section_id): if server_id is None:
server_id = plexpy.CONFIG.PMS_IDENTIFIER
def get_library_details(section_id=section_id, server_id=server_id):
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()
try: try:
@ -771,8 +774,8 @@ class Libraries(object):
'custom_art_url AS custom_art, is_active, ' \ 'custom_art_url AS custom_art, is_active, ' \
'do_notify, do_notify_created, keep_history, deleted_section ' \ 'do_notify, do_notify_created, keep_history, deleted_section ' \
'FROM library_sections ' \ 'FROM library_sections ' \
'WHERE section_id = ? ' 'WHERE section_id = ? AND server_id = ? '
result = monitor_db.select(query, args=[section_id]) result = monitor_db.select(query, args=[section_id, server_id])
else: else:
result = [] result = []
except Exception as e: except Exception as e:
@ -812,7 +815,7 @@ class Libraries(object):
} }
return library_details return library_details
library_details = get_library_details(section_id=section_id) library_details = get_library_details(section_id=section_id, server_id=server_id)
if library_details: if library_details:
return library_details return library_details
@ -823,7 +826,7 @@ class Libraries(object):
# Let's first refresh the libraries list to make sure the library isn't newly added and not in the db yet # Let's first refresh the libraries list to make sure the library isn't newly added and not in the db yet
refresh_libraries() refresh_libraries()
library_details = get_library_details(section_id=section_id) library_details = get_library_details(section_id=section_id, server_id=server_id)
if library_details: if library_details:
return library_details return library_details