diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index d413499d..b724153b 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -659,7 +659,8 @@ class DataFactory(object): ' FROM session_history ' \ ' WHERE session_history.stopped >= %s ' \ ' GROUP BY %s) AS sh ' \ - 'LEFT OUTER JOIN library_sections AS ls ON sh.section_id = ls.section_id ' \ + 'LEFT OUTER JOIN (SELECT * FROM library_sections WHERE deleted_section = 0) ' \ + ' AS ls ON sh.section_id = ls.section_id ' \ 'GROUP BY sh.section_id ' \ 'ORDER BY %s DESC, sh.started DESC ' \ 'LIMIT %s OFFSET %s ' % (timestamp, group_by, sort_type, stats_count, stats_start) diff --git a/plexpy/libraries.py b/plexpy/libraries.py index af66cfc7..6ec462bc 100644 --- a/plexpy/libraries.py +++ b/plexpy/libraries.py @@ -1099,7 +1099,7 @@ class Libraries(object): if row_ids and row_ids is not None: row_ids = list(map(helpers.cast_to_int, row_ids.split(','))) - # Get the user_ids corresponding to the row_ids + # Get the section_ids corresponding to the row_ids result = monitor_db.select('SELECT server_id, section_id FROM library_sections ' 'WHERE id IN ({})'.format(','.join(['?'] * len(row_ids))), row_ids)