Skip to main content

Tidbyt Status Monitor

ยท 3 min read
Cameron Target
Pipeline Manager

Git repo: https://github.com/BakedStudios/baked-tools/tree/main/tidbyt-sg-monitor

You need a Tidbyt for this to work! ๐Ÿค–

The Tidbyt SG Monitor is a custom application designed to display data from ShotGrid (SG), specifically focusing on the count of Versions with a status of "cnv" within active projects. This documentation outlines how to set up and run the Tidbyt SG Monitor, including the necessary scripts and LaunchAgent configuration.

Overviewโ€‹

This solution involves three main components:

  1. LaunchAgent Configuration: A plist file to schedule and manage the execution of the SG_Data script.
  2. SG_Data Script: A Python script that connects to ShotGrid, retrieves data, generates Starlark code for Tidbyt display, and commands to render and push the display content.
  3. Starlark Template: A template used to dynamically generate Starlark code that defines what is displayed on the Tidbyt device, including fetching an SG icon and displaying the count of "cnv" statuses.

Setup Instructionsโ€‹

1. LaunchAgent Configurationโ€‹

  • File Location: /Applications/tidbyt-sg-monitor/com.Tidbyt.SG_Data.plist
  • Purpose: Schedules the SG_Data script to run at a specified interval (every 30 seconds) and specifies output paths for standard output and errors.

To Start the Agent:โ€‹

sudo launchctl bootstrap gui/$(id -u) /Applications/tidbyt-sg-monitor/com.Tidbyt.SG_Data.plist

To Stop the Agent:โ€‹

launchctl bootout gui/$(id -u) /Applications/tidbyt-sg-monitor/com.Tidbyt.SG_Data.plist

2. SG_Data Scriptโ€‹

  • Location: /Applications/tidbyt-sg-monitor/SG_Data.py
  • Dependencies: Requires shotgun_api3 Python package.
  • Functionality:
    • Connects to ShotGrid using provided credentials.
    • Queries for Versions with "cnv" status in active projects.
    • Generates a Starlark script for the Tidbyt display, embedding the count of found records.
    • Executes commands to render and push the content to a Tidbyt device.

3. Starlark Templateโ€‹

The template dynamically generates a Starlark script, embedding the count of "cnv" statuses into a visual format suitable for Tidbyt devices. It fetches an SG icon and formats the display to show the data alongside the icon.

Execution Flowโ€‹

  1. Data Retrieval: The SG_Data script connects to ShotGrid, retrieves the relevant data, and calculates the count of Versions with "cnv" status.
  2. Starlark Code Generation: It then fills the Starlark template with this data, creating a script that defines the visual representation of the data on the Tidbyt device.
  3. Rendering and Display: Lastly, the script uses pixlet commands to render the Starlark script into a format compatible with Tidbyt devices and pushes the rendered content to the device.

Additional Notesโ€‹

  • Ensure that pixlet is installed and accessible from the command line.
  • Replace <YOUR TIDBYT TOKEN HERE> with your actual Tidbyt API token in the final command within the SG_Data script.
  • The paths and credentials used in the scripts should be adjusted according to your setup and security practices.
  • The provided SG icon URL and other hardcoded values can be customized as needed.

This documentation aims to provide a clear understanding of how to configure and use the Tidbyt SG Monitor. For further customization or troubleshooting, refer to the documentation of the individual technologies involved (ShotGrid API, Tidbyt API, and LaunchAgents).