Added children function
Allows to retrieve children of a file record.
This commit is contained in:
@@ -37,3 +37,17 @@ class File(List, Find, Create, Post, Update, Delete, Replace):
|
||||
url = utils.join_url(self.build_previews_server_path, path)
|
||||
api.get(url)
|
||||
return self.success()
|
||||
|
||||
def children(self, api=None):
|
||||
"""Collect children (variations) of the current file. Used to connect
|
||||
different resolutions of the same picture, or multiple versions of the
|
||||
same video in different formats/containers.
|
||||
|
||||
TODO: add params to support pagination.
|
||||
"""
|
||||
api = api or self.api
|
||||
files = self.all({'where': '{"parent": "%s"}' % self._id}, api=api)
|
||||
print files._items
|
||||
if not files._items:
|
||||
return None
|
||||
return files
|
||||
|
||||
Reference in New Issue
Block a user