@@ -42,11 +42,15 @@ def get_updated_assets(self, account_id, project_id, timestamp):
4242 return self .client ._api_call ('post' , endpoint , payload = payload )
4343
4444 def get_assets_recursively (self , asset_id , slim = True ):
45- assets = self .client .assets .get_children (asset_id , slim )
45+ assets = self .client .assets .get_children (asset_id , slim = slim )
4646 print ("Number of assets at top level" , len (assets ))
4747
4848 for asset in assets :
49+ # try:
4950 print (f"Type: { asset ['_type' ]} , Name: { asset ['name' ]} , Children: { len (asset ['children' ])} " )
51+ # except KeyError:
52+ # print("No children found")
53+
5054 total_bytes = 0
5155
5256 if asset ['_type' ] == "file" :
@@ -55,7 +59,7 @@ def get_assets_recursively(self, asset_id, slim=True):
5559
5660 if asset ['_type' ] == "verson_stack" :
5761 print ("Grabbing top item from version stack" )
58- versions = self .client .assets .get_children (asset ['id' ])
62+ versions = self .client .assets .get_children (asset ['id' ], slim = True )
5963 asset = versions [0 ] # re-assign on purpose
6064 continue
6165
@@ -64,10 +68,7 @@ def get_assets_recursively(self, asset_id, slim=True):
6468 # try:
6569 if asset ['item_count' ] > 3 :
6670 # Recursively fetch the contents of the folder because we have to
67- # asset = deepcopy(asset)
68- # asset.pop('children')
6971 asset ['children' ] = self .get_assets_recursively (asset ['id' ], slim )
70- # asset.update({'children': self.get_assets_recursively(asset['id'], slim)})
7172 print ("Grabbed more items for this sub dir" )
7273
7374 else :
@@ -83,7 +84,7 @@ def get_assets_recursively(self, asset_id, slim=True):
8384
8485 return assets
8586
86- def build_project_tree (self , project_id , slim = False ):
87+ def build_project_tree (self , project_id , slim = True ):
8788 # if slim == True:
8889 # self.client.assets.get_children()
8990
@@ -97,7 +98,7 @@ def build_project_tree(self, project_id, slim=False):
9798
9899 def download_project (self , project_id , destination ):
99100 project = self .client .projects .get (project_id )
100- initial_tree = self .get_assets_recursively (project ['root_asset_id' ], slim = True )
101+ initial_tree = self .get_assets_recursively (project ['root_asset_id' ])
101102 self .recursive_downloader (destination , initial_tree )
102103 # pprint(initial_tree)
103104 # print(f"Downloading {Utils.format_bytes(total_bytes, type='size')}")
0 commit comments