mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 14:14:19 +00:00
create isBrowseable method in server.PlexServer
This commit is contained in:
parent
e46fc1cdc4
commit
921356099e
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@ from urllib.parse import urlencode
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
import os
|
||||||
from plexapi import (BASE_HEADERS, CONFIG, TIMEOUT, X_PLEX_CONTAINER_SIZE, log,
|
from plexapi import (BASE_HEADERS, CONFIG, TIMEOUT, X_PLEX_CONTAINER_SIZE, log,
|
||||||
logfilter)
|
logfilter)
|
||||||
from plexapi import utils
|
from plexapi import utils
|
||||||
|
@ -384,6 +385,18 @@ class PlexServer(PlexObject):
|
||||||
for path, paths, files in self.walk(_path):
|
for path, paths, files in self.walk(_path):
|
||||||
yield path, paths, files
|
yield path, paths, files
|
||||||
|
|
||||||
|
def isBrowsable(self, path):
|
||||||
|
""" Returns True if the Plex server can browse the given path.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
path (:class:`~plexapi.library.Path` or str): Full path to browse.
|
||||||
|
"""
|
||||||
|
if isinstance(path, Path):
|
||||||
|
path = path.path
|
||||||
|
path = os.path.normpath(path)
|
||||||
|
paths = [p.path for p in self.browse(os.path.dirname(path), includeFiles=False)]
|
||||||
|
return path in paths
|
||||||
|
|
||||||
def clients(self):
|
def clients(self):
|
||||||
""" Returns list of all :class:`~plexapi.client.PlexClient` objects connected to server. """
|
""" Returns list of all :class:`~plexapi.client.PlexClient` objects connected to server. """
|
||||||
items = []
|
items = []
|
||||||
|
|
Loading…
Reference in a new issue