mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Add new librarys to homepage automatically
This commit is contained in:
parent
3e996d284d
commit
4797b1a3b7
1 changed files with 9 additions and 1 deletions
|
@ -62,6 +62,7 @@ def refresh_libraries():
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
||||||
library_keys = []
|
library_keys = []
|
||||||
|
new_keys = []
|
||||||
|
|
||||||
for section in library_sections:
|
for section in library_sections:
|
||||||
section_keys = {'server_id': server_id,
|
section_keys = {'server_id': server_id,
|
||||||
|
@ -77,13 +78,20 @@ def refresh_libraries():
|
||||||
'child_count': section.get('child_count', None),
|
'child_count': section.get('child_count', None),
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_db.upsert('library_sections', key_dict=section_keys, value_dict=section_values)
|
result = monitor_db.upsert('library_sections', key_dict=section_keys, value_dict=section_values)
|
||||||
|
|
||||||
library_keys.append(section['section_id'])
|
library_keys.append(section['section_id'])
|
||||||
|
|
||||||
|
if result == 'insert':
|
||||||
|
new_keys.append(section['section_id'])
|
||||||
|
|
||||||
if plexpy.CONFIG.HOME_LIBRARY_CARDS == ['first_run_wizard']:
|
if plexpy.CONFIG.HOME_LIBRARY_CARDS == ['first_run_wizard']:
|
||||||
plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', library_keys)
|
plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', library_keys)
|
||||||
plexpy.CONFIG.write()
|
plexpy.CONFIG.write()
|
||||||
|
else:
|
||||||
|
new_keys = plexpy.CONFIG.HOME_LIBRARY_CARDS + new_keys
|
||||||
|
plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', new_keys)
|
||||||
|
plexpy.CONFIG.write()
|
||||||
|
|
||||||
if plexpy.CONFIG.UPDATE_SECTION_IDS == 1 or plexpy.CONFIG.UPDATE_SECTION_IDS == -1:
|
if plexpy.CONFIG.UPDATE_SECTION_IDS == 1 or plexpy.CONFIG.UPDATE_SECTION_IDS == -1:
|
||||||
# Start library section_id update on it's own thread
|
# Start library section_id update on it's own thread
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue