Simplify library undelete function

This commit is contained in:
JonnyWong16 2020-04-10 14:07:15 -07:00
parent f484604c69
commit 5f26d0085d
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -1068,10 +1068,10 @@ class Libraries(object):
result = monitor_db.select(query=query, args=[section_id]) result = monitor_db.select(query=query, args=[section_id])
if result: if result:
logger.info(u"Tautulli Libraries :: Re-adding library with id %s to database." % section_id) logger.info(u"Tautulli Libraries :: Re-adding library with id %s to database." % section_id)
monitor_db.action('UPDATE library_sections SET deleted_section = 0 WHERE section_id = ?', [section_id]) monitor_db.action('UPDATE library_sections '
monitor_db.action('UPDATE library_sections SET keep_history = 1 WHERE section_id = ?', [section_id]) 'SET deleted_section = 0, keep_history = 1, do_notify = 1, do_notify_created = 1 '
monitor_db.action('UPDATE library_sections SET do_notify = 1 WHERE section_id = ?', [section_id]) 'WHERE section_id = ?',
monitor_db.action('UPDATE library_sections SET do_notify_created = 1 WHERE section_id = ?', [section_id]) [section_id])
return True return True
else: else:
return False return False
@ -1081,10 +1081,10 @@ class Libraries(object):
result = monitor_db.select(query=query, args=[section_name]) result = monitor_db.select(query=query, args=[section_name])
if result: if result:
logger.info(u"Tautulli Libraries :: Re-adding library with name %s to database." % section_name) logger.info(u"Tautulli Libraries :: Re-adding library with name %s to database." % section_name)
monitor_db.action('UPDATE library_sections SET deleted_section = 0 WHERE section_name = ?', [section_name]) monitor_db.action('UPDATE library_sections '
monitor_db.action('UPDATE library_sections SET keep_history = 1 WHERE section_name = ?', [section_name]) 'SET deleted_section = 0, keep_history = 1, do_notify = 1, do_notify_created = 1 '
monitor_db.action('UPDATE library_sections SET do_notify = 1 WHERE section_name = ?', [section_name]) 'WHERE section_name = ?',
monitor_db.action('UPDATE library_sections SET do_notify_created = 1 WHERE section_name = ?', [section_name]) [section_name])
return True return True
else: else:
return False return False