create allSubfolders method for library.Folder class

This commit is contained in:
blacktwin 2020-07-30 10:33:58 -04:00
parent 83c4e64ed6
commit 614108fb63

View file

@ -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):