mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add method to delete duplicate libraries
This commit is contained in:
parent
ee754ea533
commit
9cd6396c35
2 changed files with 32 additions and 1 deletions
|
@ -879,3 +879,21 @@ class Libraries(object):
|
|||
return 'Unable to delete media info table cache, section_id not valid.'
|
||||
except Exception as e:
|
||||
logger.warn(u"PlexPy Libraries :: Unable to delete media info table cache: %s." % e)
|
||||
|
||||
def delete_duplicate_libraries(self):
|
||||
from plexpy import plextv
|
||||
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
# Refresh the PMS_URL to make sure the server_id is updated
|
||||
plextv.get_real_pms_url()
|
||||
|
||||
server_id = plexpy.CONFIG.PMS_IDENTIFIER
|
||||
|
||||
try:
|
||||
logger.debug(u"PlexPy Libraries :: Deleting libraries where server_id does not match %s." % server_id)
|
||||
monitor_db.action('DELETE FROM library_sections WHERE server_id != ?', [server_id])
|
||||
|
||||
return 'Deleted duplicate libraries from the database.'
|
||||
except Exception as e:
|
||||
logger.warn(u"PlexPy Libraries :: Unable to delete duplicate libraries: %s." % e)
|
Loading…
Add table
Add a link
Reference in a new issue