Created
July 23, 2024 23:14
-
-
Save BigRoy/4792c0ebc311f5857841325c850293d8 to your computer and use it in GitHub Desktop.
AYON - Set status for versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""WARNING! Set random status for all your versions in the project.""" | |
import random | |
from ayon_core.pipeline import get_current_project_name | |
from ayon_api import get_project, get_versions | |
from ayon_api.operations import OperationsSession | |
project_name = get_current_project_name() | |
def get_project_status_names(project_entity): | |
statuses = project_entity["statuses"] | |
return [status["name"] for status in statuses] | |
project = get_project(project_name) | |
statuses = get_project_status_names(project) | |
session = OperationsSession() | |
for version in ayon_api.get_versions(project_name, fields={"id"}): | |
session.update_entity( | |
project_name, | |
"version", | |
version["id"], | |
{"status": random.choice(statuses)} | |
) | |
session.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment