gazu 1.0.2__py2.py3-none-any.whl → 1.1.0__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 +157 -51
- gazu/cache.py +25 -17
- gazu/casting.py +178 -25
- gazu/client.py +124 -71
- gazu/concept.py +35 -17
- gazu/context.py +41 -15
- gazu/edit.py +36 -17
- gazu/encoder.py +3 -1
- gazu/entity.py +47 -18
- gazu/events.py +27 -22
- gazu/files.py +616 -220
- gazu/helpers.py +13 -5
- gazu/person.py +194 -86
- gazu/playlist.py +107 -53
- gazu/project.py +207 -92
- gazu/py.typed +0 -0
- gazu/scene.py +57 -17
- gazu/search.py +10 -3
- gazu/shot.py +195 -76
- gazu/sorting.py +4 -1
- gazu/sync.py +167 -97
- gazu/task.py +544 -186
- gazu/user.py +127 -63
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/METADATA +2 -1
- gazu-1.1.0.dist-info/RECORD +31 -0
- gazu-1.0.2.dist-info/RECORD +0 -30
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/WHEEL +0 -0
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/licenses/LICENSE +0 -0
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/top_level.txt +0 -0
gazu/playlist.py
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
1
7
|
from . import client as raw
|
|
2
8
|
|
|
3
9
|
from .helpers import normalize_model_parameter
|
|
4
10
|
from .sorting import sort_by_name
|
|
5
11
|
|
|
6
12
|
from .cache import cache
|
|
13
|
+
from .client import KitsuClient
|
|
7
14
|
|
|
8
15
|
default = raw.default_client
|
|
9
16
|
|
|
10
17
|
|
|
11
18
|
@cache
|
|
12
|
-
def all_playlists(client=default):
|
|
19
|
+
def all_playlists(client: KitsuClient = default) -> list[dict]:
|
|
13
20
|
"""
|
|
14
21
|
Returns:
|
|
15
22
|
list: All playlists for all projects.
|
|
@@ -18,7 +25,9 @@ def all_playlists(client=default):
|
|
|
18
25
|
|
|
19
26
|
|
|
20
27
|
@cache
|
|
21
|
-
def all_shots_for_playlist(
|
|
28
|
+
def all_shots_for_playlist(
|
|
29
|
+
playlist: str | dict, client: KitsuClient = default
|
|
30
|
+
) -> list[dict]:
|
|
22
31
|
"""
|
|
23
32
|
Args:
|
|
24
33
|
playlist (str / dict): The playlist dict or the playlist ID.
|
|
@@ -32,10 +41,13 @@ def all_shots_for_playlist(playlist, client=default):
|
|
|
32
41
|
|
|
33
42
|
|
|
34
43
|
@cache
|
|
35
|
-
def all_playlists_for_project(
|
|
44
|
+
def all_playlists_for_project(
|
|
45
|
+
project: str | dict, client: KitsuClient = default, page: int = 1
|
|
46
|
+
) -> list[dict]:
|
|
36
47
|
"""
|
|
37
48
|
Args:
|
|
38
49
|
project (str / dict): The project dict or the project ID.
|
|
50
|
+
page (int): Page number for pagination
|
|
39
51
|
|
|
40
52
|
Returns:
|
|
41
53
|
list: All playlists for the given project
|
|
@@ -51,16 +63,16 @@ def all_playlists_for_project(project, client=default, page=1):
|
|
|
51
63
|
|
|
52
64
|
|
|
53
65
|
@cache
|
|
54
|
-
def all_playlists_for_episode(
|
|
66
|
+
def all_playlists_for_episode(
|
|
67
|
+
episode: str | dict, client: KitsuClient = default
|
|
68
|
+
) -> list[dict]:
|
|
55
69
|
"""
|
|
56
|
-
|
|
57
70
|
Args:
|
|
58
71
|
episode (str / dict): The episode dict or the episode ID.
|
|
59
72
|
|
|
60
73
|
Returns:
|
|
61
74
|
list: All playlists for the given episode.
|
|
62
75
|
"""
|
|
63
|
-
|
|
64
76
|
project = normalize_model_parameter(episode["project_id"])
|
|
65
77
|
return sort_by_name(
|
|
66
78
|
raw.fetch_all(
|
|
@@ -75,7 +87,7 @@ def all_playlists_for_episode(episode, client=default):
|
|
|
75
87
|
|
|
76
88
|
|
|
77
89
|
@cache
|
|
78
|
-
def get_playlist(playlist, client=default):
|
|
90
|
+
def get_playlist(playlist: str | dict, client: KitsuClient = default) -> dict:
|
|
79
91
|
"""
|
|
80
92
|
Args:
|
|
81
93
|
playlist (str / dict): The playlist dict or the playlist ID.
|
|
@@ -83,13 +95,14 @@ def get_playlist(playlist, client=default):
|
|
|
83
95
|
Returns:
|
|
84
96
|
dict: playlist object for given id.
|
|
85
97
|
"""
|
|
86
|
-
|
|
87
98
|
playlist = normalize_model_parameter(playlist)
|
|
88
99
|
return raw.fetch_one("playlists", playlist["id"], client=client)
|
|
89
100
|
|
|
90
101
|
|
|
91
102
|
@cache
|
|
92
|
-
def get_playlist_by_name(
|
|
103
|
+
def get_playlist_by_name(
|
|
104
|
+
project: str | dict, name: str, client: KitsuClient = default
|
|
105
|
+
) -> dict | None:
|
|
93
106
|
"""
|
|
94
107
|
Args:
|
|
95
108
|
project (str / dict): The project dict or the project ID.
|
|
@@ -104,19 +117,22 @@ def get_playlist_by_name(project, name, client=default):
|
|
|
104
117
|
|
|
105
118
|
|
|
106
119
|
def new_playlist(
|
|
107
|
-
project,
|
|
108
|
-
name,
|
|
109
|
-
episode=None,
|
|
110
|
-
for_entity="shot",
|
|
111
|
-
for_client=False,
|
|
112
|
-
client=default,
|
|
113
|
-
):
|
|
120
|
+
project: str | dict,
|
|
121
|
+
name: str,
|
|
122
|
+
episode: str | dict | None = None,
|
|
123
|
+
for_entity: Literal["shot", "asset", "sequence"] = "shot",
|
|
124
|
+
for_client: bool = False,
|
|
125
|
+
client: KitsuClient = default,
|
|
126
|
+
) -> dict:
|
|
114
127
|
"""
|
|
115
128
|
Create a new playlist in the database for given project.
|
|
116
129
|
|
|
117
130
|
Args:
|
|
118
131
|
project (str / dict): The project dict or the project ID.
|
|
119
132
|
name (str): Playlist name.
|
|
133
|
+
for_entity (str): The type of entity to include in the playlist, can
|
|
134
|
+
be one of "asset", "sequence" or "shot".
|
|
135
|
+
for_client (bool): Whether the playlist should be shared with clients.
|
|
120
136
|
|
|
121
137
|
Returns:
|
|
122
138
|
dict: Created playlist.
|
|
@@ -137,7 +153,7 @@ def new_playlist(
|
|
|
137
153
|
return playlist
|
|
138
154
|
|
|
139
155
|
|
|
140
|
-
def update_playlist(playlist, client=default):
|
|
156
|
+
def update_playlist(playlist: dict, client: KitsuClient = default) -> dict:
|
|
141
157
|
"""
|
|
142
158
|
Save given playlist data into the API. Metadata are fully replaced by
|
|
143
159
|
the ones set on given playlist.
|
|
@@ -153,7 +169,9 @@ def update_playlist(playlist, client=default):
|
|
|
153
169
|
)
|
|
154
170
|
|
|
155
171
|
|
|
156
|
-
def get_entity_preview_files(
|
|
172
|
+
def get_entity_preview_files(
|
|
173
|
+
entity: str | dict, client: KitsuClient = default
|
|
174
|
+
) -> dict[str, list[dict]]:
|
|
157
175
|
"""
|
|
158
176
|
Get all preview files grouped by task type for a given entity.
|
|
159
177
|
|
|
@@ -171,8 +189,12 @@ def get_entity_preview_files(entity, client=default):
|
|
|
171
189
|
|
|
172
190
|
|
|
173
191
|
def add_entity_to_playlist(
|
|
174
|
-
playlist
|
|
175
|
-
|
|
192
|
+
playlist: dict,
|
|
193
|
+
entity: str | dict,
|
|
194
|
+
preview_file: str | dict | None = None,
|
|
195
|
+
persist: bool = True,
|
|
196
|
+
client: KitsuClient = default,
|
|
197
|
+
) -> dict:
|
|
176
198
|
"""
|
|
177
199
|
Add an entity to the playlist, use the last uploaded preview as revision
|
|
178
200
|
to review.
|
|
@@ -209,14 +231,18 @@ def add_entity_to_playlist(
|
|
|
209
231
|
|
|
210
232
|
|
|
211
233
|
def remove_entity_from_playlist(
|
|
212
|
-
playlist
|
|
213
|
-
|
|
234
|
+
playlist: dict,
|
|
235
|
+
entity: str | dict,
|
|
236
|
+
persist: bool = True,
|
|
237
|
+
client: KitsuClient = default,
|
|
238
|
+
) -> dict:
|
|
214
239
|
"""
|
|
215
240
|
Remove all occurences of a given entity from a playlist.
|
|
216
241
|
|
|
217
242
|
Args:
|
|
218
243
|
playlist (dict): Playlist object to modify
|
|
219
244
|
entity (str / dict): the entity to remove or its ID
|
|
245
|
+
persist (bool): Set it to True to save the result to the API.
|
|
220
246
|
|
|
221
247
|
Returns:
|
|
222
248
|
dict: Updated playlist.
|
|
@@ -233,14 +259,20 @@ def remove_entity_from_playlist(
|
|
|
233
259
|
|
|
234
260
|
|
|
235
261
|
def update_entity_preview(
|
|
236
|
-
playlist
|
|
237
|
-
|
|
262
|
+
playlist: dict,
|
|
263
|
+
entity: str | dict,
|
|
264
|
+
preview_file: str | dict,
|
|
265
|
+
persist: bool = True,
|
|
266
|
+
client: KitsuClient = default,
|
|
267
|
+
) -> dict:
|
|
238
268
|
"""
|
|
239
|
-
|
|
269
|
+
Update the preview file linked to a given entity in a playlist.
|
|
240
270
|
|
|
241
271
|
Args:
|
|
242
|
-
playlist (dict): Playlist object to modify
|
|
243
|
-
entity (str / dict):
|
|
272
|
+
playlist (dict): Playlist object to modify.
|
|
273
|
+
entity (str / dict): The entity to update the preview file for.
|
|
274
|
+
preview_file (str / dict): The new preview file to set for the entity.
|
|
275
|
+
persist (bool): Set it to True to save the result to the API.
|
|
244
276
|
|
|
245
277
|
Returns:
|
|
246
278
|
dict: Updated playlist.
|
|
@@ -256,12 +288,14 @@ def update_entity_preview(
|
|
|
256
288
|
|
|
257
289
|
|
|
258
290
|
@cache
|
|
259
|
-
def delete_playlist(
|
|
291
|
+
def delete_playlist(
|
|
292
|
+
playlist: str | dict, client: KitsuClient = default
|
|
293
|
+
) -> str:
|
|
260
294
|
"""
|
|
261
295
|
Delete a playlist.
|
|
262
296
|
|
|
263
297
|
Args:
|
|
264
|
-
playlist (
|
|
298
|
+
playlist (str / dict): The playlist dict or id.
|
|
265
299
|
|
|
266
300
|
Returns:
|
|
267
301
|
Response: Request response object.
|
|
@@ -271,12 +305,14 @@ def delete_playlist(playlist, client=default):
|
|
|
271
305
|
|
|
272
306
|
|
|
273
307
|
@cache
|
|
274
|
-
def get_entity_previews(
|
|
308
|
+
def get_entity_previews(
|
|
309
|
+
playlist: str | dict, client: KitsuClient = default
|
|
310
|
+
) -> list[dict]:
|
|
275
311
|
"""
|
|
276
312
|
Get entity previews for a playlist.
|
|
277
313
|
|
|
278
314
|
Args:
|
|
279
|
-
playlist (
|
|
315
|
+
playlist (str / dict): The playlist dict or id.
|
|
280
316
|
|
|
281
317
|
Returns:
|
|
282
318
|
list: Entity previews for the playlist.
|
|
@@ -288,29 +324,32 @@ def get_entity_previews(playlist, client=default):
|
|
|
288
324
|
|
|
289
325
|
|
|
290
326
|
@cache
|
|
291
|
-
def get_build_job(
|
|
327
|
+
def get_build_job(
|
|
328
|
+
build_job: str | dict, client: KitsuClient = default
|
|
329
|
+
) -> dict:
|
|
292
330
|
"""
|
|
293
331
|
Get a build job.
|
|
294
332
|
|
|
295
333
|
Args:
|
|
296
|
-
build_job (
|
|
334
|
+
build_job (str / dict): The build job dict or id.
|
|
297
335
|
|
|
298
336
|
Returns:
|
|
299
337
|
dict: Build job information.
|
|
300
338
|
"""
|
|
301
339
|
build_job = normalize_model_parameter(build_job)
|
|
302
|
-
return raw.fetch_one(
|
|
340
|
+
return raw.fetch_one(
|
|
341
|
+
"playlists/build-jobs", build_job["id"], client=client
|
|
342
|
+
)
|
|
303
343
|
|
|
304
344
|
|
|
305
|
-
def remove_build_job(
|
|
345
|
+
def remove_build_job(
|
|
346
|
+
build_job: str | dict, client: KitsuClient = default
|
|
347
|
+
) -> str:
|
|
306
348
|
"""
|
|
307
349
|
Delete a build job.
|
|
308
350
|
|
|
309
351
|
Args:
|
|
310
|
-
build_job (
|
|
311
|
-
|
|
312
|
-
Returns:
|
|
313
|
-
Response: Request response object.
|
|
352
|
+
build_job (str / dict): The build job dict or id.
|
|
314
353
|
"""
|
|
315
354
|
build_job = normalize_model_parameter(build_job)
|
|
316
355
|
return raw.delete(
|
|
@@ -319,12 +358,14 @@ def remove_build_job(build_job, client=default):
|
|
|
319
358
|
|
|
320
359
|
|
|
321
360
|
@cache
|
|
322
|
-
def all_build_jobs_for_project(
|
|
361
|
+
def all_build_jobs_for_project(
|
|
362
|
+
project: str | dict, client: KitsuClient = default
|
|
363
|
+
) -> list[dict]:
|
|
323
364
|
"""
|
|
324
365
|
Get all build jobs for a project.
|
|
325
366
|
|
|
326
367
|
Args:
|
|
327
|
-
project (
|
|
368
|
+
project (str / dict): The project dict or id.
|
|
328
369
|
|
|
329
370
|
Returns:
|
|
330
371
|
list: All build jobs for the project.
|
|
@@ -335,12 +376,14 @@ def all_build_jobs_for_project(project, client=default):
|
|
|
335
376
|
)
|
|
336
377
|
|
|
337
378
|
|
|
338
|
-
def build_playlist_movie(
|
|
379
|
+
def build_playlist_movie(
|
|
380
|
+
playlist: str | dict, client: KitsuClient = default
|
|
381
|
+
) -> dict:
|
|
339
382
|
"""
|
|
340
383
|
Build a movie for a playlist.
|
|
341
384
|
|
|
342
385
|
Args:
|
|
343
|
-
playlist (
|
|
386
|
+
playlist (str / dict): The playlist dict or id.
|
|
344
387
|
|
|
345
388
|
Returns:
|
|
346
389
|
dict: Build job information.
|
|
@@ -351,13 +394,18 @@ def build_playlist_movie(playlist, client=default):
|
|
|
351
394
|
)
|
|
352
395
|
|
|
353
396
|
|
|
354
|
-
def download_playlist_build(
|
|
397
|
+
def download_playlist_build(
|
|
398
|
+
playlist: str | dict,
|
|
399
|
+
build_job: str | dict,
|
|
400
|
+
file_path: str,
|
|
401
|
+
client: KitsuClient = default,
|
|
402
|
+
) -> requests.Response:
|
|
355
403
|
"""
|
|
356
404
|
Download a playlist build.
|
|
357
405
|
|
|
358
406
|
Args:
|
|
359
|
-
playlist (
|
|
360
|
-
build_job (
|
|
407
|
+
playlist (str / dict): The playlist dict or id.
|
|
408
|
+
build_job (str / dict): The build job dict or id.
|
|
361
409
|
file_path (str): The location to store the file on the hard drive.
|
|
362
410
|
|
|
363
411
|
Returns:
|
|
@@ -372,12 +420,14 @@ def download_playlist_build(playlist, build_job, file_path, client=default):
|
|
|
372
420
|
return raw.download(path, file_path, client=client)
|
|
373
421
|
|
|
374
422
|
|
|
375
|
-
def download_playlist_zip(
|
|
423
|
+
def download_playlist_zip(
|
|
424
|
+
playlist: str | dict, file_path: str, client: KitsuClient = default
|
|
425
|
+
) -> requests.Response:
|
|
376
426
|
"""
|
|
377
427
|
Download a playlist as a zip file.
|
|
378
428
|
|
|
379
429
|
Args:
|
|
380
|
-
playlist (
|
|
430
|
+
playlist (str / dict): The playlist dict or id.
|
|
381
431
|
file_path (str): The location to store the file on the hard drive.
|
|
382
432
|
|
|
383
433
|
Returns:
|
|
@@ -388,12 +438,14 @@ def download_playlist_zip(playlist, file_path, client=default):
|
|
|
388
438
|
return raw.download(path, file_path, client=client)
|
|
389
439
|
|
|
390
440
|
|
|
391
|
-
def generate_temp_playlist(
|
|
441
|
+
def generate_temp_playlist(
|
|
442
|
+
project: str | dict, data: dict, client: KitsuClient = default
|
|
443
|
+
) -> dict:
|
|
392
444
|
"""
|
|
393
445
|
Generate a temporary playlist.
|
|
394
446
|
|
|
395
447
|
Args:
|
|
396
|
-
project (
|
|
448
|
+
project (str / dict): The project dict or id.
|
|
397
449
|
data (dict): Playlist generation data.
|
|
398
450
|
|
|
399
451
|
Returns:
|
|
@@ -405,17 +457,19 @@ def generate_temp_playlist(project, data, client=default):
|
|
|
405
457
|
)
|
|
406
458
|
|
|
407
459
|
|
|
408
|
-
def notify_clients_playlist_ready(
|
|
460
|
+
def notify_clients_playlist_ready(
|
|
461
|
+
playlist: str | dict, client: KitsuClient = default
|
|
462
|
+
) -> dict:
|
|
409
463
|
"""
|
|
410
464
|
Notify clients that a playlist is ready.
|
|
411
465
|
|
|
412
466
|
Args:
|
|
413
|
-
playlist (
|
|
467
|
+
playlist (str / dict): The playlist dict or id.
|
|
414
468
|
|
|
415
469
|
Returns:
|
|
416
470
|
dict: Notification response.
|
|
417
471
|
"""
|
|
418
472
|
playlist = normalize_model_parameter(playlist)
|
|
419
473
|
return raw.post(
|
|
420
|
-
"data/playlists/%s/notify" % playlist["id"], {}, client=client
|
|
474
|
+
"data/playlists/%s/notify-clients" % playlist["id"], {}, client=client
|
|
421
475
|
)
|