gazu 1.1.1__py2.py3-none-any.whl → 1.1.3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gazu/__version__.py +1 -1
- gazu/asset.py +25 -33
- gazu/casting.py +16 -41
- gazu/client.py +6 -6
- gazu/concept.py +5 -5
- gazu/edit.py +11 -14
- gazu/entity.py +3 -3
- gazu/files.py +51 -110
- gazu/helpers.py +2 -4
- gazu/person.py +24 -27
- gazu/playlist.py +13 -24
- gazu/project.py +37 -50
- gazu/scene.py +13 -15
- gazu/shot.py +35 -45
- gazu/task.py +77 -97
- gazu/user.py +27 -30
- {gazu-1.1.1.dist-info → gazu-1.1.3.dist-info}/METADATA +3 -3
- gazu-1.1.3.dist-info/RECORD +31 -0
- {gazu-1.1.1.dist-info → gazu-1.1.3.dist-info}/WHEEL +1 -1
- gazu-1.1.1.dist-info/RECORD +0 -31
- {gazu-1.1.1.dist-info → gazu-1.1.3.dist-info}/licenses/LICENSE +0 -0
- {gazu-1.1.1.dist-info → gazu-1.1.3.dist-info}/top_level.txt +0 -0
gazu/files.py
CHANGED
|
@@ -35,7 +35,7 @@ def all_output_types_for_entity(
|
|
|
35
35
|
"""
|
|
36
36
|
entity = normalize_model_parameter(entity)
|
|
37
37
|
return raw.fetch_all(
|
|
38
|
-
"entities
|
|
38
|
+
f"entities/{entity['id']}/output-types", client=client
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
|
|
@@ -48,8 +48,7 @@ def all_output_types_for_asset_instance(
|
|
|
48
48
|
list: Output types for given asset instance and entity (shot or scene).
|
|
49
49
|
"""
|
|
50
50
|
return raw.fetch_all(
|
|
51
|
-
"asset-instances
|
|
52
|
-
% (asset_instance["id"], temporal_entity["id"]),
|
|
51
|
+
f"asset-instances/{asset_instance['id']}/entities/{temporal_entity['id']}/output-types",
|
|
53
52
|
client=client,
|
|
54
53
|
)
|
|
55
54
|
|
|
@@ -116,7 +115,7 @@ def get_output_file(
|
|
|
116
115
|
Returns:
|
|
117
116
|
dict: Output file matching given ID.
|
|
118
117
|
"""
|
|
119
|
-
path = "data/output-files
|
|
118
|
+
path = f"data/output-files/{output_file_id}"
|
|
120
119
|
return raw.get(path, client=client)
|
|
121
120
|
|
|
122
121
|
|
|
@@ -146,7 +145,7 @@ def get_all_working_files_for_entity(
|
|
|
146
145
|
"""
|
|
147
146
|
entity = normalize_model_parameter(entity)
|
|
148
147
|
task = normalize_model_parameter(task)
|
|
149
|
-
path = "entities/{
|
|
148
|
+
path = f"entities/{entity['id']}/working-files"
|
|
150
149
|
|
|
151
150
|
params = {}
|
|
152
151
|
if task is not None:
|
|
@@ -194,7 +193,7 @@ def remove_preview_file(
|
|
|
194
193
|
if force:
|
|
195
194
|
params = {"force": True}
|
|
196
195
|
return raw.delete(
|
|
197
|
-
"data/preview-files
|
|
196
|
+
f"data/preview-files/{preview_file['id']}",
|
|
198
197
|
params=params,
|
|
199
198
|
client=client,
|
|
200
199
|
)
|
|
@@ -227,9 +226,7 @@ def get_all_attachment_files_for_task(
|
|
|
227
226
|
task (str / dict): Target task, as ID string or model dict.
|
|
228
227
|
"""
|
|
229
228
|
task = normalize_model_parameter(task)
|
|
230
|
-
return raw.fetch_all(
|
|
231
|
-
"tasks/%s/attachment-files" % task["id"], client=client
|
|
232
|
-
)
|
|
229
|
+
return raw.fetch_all(f"tasks/{task['id']}/attachment-files", client=client)
|
|
233
230
|
|
|
234
231
|
|
|
235
232
|
def get_all_attachment_files_for_project(
|
|
@@ -246,7 +243,7 @@ def get_all_attachment_files_for_project(
|
|
|
246
243
|
"""
|
|
247
244
|
project = normalize_model_parameter(project)
|
|
248
245
|
return raw.fetch_all(
|
|
249
|
-
"projects
|
|
246
|
+
f"projects/{project['id']}/attachment-files", client=client
|
|
250
247
|
)
|
|
251
248
|
|
|
252
249
|
|
|
@@ -277,7 +274,7 @@ def all_output_files_for_entity(
|
|
|
277
274
|
output_type = normalize_model_parameter(output_type)
|
|
278
275
|
task_type = normalize_model_parameter(task_type)
|
|
279
276
|
file_status = normalize_model_parameter(file_status)
|
|
280
|
-
path = "entities/{
|
|
277
|
+
path = f"entities/{entity['id']}/output-files"
|
|
281
278
|
|
|
282
279
|
params = {}
|
|
283
280
|
if output_type:
|
|
@@ -324,9 +321,7 @@ def all_output_files_for_asset_instance(
|
|
|
324
321
|
task_type = normalize_model_parameter(task_type)
|
|
325
322
|
output_type = normalize_model_parameter(output_type)
|
|
326
323
|
file_status = normalize_model_parameter(file_status)
|
|
327
|
-
path = "asset-instances/{
|
|
328
|
-
asset_instance_id=asset_instance["id"]
|
|
329
|
-
)
|
|
324
|
+
path = f"asset-instances/{asset_instance['id']}/output-files"
|
|
330
325
|
|
|
331
326
|
params = {}
|
|
332
327
|
if temporal_entity:
|
|
@@ -372,9 +367,7 @@ def all_output_files_for_project(
|
|
|
372
367
|
output_type = normalize_model_parameter(output_type)
|
|
373
368
|
task_type = normalize_model_parameter(task_type)
|
|
374
369
|
file_status = normalize_model_parameter(file_status)
|
|
375
|
-
path = "projects/{
|
|
376
|
-
project_id=project["id"]
|
|
377
|
-
)
|
|
370
|
+
path = f"projects/{project['id']}/output-files"
|
|
378
371
|
|
|
379
372
|
params = {}
|
|
380
373
|
if output_type:
|
|
@@ -486,13 +479,9 @@ def build_working_file_path(
|
|
|
486
479
|
if software is not None:
|
|
487
480
|
data["software_id"] = software["id"]
|
|
488
481
|
result = raw.post(
|
|
489
|
-
"data/tasks
|
|
490
|
-
)
|
|
491
|
-
return "%s%s%s" % (
|
|
492
|
-
result["path"].replace(" ", "_"),
|
|
493
|
-
sep,
|
|
494
|
-
result["name"].replace(" ", "_"),
|
|
482
|
+
f"data/tasks/{task['id']}/working-file-path", data, client=client
|
|
495
483
|
)
|
|
484
|
+
return f"{result['path'].replace(' ', '_')}{sep}{result['name'].replace(' ', '_')}"
|
|
496
485
|
|
|
497
486
|
|
|
498
487
|
@cache
|
|
@@ -542,13 +531,9 @@ def build_entity_output_file_path(
|
|
|
542
531
|
"nb_elements": nb_elements,
|
|
543
532
|
"separator": sep,
|
|
544
533
|
}
|
|
545
|
-
path = "data/entities
|
|
534
|
+
path = f"data/entities/{entity['id']}/output-file-path"
|
|
546
535
|
result = raw.post(path, data, client=client)
|
|
547
|
-
return "
|
|
548
|
-
result["folder_path"].replace(" ", "_"),
|
|
549
|
-
sep,
|
|
550
|
-
result["file_name"].replace(" ", "_"),
|
|
551
|
-
)
|
|
536
|
+
return f"{result['folder_path'].replace(' ', '_')}{sep}{result['file_name'].replace(' ', '_')}"
|
|
552
537
|
|
|
553
538
|
|
|
554
539
|
@cache
|
|
@@ -602,16 +587,9 @@ def build_asset_instance_output_file_path(
|
|
|
602
587
|
"nb_elements": nb_elements,
|
|
603
588
|
"sep": sep,
|
|
604
589
|
}
|
|
605
|
-
path = "data/asset-instances
|
|
606
|
-
asset_instance["id"],
|
|
607
|
-
temporal_entity["id"],
|
|
608
|
-
)
|
|
590
|
+
path = f"data/asset-instances/{asset_instance['id']}/entities/{temporal_entity['id']}/output-file-path"
|
|
609
591
|
result = raw.post(path, data, client=client)
|
|
610
|
-
return "
|
|
611
|
-
result["folder_path"].replace(" ", "_"),
|
|
612
|
-
sep,
|
|
613
|
-
result["file_name"].replace(" ", "_"),
|
|
614
|
-
)
|
|
592
|
+
return f"{result['folder_path'].replace(' ', '_')}{sep}{result['file_name'].replace(' ', '_')}"
|
|
615
593
|
|
|
616
594
|
|
|
617
595
|
def new_working_file(
|
|
@@ -659,7 +637,7 @@ def new_working_file(
|
|
|
659
637
|
data["software_id"] = software["id"]
|
|
660
638
|
|
|
661
639
|
return raw.post(
|
|
662
|
-
"data/tasks
|
|
640
|
+
f"data/tasks/{task['id']}/working-files/new", data, client=client
|
|
663
641
|
)
|
|
664
642
|
|
|
665
643
|
|
|
@@ -710,7 +688,7 @@ def new_entity_output_file(
|
|
|
710
688
|
task_type = normalize_model_parameter(task_type)
|
|
711
689
|
working_file = normalize_model_parameter(working_file)
|
|
712
690
|
person = normalize_model_parameter(person)
|
|
713
|
-
path = "data/entities
|
|
691
|
+
path = f"data/entities/{entity['id']}/output-files/new"
|
|
714
692
|
data = {
|
|
715
693
|
"output_type_id": output_type["id"],
|
|
716
694
|
"task_type_id": task_type["id"],
|
|
@@ -786,10 +764,7 @@ def new_asset_instance_output_file(
|
|
|
786
764
|
task_type = normalize_model_parameter(task_type)
|
|
787
765
|
working_file = normalize_model_parameter(working_file)
|
|
788
766
|
person = normalize_model_parameter(person)
|
|
789
|
-
path = "data/asset-instances
|
|
790
|
-
asset_instance["id"],
|
|
791
|
-
temporal_entity["id"],
|
|
792
|
-
)
|
|
767
|
+
path = f"data/asset-instances/{asset_instance['id']}/entities/{temporal_entity['id']}/output-files/new"
|
|
793
768
|
data = {
|
|
794
769
|
"output_type_id": output_type["id"],
|
|
795
770
|
"task_type_id": task_type["id"],
|
|
@@ -834,7 +809,7 @@ def get_next_entity_output_revision(
|
|
|
834
809
|
entity = normalize_model_parameter(entity)
|
|
835
810
|
output_type = normalize_model_parameter(output_type)
|
|
836
811
|
task_type = normalize_model_parameter(task_type)
|
|
837
|
-
path = "data/entities
|
|
812
|
+
path = f"data/entities/{entity['id']}/output-files/next-revision"
|
|
838
813
|
data = {
|
|
839
814
|
"name": name,
|
|
840
815
|
"output_type_id": output_type["id"],
|
|
@@ -867,10 +842,7 @@ def get_next_asset_instance_output_revision(
|
|
|
867
842
|
temporal_entity = normalize_model_parameter(temporal_entity)
|
|
868
843
|
output_type = normalize_model_parameter(output_type)
|
|
869
844
|
task_type = normalize_model_parameter(task_type)
|
|
870
|
-
path = "data/asset-instances
|
|
871
|
-
asset_instance["id"],
|
|
872
|
-
temporal_entity["id"],
|
|
873
|
-
)
|
|
845
|
+
path = f"data/asset-instances/{asset_instance['id']}/entities/{temporal_entity['id']}/output-files/next-revision"
|
|
874
846
|
data = {
|
|
875
847
|
"name": name,
|
|
876
848
|
"output_type_id": output_type["id"],
|
|
@@ -964,9 +936,7 @@ def get_last_output_files_for_entity(
|
|
|
964
936
|
output_type = normalize_model_parameter(output_type)
|
|
965
937
|
task_type = normalize_model_parameter(task_type)
|
|
966
938
|
file_status = normalize_model_parameter(file_status)
|
|
967
|
-
path = "entities/{
|
|
968
|
-
entity_id=entity["id"]
|
|
969
|
-
)
|
|
939
|
+
path = f"entities/{entity['id']}/output-files/last-revisions"
|
|
970
940
|
|
|
971
941
|
params = {}
|
|
972
942
|
if output_type:
|
|
@@ -1013,13 +983,7 @@ def get_last_output_files_for_asset_instance(
|
|
|
1013
983
|
output_type = normalize_model_parameter(output_type)
|
|
1014
984
|
task_type = normalize_model_parameter(task_type)
|
|
1015
985
|
file_status = normalize_model_parameter(file_status)
|
|
1016
|
-
path =
|
|
1017
|
-
"asset-instances/{asset_instance_id}/entities/{temporal_entity_id}"
|
|
1018
|
-
"/output-files/last-revisions"
|
|
1019
|
-
).format(
|
|
1020
|
-
asset_instance_id=asset_instance["id"],
|
|
1021
|
-
temporal_entity_id=temporal_entity["id"],
|
|
1022
|
-
)
|
|
986
|
+
path = f"asset-instances/{asset_instance['id']}/entities/{temporal_entity['id']}/output-files/last-revisions"
|
|
1023
987
|
|
|
1024
988
|
params = {}
|
|
1025
989
|
if output_type:
|
|
@@ -1048,7 +1012,7 @@ def get_working_files_for_task(
|
|
|
1048
1012
|
list: Working files related to given task.
|
|
1049
1013
|
"""
|
|
1050
1014
|
task = normalize_model_parameter(task)
|
|
1051
|
-
path = "data/tasks
|
|
1015
|
+
path = f"data/tasks/{task['id']}/working-files"
|
|
1052
1016
|
return raw.get(path, client=client)
|
|
1053
1017
|
|
|
1054
1018
|
|
|
@@ -1065,7 +1029,7 @@ def get_last_working_files(
|
|
|
1065
1029
|
availbable for given name.
|
|
1066
1030
|
"""
|
|
1067
1031
|
task = normalize_model_parameter(task)
|
|
1068
|
-
path = "data/tasks
|
|
1032
|
+
path = f"data/tasks/{task['id']}/working-files/last-revisions"
|
|
1069
1033
|
return raw.get(path, client=client)
|
|
1070
1034
|
|
|
1071
1035
|
|
|
@@ -1083,7 +1047,7 @@ def get_last_working_file_revision(
|
|
|
1083
1047
|
name suffix.
|
|
1084
1048
|
"""
|
|
1085
1049
|
task = normalize_model_parameter(task)
|
|
1086
|
-
path = "data/tasks
|
|
1050
|
+
path = f"data/tasks/{task['id']}/working-files/last-revisions"
|
|
1087
1051
|
working_files_dict = raw.get(path, client=client)
|
|
1088
1052
|
return working_files_dict.get(name)
|
|
1089
1053
|
|
|
@@ -1116,7 +1080,7 @@ def update_comment(
|
|
|
1116
1080
|
"""
|
|
1117
1081
|
working_file = normalize_model_parameter(working_file)
|
|
1118
1082
|
return raw.put(
|
|
1119
|
-
"/actions/working-files
|
|
1083
|
+
f"/actions/working-files/{working_file['id']}/comment",
|
|
1120
1084
|
{"comment": comment},
|
|
1121
1085
|
client=client,
|
|
1122
1086
|
)
|
|
@@ -1135,7 +1099,7 @@ def update_modification_date(
|
|
|
1135
1099
|
dict: Modified working file
|
|
1136
1100
|
"""
|
|
1137
1101
|
return raw.put(
|
|
1138
|
-
"/actions/working-files
|
|
1102
|
+
f"/actions/working-files/{working_file['id']}/modified",
|
|
1139
1103
|
{},
|
|
1140
1104
|
client=client,
|
|
1141
1105
|
)
|
|
@@ -1155,7 +1119,7 @@ def update_output_file(
|
|
|
1155
1119
|
dict: Modified output file
|
|
1156
1120
|
"""
|
|
1157
1121
|
output_file = normalize_model_parameter(output_file)
|
|
1158
|
-
path = "/data/output-files
|
|
1122
|
+
path = f"/data/output-files/{output_file['id']}"
|
|
1159
1123
|
return raw.put(path, data, client=client)
|
|
1160
1124
|
|
|
1161
1125
|
|
|
@@ -1176,7 +1140,7 @@ def set_project_file_tree(
|
|
|
1176
1140
|
"""
|
|
1177
1141
|
project = normalize_model_parameter(project)
|
|
1178
1142
|
data = {"tree_name": file_tree_name}
|
|
1179
|
-
path = "actions/projects
|
|
1143
|
+
path = f"actions/projects/{project['id']}/set-file-tree"
|
|
1180
1144
|
return raw.post(path, data, client=client)
|
|
1181
1145
|
|
|
1182
1146
|
|
|
@@ -1196,7 +1160,7 @@ def update_project_file_tree(
|
|
|
1196
1160
|
"""
|
|
1197
1161
|
project = normalize_model_parameter(project)
|
|
1198
1162
|
data = {"file_tree": file_tree}
|
|
1199
|
-
path = "data/projects
|
|
1163
|
+
path = f"data/projects/{project['id']}"
|
|
1200
1164
|
return raw.put(path, data, client=client)
|
|
1201
1165
|
|
|
1202
1166
|
|
|
@@ -1214,7 +1178,7 @@ def upload_working_file(
|
|
|
1214
1178
|
(dict): the working file model dictionary.
|
|
1215
1179
|
"""
|
|
1216
1180
|
working_file = normalize_model_parameter(working_file)
|
|
1217
|
-
url_path = "/data/working-files
|
|
1181
|
+
url_path = f"/data/working-files/{working_file['id']}/file"
|
|
1218
1182
|
return raw.upload(url_path, file_path, client=client)
|
|
1219
1183
|
|
|
1220
1184
|
|
|
@@ -1237,7 +1201,7 @@ def download_working_file(
|
|
|
1237
1201
|
)
|
|
1238
1202
|
file_path = working_file["path"]
|
|
1239
1203
|
return raw.download(
|
|
1240
|
-
"data/working-files
|
|
1204
|
+
f"data/working-files/{working_file['id']}/file",
|
|
1241
1205
|
file_path,
|
|
1242
1206
|
client=client,
|
|
1243
1207
|
)
|
|
@@ -1274,11 +1238,7 @@ def get_preview_file_url(
|
|
|
1274
1238
|
"preview-files", preview_file["id"], client=client
|
|
1275
1239
|
)
|
|
1276
1240
|
file_type = "movies" if preview_file["extension"] == "mp4" else "pictures"
|
|
1277
|
-
return "
|
|
1278
|
-
file_type,
|
|
1279
|
-
preview_file["id"],
|
|
1280
|
-
preview_file["extension"],
|
|
1281
|
-
)
|
|
1241
|
+
return f"{file_type}/originals/preview-files/{preview_file['id']}.{preview_file['extension']}"
|
|
1282
1242
|
|
|
1283
1243
|
|
|
1284
1244
|
def get_attachment_file(
|
|
@@ -1306,8 +1266,7 @@ def download_attachment_file(
|
|
|
1306
1266
|
attachment_file = normalize_model_parameter(attachment_file)
|
|
1307
1267
|
attachment_file = get_attachment_file(attachment_file["id"], client=client)
|
|
1308
1268
|
return raw.download(
|
|
1309
|
-
"data/attachment-files
|
|
1310
|
-
% (attachment_file["id"], attachment_file["name"]),
|
|
1269
|
+
f"data/attachment-files/{attachment_file['id']}/file/{attachment_file['name']}",
|
|
1311
1270
|
file_path,
|
|
1312
1271
|
client=client,
|
|
1313
1272
|
)
|
|
@@ -1326,7 +1285,7 @@ def download_preview_file_thumbnail(
|
|
|
1326
1285
|
"""
|
|
1327
1286
|
preview_file = normalize_model_parameter(preview_file)
|
|
1328
1287
|
return raw.download(
|
|
1329
|
-
"pictures/thumbnails/preview-files
|
|
1288
|
+
f"pictures/thumbnails/preview-files/{preview_file['id']}.png",
|
|
1330
1289
|
file_path,
|
|
1331
1290
|
client=client,
|
|
1332
1291
|
)
|
|
@@ -1343,7 +1302,7 @@ def download_preview_file_cover(
|
|
|
1343
1302
|
"""
|
|
1344
1303
|
preview_file = normalize_model_parameter(preview_file)
|
|
1345
1304
|
return raw.download(
|
|
1346
|
-
"pictures/originals/preview-files
|
|
1305
|
+
f"pictures/originals/preview-files/{preview_file['id']}.png",
|
|
1347
1306
|
file_path,
|
|
1348
1307
|
client=client,
|
|
1349
1308
|
)
|
|
@@ -1361,7 +1320,7 @@ def download_person_avatar(
|
|
|
1361
1320
|
"""
|
|
1362
1321
|
person = normalize_model_parameter(person)
|
|
1363
1322
|
return raw.download(
|
|
1364
|
-
"pictures/thumbnails/persons
|
|
1323
|
+
f"pictures/thumbnails/persons/{person['id']}.png",
|
|
1365
1324
|
file_path,
|
|
1366
1325
|
client=client,
|
|
1367
1326
|
)
|
|
@@ -1381,10 +1340,7 @@ def upload_person_avatar(
|
|
|
1381
1340
|
dict: Dictionary with a key of 'thumbnail_path' and a value of the
|
|
1382
1341
|
path to the static image file, relative to the host url.
|
|
1383
1342
|
"""
|
|
1384
|
-
path = (
|
|
1385
|
-
"/pictures/thumbnails/persons/%s"
|
|
1386
|
-
% normalize_model_parameter(person)["id"]
|
|
1387
|
-
)
|
|
1343
|
+
path = f"/pictures/thumbnails/persons/{normalize_model_parameter(person)['id']}"
|
|
1388
1344
|
return raw.upload(path, file_path, client=client)
|
|
1389
1345
|
|
|
1390
1346
|
|
|
@@ -1400,7 +1356,7 @@ def download_project_avatar(
|
|
|
1400
1356
|
"""
|
|
1401
1357
|
project = normalize_model_parameter(project)
|
|
1402
1358
|
return raw.download(
|
|
1403
|
-
"pictures/thumbnails/projects
|
|
1359
|
+
f"pictures/thumbnails/projects/{project['id']}.png",
|
|
1404
1360
|
file_path,
|
|
1405
1361
|
client=client,
|
|
1406
1362
|
)
|
|
@@ -1420,10 +1376,7 @@ def upload_project_avatar(
|
|
|
1420
1376
|
dict: Dictionary with a key of 'thumbnail_path' and a value of the
|
|
1421
1377
|
path to the static image file, relative to the host url.
|
|
1422
1378
|
"""
|
|
1423
|
-
path = (
|
|
1424
|
-
"/pictures/thumbnails/projects/%s"
|
|
1425
|
-
% normalize_model_parameter(project)["id"]
|
|
1426
|
-
)
|
|
1379
|
+
path = f"/pictures/thumbnails/projects/{normalize_model_parameter(project)['id']}"
|
|
1427
1380
|
return raw.upload(path, file_path, client=client)
|
|
1428
1381
|
|
|
1429
1382
|
|
|
@@ -1439,7 +1392,7 @@ def download_organisation_avatar(
|
|
|
1439
1392
|
"""
|
|
1440
1393
|
organisation = normalize_model_parameter(organisation)
|
|
1441
1394
|
return raw.download(
|
|
1442
|
-
"pictures/thumbnails/organisations
|
|
1395
|
+
f"pictures/thumbnails/organisations/{organisation['id']}.png",
|
|
1443
1396
|
file_path,
|
|
1444
1397
|
client=client,
|
|
1445
1398
|
)
|
|
@@ -1459,10 +1412,7 @@ def upload_organisation_avatar(
|
|
|
1459
1412
|
dict: Dictionary with a key of 'thumbnail_path' and a value of the
|
|
1460
1413
|
path to the static image file, relative to the host url.
|
|
1461
1414
|
"""
|
|
1462
|
-
path = (
|
|
1463
|
-
"/pictures/thumbnails/organisations/%s"
|
|
1464
|
-
% normalize_model_parameter(organisation)["id"]
|
|
1465
|
-
)
|
|
1415
|
+
path = f"/pictures/thumbnails/organisations/{normalize_model_parameter(organisation)['id']}"
|
|
1466
1416
|
return raw.upload(path, file_path, client=client)
|
|
1467
1417
|
|
|
1468
1418
|
|
|
@@ -1480,7 +1430,7 @@ def update_preview(
|
|
|
1480
1430
|
dict: Modified preview file
|
|
1481
1431
|
"""
|
|
1482
1432
|
preview_file = normalize_model_parameter(preview_file)
|
|
1483
|
-
path = "/data/preview-files
|
|
1433
|
+
path = f"/data/preview-files/{preview_file['id']}"
|
|
1484
1434
|
return raw.put(path, data, client=client)
|
|
1485
1435
|
|
|
1486
1436
|
|
|
@@ -1519,11 +1469,7 @@ def get_preview_movie_url(
|
|
|
1519
1469
|
path_prefix = "movies/lowdef"
|
|
1520
1470
|
else:
|
|
1521
1471
|
path_prefix = "movies/originals"
|
|
1522
|
-
return "
|
|
1523
|
-
path_prefix,
|
|
1524
|
-
preview_file["id"],
|
|
1525
|
-
preview_file["extension"],
|
|
1526
|
-
)
|
|
1472
|
+
return f"{path_prefix}/preview-files/{preview_file['id']}.{preview_file['extension']}"
|
|
1527
1473
|
|
|
1528
1474
|
|
|
1529
1475
|
def download_preview_movie(
|
|
@@ -1590,9 +1536,7 @@ def get_attachment_thumbnail_url(
|
|
|
1590
1536
|
str: URL to the attachment thumbnail.
|
|
1591
1537
|
"""
|
|
1592
1538
|
attachment_file = normalize_model_parameter(attachment_file)
|
|
1593
|
-
return
|
|
1594
|
-
"pictures/thumbnails/attachment-files/%s.png" % attachment_file["id"]
|
|
1595
|
-
)
|
|
1539
|
+
return f"pictures/thumbnails/attachment-files/{attachment_file['id']}.png"
|
|
1596
1540
|
|
|
1597
1541
|
|
|
1598
1542
|
def download_attachment_thumbnail(
|
|
@@ -1632,10 +1576,7 @@ def extract_frame_from_preview(
|
|
|
1632
1576
|
requests.Response: Response object containing the extracted frame.
|
|
1633
1577
|
"""
|
|
1634
1578
|
preview_file = normalize_model_parameter(preview_file)
|
|
1635
|
-
url = "pictures/preview-files
|
|
1636
|
-
preview_file["id"],
|
|
1637
|
-
frame_number,
|
|
1638
|
-
)
|
|
1579
|
+
url = f"pictures/preview-files/{preview_file['id']}/extract-frame/{frame_number}"
|
|
1639
1580
|
return raw.download(url, file_path, client=client)
|
|
1640
1581
|
|
|
1641
1582
|
|
|
@@ -1656,7 +1597,7 @@ def update_preview_position(
|
|
|
1656
1597
|
dict: Updated preview file.
|
|
1657
1598
|
"""
|
|
1658
1599
|
preview_file = normalize_model_parameter(preview_file)
|
|
1659
|
-
path = "data/preview-files
|
|
1600
|
+
path = f"data/preview-files/{preview_file['id']}/position"
|
|
1660
1601
|
return raw.put(path, {"position": position}, client=client)
|
|
1661
1602
|
|
|
1662
1603
|
|
|
@@ -1690,7 +1631,7 @@ def update_preview_annotations(
|
|
|
1690
1631
|
dict: Updated preview file with the updated annotations array.
|
|
1691
1632
|
"""
|
|
1692
1633
|
preview_file = normalize_model_parameter(preview_file)
|
|
1693
|
-
path = "actions/preview-files
|
|
1634
|
+
path = f"actions/preview-files/{preview_file['id']}/update-annotations"
|
|
1694
1635
|
data = {}
|
|
1695
1636
|
if additions is not None:
|
|
1696
1637
|
data["additions"] = additions
|
|
@@ -1718,7 +1659,7 @@ def extract_tile_from_preview(
|
|
|
1718
1659
|
requests.Response: Response object containing the extracted tile.
|
|
1719
1660
|
"""
|
|
1720
1661
|
preview_file = normalize_model_parameter(preview_file)
|
|
1721
|
-
url = "pictures/preview-files
|
|
1662
|
+
url = f"pictures/preview-files/{preview_file['id']}/extract-tile"
|
|
1722
1663
|
return raw.download(url, file_path, client=client)
|
|
1723
1664
|
|
|
1724
1665
|
|
|
@@ -1763,4 +1704,4 @@ def get_file_status_by_name(
|
|
|
1763
1704
|
Args:
|
|
1764
1705
|
name (str): The files status name.
|
|
1765
1706
|
"""
|
|
1766
|
-
return raw.fetch_first("file-status?name
|
|
1707
|
+
return raw.fetch_first(f"file-status?name={name}", client=client)
|
gazu/helpers.py
CHANGED
|
@@ -73,8 +73,7 @@ def validate_date_format(date_text: str) -> str:
|
|
|
73
73
|
datetime.datetime.strptime(date_text, "%Y-%m-%d")
|
|
74
74
|
except ValueError:
|
|
75
75
|
raise ValueError(
|
|
76
|
-
"Incorrect date format for
|
|
77
|
-
% date_text
|
|
76
|
+
f"Incorrect date format for {date_text}, should be YYYY-mm-dd or YYYY-mm-ddTHH:MM:SS"
|
|
78
77
|
)
|
|
79
78
|
return date_text
|
|
80
79
|
|
|
@@ -143,6 +142,5 @@ def download_file(
|
|
|
143
142
|
return file_path
|
|
144
143
|
else:
|
|
145
144
|
raise DownloadFileException(
|
|
146
|
-
"File (
|
|
147
|
-
% (url, response.status_code, response.reason)
|
|
145
|
+
f"File ({url}) can't be downloaded ({response.status_code} {response.reason})."
|
|
148
146
|
)
|