In the Creating a Cue Sheet using CSV tutorial, we introduced how to register waveform file from the CSV information, and how to create a Cue Sheet and Cue.
In this tutorial, we will write a Script by using the same CSV file we used in the Creating a Cue Sheet using CSV tutorial, to check whether the Cue Sheet contents are correct.
This tutorial uses the project executed by Creating a Cue Sheet using CSV tutorial.
Before starting this tutorial, if this project is not open, please open the project or execute the Script created in the Creating a Cue Sheet using CSV tutorial.
Select "Script list..." in the Script menu to display the Script list window.
Click the New button in the Script list window to create a Script file with the name below:
Save location of Script | Script file name |
---|---|
tutorials [CRI] | tutorial07-2_check_cuesheet_from_csv.py |
Double-click the created Script to open by Run the Script from the Script Editor .
In order to get an overview of the Script in the Script list window, write the Script description as follows:
After writing the Script description, import the following module to work with CRI Atom Craft in the Script:
Import "csv" module of the Python standard library for using the CSV file that is the same as Creating a Cue Sheet using CSV tutorial.
Import the Project Module to work with the project and import the Debug Module for log output.
Set the path variable of the CSV file to use for checking.
Write a Script to set the path variable of the CSV file as follows:
If the file does not exist, the Script can be interrupted by the os.path.isfile function to check if the file exists.
Use the following function to read the CSV file and get the information for checking.
Function name | Description |
---|---|
get_workunit | Gets the Work Unit |
get_cuesheet_rootfolder | Gets the Cue Sheet root folder of Work Unit |
get_child_object | Gets the child object by specifying the parent object |
find_objects | Performs recursive search to get the matched object in list format |
get_value | Gets the parameter of the specified object |
In order to check if there is a matching Cue name, get the Cue list registered in the Cue Sheet to get the Cue name information.
Write a Script for these processes as follows:
Retrieve the "Cue name" information for checking from the CSV.
Check if the Cue name list created in "<b> Cue list to check and enumeration of Cue names </b>" contains the Cue name information obtained from the CSV.
If there is a Cue that is not created in the Cue Sheet, the Cue name will be displayed in the Script log.
Write a Script for these processes as follows:
This concludes the scripting portion of this tutorial.
Save and run the Script.
If the Script runs successfully and finds a Cue name without the CSV information, a list of Cue names that do not exist will be output to the log.
By directly using CRI Atom Craft to add/remove the Cue and change the Cue name, the log contents of the mismatched Cues will be displayed.