mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 19:53:17 +00:00
create allSubfolders method for library.Folder class
This commit is contained in:
parent
83c4e64ed6
commit
614108fb63
1 changed files with 16 additions and 0 deletions
|
@ -1232,6 +1232,22 @@ class Folder(PlexObject):
|
|||
else:
|
||||
return self.fetchItems(self.key, Folder)
|
||||
|
||||
def allSubfolders(self):
|
||||
""" Returns a list of all available `:class:`~plexapi.library.Folder` for this folder.
|
||||
Only returns `:class:`~plexapi.library.Folder`.
|
||||
"""
|
||||
folders =[]
|
||||
for folder in self.subfolders():
|
||||
if not folder.key.startswith('/library/metadata'):
|
||||
folders.append(folder)
|
||||
while True:
|
||||
for subfolder in folder.subfolders():
|
||||
if not subfolder.key.startswith('/library/metadata'):
|
||||
folders.append(subfolder)
|
||||
continue
|
||||
break
|
||||
return folders
|
||||
|
||||
|
||||
@utils.registerPlexObject
|
||||
class FieldType(PlexObject):
|
||||
|
|
Loading…
Reference in a new issue