mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 21:51:14 -07:00
Add item counts to database
* Add schedule task to refresh libraries list * Update library stats to use library_sections table
This commit is contained in:
parent
771885f27f
commit
8f367d140f
7 changed files with 227 additions and 71 deletions
|
@ -654,6 +654,35 @@ class DataFactory(object):
|
|||
|
||||
return home_stats
|
||||
|
||||
def get_library_stats(self, library_cards=''):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
library_stats = []
|
||||
|
||||
for id in library_cards:
|
||||
if id.isdigit():
|
||||
try:
|
||||
query = 'SELECT section_id, section_name, section_type, thumb, count, parent_count, child_count ' \
|
||||
'FROM library_sections ' \
|
||||
'WHERE section_id = %s' % id
|
||||
result = monitor_db.select(query)
|
||||
except:
|
||||
logger.warn("Unable to execute database query for get_library_stats.")
|
||||
return None
|
||||
|
||||
for item in result:
|
||||
library = {'section_id': item['section_id'],
|
||||
'section_name': item['section_name'],
|
||||
'section_type': item['section_type'],
|
||||
'thumb': item['thumb'],
|
||||
'count': item['count'],
|
||||
'parent_count': item['parent_count'],
|
||||
'child_count': item['child_count']
|
||||
}
|
||||
library_stats.append(library)
|
||||
|
||||
return library_stats
|
||||
|
||||
def get_stream_details(self, row_id=None):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue