Blender Kitsu: Set Custom Thumbnail during Playblast #77

Merged
Nick Alberelli merged 12 commits from feature/custom-playblast-thumbnails into main 2023-06-15 21:26:54 +02:00
Showing only changes of commit 8feb8e47cc - Show all commits

View File

@ -1,11 +1,6 @@
import string
import json
from blender_kitsu.gazu.exception import (
TaskStatusNotFoundException,
TaskMustBeADictException,
)
from . import client as raw
from .sorting import sort_by_name
from .helpers import (
@ -882,19 +877,21 @@ def add_preview(
)
def set_main_preview(preview_file, client=default):
def set_main_preview(preview_file, frame_number, client=default):
"""
Set given preview as thumbnail of given entity.
Args:
preview_file (str / dict): The preview file dict or ID.
frame_number (int): Frame of preview video to set as main preview
Returns:
dict: Created preview file model.
"""
data = {"frame_number": frame_number} if frame_number > 1 else {}
preview_file = normalize_model_parameter(preview_file)
path = "actions/preview-files/%s/set-main-preview" % preview_file["id"]
return raw.put(path, {}, client=client)
return raw.put(path, data, client=client)
@cache