mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 13:40:22 +00:00
create library.Folder class
This commit is contained in:
parent
f079f7d061
commit
a5b5438122
1 changed files with 23 additions and 0 deletions
|
@ -1204,6 +1204,29 @@ class Operator(PlexObject):
|
|||
self.title = data.attrib.get('title')
|
||||
|
||||
|
||||
class Folder(PlexObject):
|
||||
""" Represents a Folder inside a library.
|
||||
|
||||
Attributes:
|
||||
key (str): Url key for folder.
|
||||
title (str): Title of folder.
|
||||
"""
|
||||
|
||||
def _loadData(self, data):
|
||||
""" Load attribute values from Plex XML response. """
|
||||
self.key = data.attrib.get('key')
|
||||
self.title = data.attrib.get('title')
|
||||
|
||||
def subfolders(self):
|
||||
""" Returns a list of available `:class:`~plexapi.library.Folder` for this folder.
|
||||
Continue down subfolders until a mediaType is found.
|
||||
"""
|
||||
if self.key.startswith('/library/metadata'):
|
||||
return self.fetchItems(self.key)
|
||||
else:
|
||||
return self.fetchItems(self.key, Folder)
|
||||
|
||||
|
||||
@utils.registerPlexObject
|
||||
class FieldType(PlexObject):
|
||||
""" Represents a FieldType for filter.
|
||||
|
|
Loading…
Reference in a new issue