mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 19:53:17 +00:00
Merge pull request #123 from Hellowlol/pkkid/opt
add deleteMediaPreview
This commit is contained in:
commit
ebdc875a06
4 changed files with 33 additions and 4 deletions
|
@ -137,6 +137,14 @@ class Library(PlexObject):
|
|||
"""
|
||||
self._server.query('/library/sections/all/refresh?force=1')
|
||||
|
||||
def deleteMediaPreview(self):
|
||||
""" Delete the preview thumbnails for the all librarys.
|
||||
This cannot be undone. Recreating media preview files can take hours
|
||||
or even days.
|
||||
"""
|
||||
for section in self.sections():
|
||||
section.deleteMediaPreview()
|
||||
|
||||
|
||||
class LibrarySection(PlexObject):
|
||||
""" Base class for a single library section.
|
||||
|
@ -253,6 +261,14 @@ class LibrarySection(PlexObject):
|
|||
key = '/library/sections/%s/refresh?force=1' % self.key
|
||||
self._server.query(key)
|
||||
|
||||
def deleteMediaPreview(self):
|
||||
""" Delete the preview thumbnails for items in this library
|
||||
This cannot be undone. Recreating media preview files can take hours
|
||||
or even days.
|
||||
"""
|
||||
key = '/library/sections/%s/indexes' % self.key
|
||||
self._server.query(key, method=self._server._session.delete)
|
||||
|
||||
def listChoices(self, category, libtype=None, **kwargs):
|
||||
""" Returns a list of :class:`~plexapi.library.FilterChoice` objects for the
|
||||
specified category and libtype. kwargs can be any of the same kwargs in
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import shlex, subprocess
|
||||
from os.path import abspath, dirname, join
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
# Uncomments when a make.bat file has been added to docs.
|
||||
#@pytest.mark.xfail("os.environ.get('PLEX_TEST_TOKEN') is None",
|
||||
# reason='Allow this to fail but not for devs or travis')
|
||||
@pytest.mark.skipif(os.name == 'nt',
|
||||
reason='Skipping this test for windows as there there is no make.bat.')
|
||||
def test_build_documentation():
|
||||
# TODO: assert no WARNING messages in sphinx output
|
||||
docroot = join(dirname(dirname(abspath(__file__))), 'docs')
|
||||
cmd = shlex.split('/usr/bin/make html --warn-undefined-variables')
|
||||
proc = subprocess.Popen(cmd, cwd=docroot)
|
||||
|
|
|
@ -99,6 +99,10 @@ def test_library_Library_cancelUpdate(pms):
|
|||
pms.library.cancelUpdate()
|
||||
|
||||
|
||||
def test_library_Library_deleteMediaPreview(pms):
|
||||
pms.library.deleteMediaPreview()
|
||||
|
||||
|
||||
def _test_library_MovieSection_refresh(a_movie_section):
|
||||
a_movie_section.refresh()
|
||||
|
||||
|
@ -110,6 +114,9 @@ def test_library_MovieSection_update(a_movie_section):
|
|||
def test_library_MovieSection_cancelUpdate(a_movie_section):
|
||||
a_movie_section.cancelUpdate()
|
||||
|
||||
def test_librarty_deleteMediaPreview(a_movie_section):
|
||||
a_movie_section.deleteMediaPreview()
|
||||
|
||||
|
||||
def _test_library_MovieSection_refresh(a_movie_section):
|
||||
a_movie_section.refresh() # check how much this breaks test before enabling it.
|
||||
|
|
Loading…
Reference in a new issue