From 680195c7b430d682b1448dd394538cd5d8d0fc17 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Tue, 8 Sep 2015 15:09:05 +0200 Subject: [PATCH] Added children function Allows to retrieve children of a file record. --- pillarsdk/files.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pillarsdk/files.py b/pillarsdk/files.py index 0ea1130..31743ff 100755 --- a/pillarsdk/files.py +++ b/pillarsdk/files.py @@ -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