From 85dda97e52c828a86b67e75b7e38f77a5dd265c2 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 18 Aug 2022 10:02:32 -0700 Subject: [PATCH] Fix library stats not shown for libraries without history * Fixes #1818 --- plexpy/datafactory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index eb4c18ae..09b26a45 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -1048,8 +1048,8 @@ class DataFactory(object): 'shm.art, sh.media_type, shm.content_rating, shm.labels, shm.live, shm.guid, ' \ 'MAX(sh.started) AS last_watch ' \ 'FROM library_sections AS ls ' \ - 'JOIN session_history AS sh ON ls.section_id = sh.section_id ' \ - 'JOIN session_history_metadata AS shm ON sh.id = shm.id ' \ + 'LEFT OUTER JOIN session_history AS sh ON ls.section_id = sh.section_id ' \ + 'LEFT OUTER JOIN session_history_metadata AS shm ON sh.id = shm.id ' \ 'WHERE ls.section_id IN (%s) AND ls.deleted_section = 0 ' \ 'GROUP BY ls.id ' \ 'ORDER BY ls.section_type, ls.count DESC, ls.parent_count DESC, ls.child_count DESC ' % ','.join(library_cards) @@ -1084,9 +1084,9 @@ class DataFactory(object): 'count': item['count'], 'child_count': item['parent_count'], 'grandchild_count': item['child_count'], - 'thumb': thumb, - 'grandparent_thumb': item['grandparent_thumb'], - 'art': item['art'], + 'thumb': thumb or '', + 'grandparent_thumb': item['grandparent_thumb'] or '', + 'art': item['art'] or '', 'title': item['full_title'], 'grandparent_title': item['grandparent_title'], 'grandchild_title': item['title'],