Fix delete media info cache

This commit is contained in:
JonnyWong16 2018-02-14 11:19:53 -08:00
parent 5e0c0365fb
commit 93e4853ea2
3 changed files with 20 additions and 20 deletions

30
API.md
View file

@ -93,21 +93,6 @@ Returns:
Delete and recreate the cache directory. Delete and recreate the cache directory.
### delete_datatable_media_info_cache
Delete the media info table cache for a specific library.
```
Required parameters:
section_id (str): The id of the Plex library section
Optional parameters:
None
Returns:
None
```
### delete_image_cache ### delete_image_cache
Delete and recreate the image cache directory. Delete and recreate the image cache directory.
@ -176,6 +161,21 @@ Returns:
``` ```
### delete_media_info_cache
Delete the media info table cache for a specific library.
```
Required parameters:
section_id (str): The id of the Plex library section
Optional parameters:
None
Returns:
None
```
### delete_mobile_device ### delete_mobile_device
Remove a mobile device from the database. Remove a mobile device from the database.

View file

@ -1006,13 +1006,13 @@ class Libraries(object):
except Exception as e: except Exception as e:
logger.warn(u"Tautulli Libraries :: Unable to execute database query for undelete: %s." % e) logger.warn(u"Tautulli Libraries :: Unable to execute database query for undelete: %s." % e)
def delete_datatable_media_info_cache(self, section_id=None): def delete_media_info_cache(self, section_id=None):
import os import os
try: try:
if section_id.isdigit(): if section_id.isdigit():
[os.remove(os.path.join(plexpy.CONFIG.CACHE_DIR, f)) for f in os.listdir(plexpy.CONFIG.CACHE_DIR) [os.remove(os.path.join(plexpy.CONFIG.CACHE_DIR, f)) for f in os.listdir(plexpy.CONFIG.CACHE_DIR)
if f.startswith('media_info-%s' % section_id) and f.endswith('.json')] if f.startswith('media_info_%s' % section_id) and f.endswith('.json')]
logger.debug(u"Tautulli Libraries :: Deleted media info table cache for section_id %s." % section_id) logger.debug(u"Tautulli Libraries :: Deleted media info table cache for section_id %s." % section_id)
return 'Deleted media info table cache for library with id %s.' % section_id return 'Deleted media info table cache for library with id %s.' % section_id

View file

@ -954,7 +954,7 @@ class WebInterface(object):
@cherrypy.tools.json_out() @cherrypy.tools.json_out()
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
@addtoapi() @addtoapi()
def delete_datatable_media_info_cache(self, section_id, **kwargs): def delete_media_info_cache(self, section_id, **kwargs):
""" Delete the media info table cache for a specific library. """ Delete the media info table cache for a specific library.
``` ```
@ -974,7 +974,7 @@ class WebInterface(object):
if section_id not in section_ids: if section_id not in section_ids:
if section_id: if section_id:
library_data = libraries.Libraries() library_data = libraries.Libraries()
delete_row = library_data.delete_datatable_media_info_cache(section_id=section_id) delete_row = library_data.delete_media_info_cache(section_id=section_id)
if delete_row: if delete_row:
return {'message': delete_row} return {'message': delete_row}