Heya!
So this was tested with both gazu 0.10.31 and 1.1.3 (not a regression)
The issue being that a created playlist, from either the API or the Web interface, is not in a state to work with the gazu.playlist.add_entity_to_playlist function.
This function expect the "shots" key to be a list as per
|
playlist["shots"].append( |
.
But a brand new playlist will have the "shots" key with a None value.
So the mentioned function will raise an uncaught AttributeError.
Forcing scripts and tools to have to update the playlist record first with an extra 2 lines workaround, before being able to add any preview to it.
Like in the following code:
>>> import gazu
# TODO: Set to host + login.
# TODO: Change for your IDs.
>>> project_id = "4e18db64-2703-4b18-9f87-62d114080df7"
>>> entity_id = "bf6ce28f-21da-42d0-a052-3615e0e42e8f"
>>> preview_id = "c1b9733b-1ab3-4255-9fe4-9ce6e90aa343"
>>> playlist = gazu.playlist.new_playlist(
... project=project_id,
... name="my_playlist_test",
... episode=None,
... for_entity="asset",
... for_client=False,
... )
>>> playlist = gazu.playlist.add_entity_to_playlist(
... playlist=playlist,
... entity=entity_id,
... preview_file=preview_id,
... persist=True,
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../gazu/playlist.py", line 219, in add_entity_to_playlist
playlist["shots"].append(
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'append'
# 2 lines workaround:
>>> playlist["shots"]= []
>>> playlist = gazu.playlist.update_playlist(playlist)
>>> playlist = gazu.playlist.add_entity_to_playlist(
... playlist=playlist,
... entity=entity_id,
... preview_file=preview_id,
... persist=True,
... )
Heya!
So this was tested with both gazu 0.10.31 and 1.1.3 (not a regression)
The issue being that a created playlist, from either the API or the Web interface, is not in a state to work with the gazu.playlist.add_entity_to_playlist function.
This function expect the "shots" key to be a list as per
gazu/gazu/playlist.py
Line 219 in c5b2282
But a brand new playlist will have the "shots" key with a None value.
So the mentioned function will raise an uncaught AttributeError.
Forcing scripts and tools to have to update the playlist record first with an extra 2 lines workaround, before being able to add any preview to it.
Like in the following code: