Name
ZoomServer – Construct common Zoom operations without the low-level REST/Java/CLI syntax
Dependencies
Ensure the Perl SDK is setup.
Synopsis
use ZoomServer; my $cfg = $ZoomServer::cfg ; my $logger = $ZoomServer::logger; my ($files_aref, $authors_aref, $lastMod_aref) = ZoomServer::listPath(1,$d);
Methods
zoomImport
Usage: zoomImport($srcDir, $bulkMetaFile)
Will import everything under the srcDir including subdirs while applying bulk metadata CSV file if supplied.
Will skip files already imported.
zoomImport("c:/Videos/To Import/", "m:/Docs/meta.properties"); zoomImport("c:/Videos/To Import/");
SendEmail
Usage: SendEmail($to, $cc, $subject, $body)
Utlity function that sends HTML email supports SSL/SMTP Authentication. The configuration is specified in the config.ini/[SMTP] section.
cc: CSV list of emails
ZoomServer::SendEmail($email, $cc, $subject, $report);
uploadToFTP
uploadToFTP($ftpServer,$ftpUsername,$ftpPassword,$inFile,$ftpServerPath)
Will upload the specified file to the specified FTP server in the specified path, authenticating with the specified username and password credentials.
getWorkflowDetails
Usage: getWorkflowDetails($wfid)
Get Workflow task details along with their task id, task name, status, owners
Input argument: workflow id
Output: taskId2Details hashmap
For instance the following output hashmap shows the workflow task details:
2 => { 'name' => 'Review Retouched Files'; 'type' => 'Approval Work'; 'status' => 'Not Started'; 'owners' = ('joe', 'mike'..) } 1 => { 'name' => 'Retouch'; 'type' => 'Assigned Work'; 'status' => 'Review Pending'; 'owners' = ('kate') }
Wrapper around the zm mytasks command:
getTaskFiles
Usage: getTaskFiles($wfid, $taskid)
Get a workflow job’s associated task file paths.
Input: workflow id, task id
Output: Returns an Array reference to a list of Zoom Paths
Wrapper around the zm taskfiles command:
getPathAndRRN
Usage: my($path,$rrn) = getPathAndRRN($assetId);
Get the fully qualified Zoom File Path and repository revision number of an asset specified by a file asset id.
getPaths
Usage: $paths_aref = getPaths(@assetIds);
Ger File Paths given an array of Asset IDs
Input: array of asset ids
Output: Array ref to a list of paths that map 1:1 to the asset id array (in the same order as the asset id)
getFuids
Usage $fuids_aref = getFuids((“/path1”, “path2”,..));
Get Fuids/Asset IDs given an array of Zoom Paths
getUserInfo
Usage: $user2info_href = getUserInfo(@users)
Input: A list of Zoom users
Output: Reference to a hashmap with the user property name, value pairs.
Get user profile for an array of Zoom users. The User profile is a hashmap with user attributes such as email address specified with as key,value pair.
zoomVersion
Usage: $ver = ZoomServer::zoomVersion()
Get Zoom Distribution’s client version string. String can be passed to commands like JSON calls that need Zoom client version.
find
Usage: find($findByFields_href, $searchPaths_href, $fileNamePattern)
Find Assets in Zoom based on a search criteria specified.
Input:
Find by Metadata: $findByFields_href -> { “IPTC_Title” => “Title X..”, “FIPR_Size” : “..”}
Find within folder or projects: $searchPaths_href -> { ” ” => [“/repo/path1”, “/repo/path2″,..], ” ” => [“/repoB/path1”, “/repoB/path2”,..]..
Find by file name/type: $fileNamePattern -> “*mov”
Output
find JSON response string as documented on https://evolphin.com/help/docs/zoom-find-web-api/
The string can be passed to helper methods in this module to further extract the metadata.
Maximum matched records returned is determined by the server settings.
findWithLimit
Usage: find($findByFields_href, $searchPaths_href, $fileNamePattern, $limit)
Same usage as find() except $limit parameter can be used to constrain the maximum number of matched results
parseFindResponse
Usage: parseFindResponse($findjson_href,$skipDeleted)
Parse the JSON response returned by Find command.
Input: Json string returned by find command. For instance:
Output: A reference to a hashmap with asset id as key and value a nested hashmap reference with the metadata name/value pair. For example:
matchedAssetIDs
Usage: matchedAssetIDs($findjson_href)
Return an array of reference to a list of Asset IDs & file names from the find response JSON map
setMetadata
Usage: setMetadata($aid2zoom2val_href)
Set Metadata for a set of Zoom Asset IDs.
Inputs
Hashmap reference %aid2zoom2val = Map of Asset ID -> ( Map of Metadata Key -> Value pair)
For e.g.
‘CSRP_Price’ => ‘7.65’
‘191’ is the asset id, ”CCSP_FPS’ is the property name in the above example.
getJobMetadata
Usage: getJobMetadata($jobid)
returns job metadata using the Config:IniFiles section format.
$jobCfg = getJobMetadata(12);
$jobCfg->val(“FTP Form”,’ftpServer’) # ‘ftp.evolphin.com’
The method is used in conjunction with the job metadata form to capture custom job metadata from the create Job UI and pass it to an auto-task.
getZmMetaXmp
Usage: $xmpMetaData = getZmMetaXmp($AssetId, $ZoomRepoID)
Get Zoom Metadata in XMP format.
Input: AssetID, ZoomRepoId
Output: Zoom meta data in XMP format
move
Usage: $rv = move($src,$dest)
Move a Zoom Path to new Path.
Inputs
$srcPath in Zoom
$dest Path in Zoom
Output
1: success, 0: failed
newFolder
Usage: newFolder($parent,@dirs)
Add a list of paths as new folders in Zoom under a $parent folder
Inputs
$parent – Under which parent folder to add
@newFolders – list of new folders to add
Output
1: success, 0: failed
listPath
Usage: listPath($doLongList,$inDir)
$outAssets_aref = @{listPath(0, "/Project/Dir"); ($outAssets_aref, @outAuthors_aref, @outLastMod_aref) = listPath(1, "/Project/Dir"); # Get file, Author attribute per file, last Modified time per file
This method is non-recursive.
Inputs
$inDir: Path on Zoom server to list files from
#doLongList: If flag is set to 1 perform a long listing with more file attribute,
Output
$outAssets_aref : Reference to a List of files or folders in the $inDir on Zoom (non-recursive)
$outAuthors_aref : Reference to a List of author corresponding to the file list above
$outLastMod_aref : Reference to a List of last modification time in milliseconds corresponding to the file list above
getRepoId
Usage: $repoId = getRepoId()
Uses the zm getcredentails commands to return the repository id to which the command is connecting.
generatePreview
Usage: generatePreview($fuid,$bid);
Trigger a fresh preview for a given asset id and delete the original copy from cache.
Input
$fuid – Asset Id
$bid – Branch Id. Please set to 1.
Resolution is set to default resolution configured in settings specified in server XML.
For assets with multiple pages, pageNumber is set to -1 to generate preview for all pages.
Output:
0: Preview failed
1: Success
exportAsset
Usage: exportAsset($outDir, $file)
Exports asset from server to specified directory such as a NAS folder.
Input:
$outDir = Path asset will be exported to
$file = Fully qualified path on Zoom Server
Output:
0: If success
Non-zero: failure
mergeMetadataValues
Usage: mergeMetadataValues($oldValues, $newVal)
Utility method to merge metadata value for multi-valued fields.
For example:
oldValues = (shoe1;chair2) & newVal = shoe1 => mergedVal = (shoe1;chair2) oldValues = (shoe1;chair2) & newVal = shoe2 => mergedVal = (shoe1;chair2;shoe2)
getCookie
Usage: getCookie()
Utility method to fetch zoom cookie.
getFuidAndRrn
Usage: getFuidAndRrn($zoomPath)
Given a zoom path, returns the respective asset id and repository revision number
my($assetId,$rrn) = getFuidAndRrn($zoomPath);
setSingleAssetMetadata
Usage: setSingleAssetMetadata($fuid, $bid, $rrn, $metaMap_href, $timeCodeMap_href, $zmCookie)
Given an asset id, applies the supplied metadata along with timecode metadata for the asset
%$timeCodeMap_href = Map of TimeCode ID -> TimeCode
i.e { start => , end => }
For e.g,
appendMapInJson
Usage:appendMapInJson($meta_href)
Given a map of key,value pairs returns the data in json format
runHttpRequest
Usage:runHttpRequest($commandName, $queryData, $url, $zmCookie)
Given a command, url and data to be queried, returns a http response
my ($rv, $decodedResponse) = runHttpRequest ("SetMetadata", $data, "/internal", $zmCookie);