Our FCSVRClient object, it is our interface for reading and manipulating data from Final Cut Server via the fcsvr_client executable installed at /Library/Application Support/Final Cut Server/Final Cut Server.bundle/Contents/MacOS/fcsvr_client
Parameters: |
|
---|
Note
If an entityPath value is provided, it will override values for entityType and id
If upon creation the object is provided enough information to uniquely resolve the FCS object (either via specifying entityType,id, or entityPath), the object will init via FCSVRClient.initWithAssetID().
Thus, this:
>>> myFCSObj = fcsxml.FCSVRClient()
>>> myFCSObj.initWithProductionID(10)
True
Is equivalent to:
>>> myFCSObj = fcsxml.FCSVRClient(entityPath='/project/10')
Other notable ways to init an FCSVRClientObject:
>>> myFCSObj = fcsxml.FCSVRClient().initWithAssetTitle(title='my great file')
>>> myFCSObj = fcsxml.FCSVRClient().initWithProductionTitle(title='My Production')
>>> myFCSObj = fcsxml.FCSVRClient().initWithAssetFromFSPath(FSPath='/FinalCutServer/Library/my great file.mov')
>>> myFCSObj = fcsxml.FCSVRClient().initWithAssetFromFSPath(FSPath='/FinalCutServer/Library/my great file.mov')
Adds an asset to production.
Warning
This function is depricated as of 07/22/10, use the fcsxml.FCSVRClient.addMemberToProduction() class!
Adds entity to the specified production. Accepts either a FCSVRClient object (member) or a FCS entity path ‘/asset/10’ (memberPath) in addition to a FCSVRClient object with entityType ‘production’, or a production path ‘/project/10’. If the local entity is either the member to be added, or is a production, then you can omit that information.
Parameters: |
|
---|---|
Raises : | FCSError |
For instance, if we are a loaded production I can call:
>>> myObj = fcsxml.FCSVRClient(entityType='project',entityID=10)
>>> myObj.addMemberToProduction(memberPath='/asset/20')
Which will add asset with ID 20 to our own membership. Likewise, we will accomplish the exact same thing if we call:
>>> myObj = fcsxml.FCSVRClient(entityType='asset',entityID=20)
>>> myObj.addMemberToProduction(productionPath='/project/10')
Lastly, if we call:
>>> myObj = fcsxml.FCSVRClient(entityType='project',entityID=10)
>>> myObj.addMemberToProduction(productionPath='/project/12')
We will add ourself (a production) as a child production to /project/12.
New in version .96b.
This method will force FCS to analyze the loaded entity.
Parameters: |
|
---|
This method will add a new FCSXMLField to the objects field definition list. This function will raise an FCSDuplicate exception if a field object with same name already exists.
Parameters: | field (fcsxml.FCSXMLField) – Provide an FCSXMLField object loaded with field name and value |
---|---|
Returns: | (bool) True or False |
Raises : | fcsxml.FCSDuplicateError, RuntimeError |
Appends a value to field, concatenating with the current field value.
Parameters: |
|
---|---|
Raises : | fcsxml.FCSFieldNotFoundError |
This method archives the loaded entity. If this is a production, then we will archive all assets which are members of the production. If recurseProductions is true, then we will archive it’s members as well. Either deviceID or a deviceDict must be provided to specify the destination archive device.
Parameters: |
|
---|---|
Raises : | FCSAssetOfflineError, FCSError, |
Returns a new FCSVRClient object matching the provided title.
Parameters: |
|
---|---|
Returns: | (fcsxml.FCSVRClient) – Asset entity matching provided parameters. |
Raises : | FCSEntityNotFoundError |
Function which returns a list of associated FCSVRClient asset objects. If recurse is set to true, we will return assets for subproductions as well. If mdSet is provided, we will return only assets which have the provided metadataset. This function utilizes fcsxml.FCSVRClient.productionMemberAddresses()
Parameters: |
|
---|---|
Raises : | FCSValidationError, FCSProductionLoadError |
Returns: | (list) – A list of FCSVRClient entries. |
Function which returns a list of associated FCSVRClient asset objects for the provided Final Cut Pro project file. This project file is referenced via the file’s Final Cut Server asset id. If mdSet is provided, we will return only assets which match the provided metadata set. This function utilizes fcsxml.FCSVRClient.projectElementAddresses()
Parameters: |
|
---|---|
Returns: | (list) – A list of qualifying FCSVRClient asset objects. |
This function takes a filesystem path and will create an asset from the file. Can be passed a deviceName or deviceID, metadata set, and an optional relative path to be uploaded. An option overwriteExistingFiles determines behavior if a file already exists, options are ‘ignore’,’iterate’, and ‘overwrite’.
Parameters: |
|
---|---|
Raises : | FCSVRClientFileError,FCSEntityNotFoundError,FCSEntityNotFoundError, FCSValidationError, IOError |
This function will generate a new poster frame for the provided asset based upon the provided path to the new file. This posterframe file is not directly used as the poster frame, rather FCS will generate a new posterframe using it’s standard defined parameters, and will then use this generated file as the asset’s new poster frame. This is accomplished by creating a new FCS asset for the poster frame file, allowing FCS to create the posterframe link to the asset, getting the new asset’s posterframe path, linking it to our asset, and then deleting the new poster frame asset. If you wish to use a file for a posterframe as-is, use fcsxml.FCSVRClient.replacePosterFrame()
Parameters: |
|
---|
This method will create a new production based upon loaded and provided values.
Parameters: |
|
---|---|
Returns: | (fcsxml.FCSVRClient) – The new FCSVRClient object loaded with the provided information; if our current object was a ‘project’ type entity, values will be loaded locally as well. |
Raises : | FCSProductionLoadError |
This function will generate a new thumbnail for the provided asset based upon the provided path to the new thumbnail file. This thumbnail file is not directly used as the thumbnail, rather FCS will generate a new thumbnail using it’s standard defined parameters, and will then use this generated file as the asset’s new thumbnail. This is accomplished by creating a new FCS asset for the thumbnail file, allowing FCS to create the thumbnail link to the asset, getting the new asset’s thumbnail path, linking it to our asset, and then deleting the new thumbnail asset. If you wish to use a file for a thumbnail as-is, use fcsxml.FCSVRClient.replaceThumbnail()
Parameters: |
|
---|
Returns a dataType value for field with dbname (we use FCSXMLField Object and self.dbDataTypeForDBFieldName for this).
Parameters: | dbname (str) – The FCS DB Field name |
---|---|
Returns: | (str) – The data type for the requested db field name. |
This method returns the datatype for the passed field name.
Parameters: | field (fcsxml.FCSXMLField, str) – Provide the FCSXMLField or field name of the field to query. |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError |
Returns: | (str) Datatype for the specified field |
Returns a FCS DB dataType value for field with dbname (we use FCSXMLField Object and self.dbDataTypeForDBFieldName for this).
Parameters: | dbname (str) – The FCS DB Field name |
---|---|
Returns: | (str) – The FCS DB data type for the requested db field name |
This function returns the FCS DB datatype for the requested field. Please see the table outlined in fcsxml.FCSVRClient.setDataType() for information about available FCS DB Data types
Parameters: | field (fcsxml.FCSXMLField, str) – Provide the FCSXMLField or field name of the field to query. |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError |
Returns: | (str) FCS DB Datatype for the specified field |
Returns a FCS DB field name for a standard field name (fcsvr_client field name from FCS Read XML field name.
Parameters: | fieldName (str) – The field name to be queried. |
---|---|
Returns: | (str) – The fcsvr_client compatable DB field name. |
Deletes the loaded entity.
Raises : | FCSValidationError, FCSVRClientPermissionDenied |
---|
This method will return a dict entry containing pertinent device information for the device matching the provided device id. See the table listed in fcsxml.FCSVRClient.getDevicesMap() for a list of values contained in this dict.
Parameters: | id (int) – Provide the device id |
---|---|
Returns: | (dict) – A dictionary populated with information detailing the requested device. |
Raises : | fcsxml.FCSEntityNotFoundError |
This method will return a dict entry containing pertinent device information for the device matching the provided device name. See the table listed in fcsxml.FCSVRClient.getDevicesMap() for a list of values contained in this dict.
Parameters: | id (str) – Provide the device name |
---|---|
Returns: | (dict) – A dictionary populated with information detailing the requested device. |
Raises : | fcsxml.FCSEntityNotFoundError, fcsxml.FCSError |
This method will return a dict entry containing pertinent device information for the device configured at the provided POSIX filesystem path. See the table listed in fcsxml.FCSVRClient.getDevicesMap() for a list of values contained in this dict.
Parameters: | path – Provide a full file system path |
---|---|
Returns: | (dict) – A dictionary populated with information detailing the requested device. |
Raises : | fcsxml.FCSEntityNotFoundError, fcsxml.FCSError |
This is a wrapper around fcsvr_client, if there are fields set in self.fields, it will import with generate XML to a temp file and pass it during creation
Warning
This is currently a placeholder function and is not implemented.
This is the createasset wrapper around fcsvr_client. If there are fields set in self.fields, It will output XML to a temp file and then call fcsvr_client to create the entity. If self.entityType is ‘asset’, then we load from fcsvr_client and return our self, if our entityType is not asset, we clone ourself and return a new FCSVRClient object with entityType ‘asset’
This method interprets an fcsvr_client error string and will throw the appropriate exception, it should be called if fcsvr_client returns a non-0 exit code.
Parameters: |
|
---|---|
Raises : | FCSVRClientError, FCSVRClientFileError, FCSVROfflineError, FCSDuplicateError |
Returns: | This function will always raise an exception from the above list |
This is a wrapper function around fcsvr_client make_link. See the table defined in fcsxml.FCSVRClient.getValueForLinkType() for more information about linkTypes.
Parameters: |
|
---|---|
Raises : | FCSValidationError, FCSError, FCSVRClientPermissionDenied |
Returns a field name for a dbname (FCS Read XML field name from FCSVR_CLIENT field name.
Parameters: | dbname (str) – The FCS DB name for the field to be queried. |
---|---|
Returns: | (str) – The field name. |
This method returns the fcsxml.FCSXMLField object for the passed field name.
Parameters: | fieldName (str) – Provide the name of the field to query. |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError |
Returns: | (fcsxml.FCSXMLField) – The stored field object for the specified field |
This function will flush any cached data: currently this is limited to any cached XML data returned from fcsvr_client.
Generates an XML file for use by fcsvr_client search –xmlcrit, should be past a list of FCSXMLFields (with their appropriate values set). Returns an absolute path to the XML file.
Parameters: |
|
---|---|
Returns: | (str) POSIX Filesystem Path to temporary XML file. |
This file generates a temporary XML file constructed based upon our stored fields, used by various metadata activities utilized by fcsvr_client.
Returns: | (str) – File path to the temporary file. |
---|---|
Raises : | FCSValidationError, IOError |
This method returns an xml.dom.minidom object of child links data utilizing fcsvr_client This is the sister object to fcsxml.FCSVRClient.getParentLinksXML()
Parameters: |
|
---|---|
Raises : | FCSError,FCSValidationError |
Returns: | (xml.dom.minidom) – An XML DOM object base upon fcsvr_client XML output |
This method will load device information from FCS, returning a multi dimensional dictionary containing information about all configured FCS devices. The top level of the dictionary is keyed by device id. Each device entry in this dictionary will be populated with the following key+value entries:
Key | Description |
---|---|
DEVICE_NAME | (str) The name of the device |
DEV_ROOT_PATH | (str) The path to the device on the file system. |
FSPATH | (str) An alias for DEV_ROOT_PATH |
DEVICE_TYPE | (str) The type of device (filesystem vs contentbase) |
DEVICE_ID | (int) The device’s unique ID |
DESC_DEVICE_ADDRESS | (str) The device’s FCS entity path (i.e. /dev/2) |
DEV_ARCHIVE | (bool) True if the device is an archive device. |
Returns: | (dict) – A dict object populated with the above information for all devices configured in FCS. |
---|
Returns a Final Cut server relative path for linked assets
Parameters: | FSPath (str) – Specify the file system path to convert |
---|---|
Returns: | (str) – A Final Cut Server relative path |
Determine the UID of the running FCS User, this is stored in /Library/Preferences/com.apple.FinalCutServer.settings.plist
Returns: | (int) – The user ID of the Final Cut Server runtime user. |
---|
Returns a filesystem path from a linked asset
Resolves a POSIX ‘online’ Path from a POSIX archive PATH i.e.: /MyArchiveDevicePath/4/myfile.mov -> /LibraryDevicePath/myfile.mov
Parameters: | archiveFilePath (str) – Specify the assets file system path as it exists on the archive device. |
---|---|
Raises : | FCSObjectLoadError |
Returns: | (str) – The full path to the asset when it is in an online state |
Resolves a POSIX file system path (‘/Users/Shared/FCSStore/Library/myfile.mov’) from a FCS Relative device path (‘/dev/4/myfile.mov’)
Parameters: | fcsPath (str) – Specify the file system path to convert |
---|---|
Returns: | (str) – A POSIX file system path |
Returns the file path to the primary representation for the loaded asset or the provided asset id.
Parameters: | id (int) – Specify the asset ID to query |
---|---|
Returns: | (str) – The full POSIX path to the entity’s primary representation |
Returns filesystem path to the associated thumbnail.
Parameters: |
|
---|---|
Raises : | RuntimeError, fcsxml.FCSVRClient.FCSVRClientError |
Returns: | (str) – The absolute path to the file. |
Returns filesystem path to the associated poster frame
Parameters: |
|
---|---|
Raises : | RuntimeError, fcsxml.FCSVRClient.FCSVRClientError |
Returns: | (str) – The absolute path to the file. |
Returns filesystem path to the associated proxy file.
Parameters: |
|
---|---|
Raises : | RuntimeError, fcsxml.FCSVRClient.FCSVRClientError |
Returns: | (str) – The absolute path to the file. |
Returns the filesystem thumbnail path for asset given ID, loads from fcsvr_client.
Parameters: |
|
---|---|
Raises : | RuntimeError, fcsxml.FCSVRClient.FCSVRClientError |
Returns: | (str) – The absolute path to the file. |
‘Returns an xml.dom.minidom object of parent link data utilizing fcsvr_client. This is the sister object to fcsxml.FCSVRClient.getChildLinksXML()
Parameters: |
|
---|---|
Raises : | FCSError,FCSValidationError |
Returns: | (xml.dom.minidom) – An XML DOM object base upon fcsvr_client XML output |
This function will return a file system path for the given asset.
Warning
This method has been DEPRICATED: use fcsxml.FCSVRClient.getFilePathForThumbnail()
This method is used to interpret results from an fcsvr_client get_link operation. It will parse the provided information and returns the value of <value> node with id of value and LINK_TYPE of linkType. If xmlDOM is provided, we will search it, otherwise we will generate our own xmlDOM for the search using provided or stored values of entityID and entityType. Argument ‘origin’ can be provided to denote whether we are fetching parent (fcsxml.FCSVRClient.getParentLinksXML()) or child (fcsxml.FCSVRClient.getChildLinksXML()) links.
Parameters: |
|
---|---|
Returns: | (str) – The value of the provided nodename and linktype |
Appropriate asset link types:
linkType | Description | Origin |
---|---|---|
1 | Asset’s Parent Production | Child |
2 | Asset’s Primary Representation | Parent |
4 | Asset’s Proxy | Parent |
5 | Asset’s Thumbnail | Parent |
6 | Asset’s Poster frame | Parent |
16 | Production Nesting | Parent |
Returns a FCSXMLField object from a dbname. Uses fcsvr_client to retrieve all the necessary parameters for the field. This method differs from loadFieldWithDBName() in that this method will only init a generic FCSXMLField object, the resulting object will NOT be cached as a member of this object, and no value will be populated for the field (as it is not associated to any particular entity).
Parameters: | dbname (str) – The field name to be queried. |
---|---|
Returns: | (fcsxml.FCSXMLField) – The associated FCSXMLField object. |
Returns a FCSXMLField object from a provided fieldName. Uses fcsvr_client to retrieve all the necessary parameters for the field. This method differs from loadFieldWithName() in that this method will only init a generic FCSXMLField object, the resulting object will NOT be cached as a member of this object, and no value will be populated for the field (as it is not associated to any particular entity).
Parameters: | fieldName (str) – The field name to be queried. |
---|---|
Returns: | (fcsxml.FCSXMLField) – The associated FCSXMLField object |
Inits the local instance with an asset based on the provided FCS device relative path (i.e. ‘/dev/4/myfile.mov’) .
Parameters: | FCSPath (str) – Specify the Final Cut Server relative path to init with |
---|---|
Raises : | FCSEntityNotFoundError, FCSObjectLoadError, RuntimeError |
Inits the local instance with an asset based on the provided file system path.
Parameters: | FSPath (str) – Specify the file system path for the asset to init with |
---|---|
Raises : | FCSEntityNotFoundError, FCSObjectLoadError, RuntimeError |
Inits the local instance with an asset based on the provided asset id.
Parameters: | assetID (int) – Specify the production id to init with |
---|---|
Raises : | FCSEntityNotFoundError, FCSObjectLoadError, RuntimeError |
Inits the local instance with an asset which has the provided asset title. A second parameter, matchType, can be provided which will dictate the type of search that is used. Possible options are ‘exact’ and ‘substring’
Parameters: |
|
---|---|
Raises : | FCSEntityNotFoundError, FCSObjectLoadError, RuntimeError |
Inits the local instance with a production based on the provided production id.
Parameters: | productionID (int) – Specify the production id to init with |
---|
Inits the local instance with a production based on the provided title. A second parameter, matchType, can be provided which will dictate the type of search that is used. Possible options are ‘exact’ and ‘substring’
Parameters: |
|
---|
This method will load internal parameters as specified in the provided ConfigParser.SafeConfigParser object, or via the configuration file referenced via the filePath parameter.
Parameters: |
|
---|
Note
If you subclass, you should call this parent function. If we raise a RuntimeError Exception, you should abort or perform your own exhaustive sanity checks
Function which loads the specified field. If the field is not defined for our entity in Final Cut Server, we will still return a FCSXMLField object with all members populated, short of the value field.
Parameters: | field (fcsxml.FCSXMLField) – Provide the field object to load |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError, fcsxml.FCSVRClientError, fcsxml.FCSError,fcsxml.FCSVRClientError |
Returns: | (fcsxml.FCSXMLField) – The loaded field object |
Function which loads the specified field. If the field is not defined for our entity in Final Cut Server, we will still return a FCSXMLField object with all members populated, short of the value field.
Parameters: |
|
---|---|
Raises : | fcsxml.FCSFieldNotFoundError,fcsxml.FCSVRClientError,RuntimeError, fcsxml.FCSError |
Returns: | (fcsxml.FCSXMLField) – The loaded field object |
This method will load our object based upon values stored in the provided fcsxml.FCSXMLObject
Parameters: | fcsXMLObject (fcsxml.FCSXMLObject) – Provide the FCSXMLObject to load from |
---|
Function which returns a list of associated project addresses: [“/project/11”] representative of all productions that an entity is a member of, based on passed integer value entity. The ID can be omitted if we are a loaded asset or project.
Parameters: |
|
---|---|
Raises : | fcsxml.FCSValidationError |
Returns: | (list) – A list containing all parent entity addresses |
Function which returns asset addresses ‘/asset/12’ from a production. If recurse is set to true, we will recurse through any nested productions and collate their addresses.
Parameters: |
|
---|---|
Raises : | FCSValidationError, FCSProductionLoadError |
Function which returns all entity addresses [‘/asset/12’,’/project/10’] from a production. If recurse is set to true, we will recurse through any nested productions and collate their memberships. The _processedMemberAddresses parameter is a list of previously processed production addresses to prevent infinite recursion scenarios
Parameters: |
|
---|---|
Raises : | FCSValidationError, FCSProductionLoadError, FCSEntityNotFoundError |
Returns a new FCSVRClient production/project object matching the provided production title.
Parameters: |
|
---|---|
Returns: | (fcsxml.FCSVRClient) – Asset entity matching provided parameters. |
Raises : | FCSEntityNotFoundError |
Function which returns a list of element addresses associated to an FCP project file. An optional argument, addressType, can be provided. When set to ‘asset’, we return /asset/ addresses for any linked elements. if set to ‘element’, we return /element/ addresses for all linked alements.
Parameters: |
|
---|---|
Returns: | (list) – A list of qualifying entity addresses. |
This method returns a quoted string acceptable for use by fcsvr_client. This is similar to a URL encode, but FCS has some special needs outside of this as well.
Parameters: | path (str) – Specify the path to quote. |
---|---|
Returns: | (str) – The encoded string. |
Remove FCSXMLField object registered with passed field name.
Parameters: | fieldName (str or fcsxml.FCSXMLField) – Provide the field name (or an FCSXMLField object) to be removed from the current object’s field list. |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError, RuntimeError |
Removes a member from a production. Accepts either an FCSVRClient object (member) or a FCS entity path ‘/asset/10’ (memberPath) in a addition to a FCSVRClient object with project entityType (production) or a production path ‘/project/10’ (productionPath). If calling instance is either a production or an asset, you can omit the appropriate arguments. We also accept tempProductionMDSet: which is the md set used to create a temporary production. (We do this because FCS can’t explicitely delete an existing link, but it CAN relocate links).
Parameters: |
|
---|---|
Raises : | FCSError, FCSValidationError |
For instance, if we have a loaded asset, we can remove it from our production as follows:
>>> myObj = fcsxml.FCSVRClient(entityType='asset',entityID=20)
>>> myObj.removeMemberFromProduction(productionPath='/project/10')
Or, alternatively, if we are a loaded production, we can remove an asset as follows (accomplishing the exact same thing as above):
>>> myObj = fcsxml.FCSVRClient(entityType='project',entityID=10)
>>> myObj.removeMemberFromProduction(memberPath='/asset/20')
Method which will replace the poster frame file for the specified/stored assetID with file provided at newPosterFramePath. Unlike fcsxml.FCSVRClient.createPosterFrame(), this function will use the provided file directly as the new posterFrame by simply replacing the existing posterframe file on disk.
Parameters: |
|
---|
Method which will replace the thumbnail file for the specified/stored assetID with file provided at newThumbnailPath. Unlike fcsxml.FCSVRClient.createThumbnail(), this function will use the provided file directly as the new thumbnail by simply replacing the existing thumbnail file on disk.
Parameters: |
|
---|
Restores the loaded entity. If this is a production, then we will restore all assets which are members of the production. If recurseProductions is true, then we will restore it’s members as well.
Parameters: | recurseProductions (bool) – Specify whether we recursively restore assets for the provided production. |
---|---|
Raises : | FCSError, FCSVRClientPermissionDenied, FCSVRClientFileError |
This method register’s the provided FCSXMLField object, replacing existing field object with same name if it should exist.
Parameters: | field (fcsxml.FCSXMLField) – Provide an FCSXMLField object loaded with field name and value |
---|---|
Returns: | (bool) True or False |
If we have a valid entityType and ID, we will attempt to run an fcsvr_client –setmd operation. This is performed by writing a temporary XML file (utilizing fcsxml.FCSVRClient.generateTempXMLFile() and reading it in with fcsvr_client –xml setmd
Raises : | FCSVRClientPermissionDenied,FCSValidationError,IOError |
---|
This method will reverse any string encoding performed by it’s sister method fcsxml.FCSVRClient.quoteString()
Parameters: | path (str) – Specify the path to quote. |
---|---|
Returns: | (str) – The unencoded string. |
This method returns the value for the passed FCS database field. (i.e. “pa_cust_md_my_field”)
Parameters: | dbFieldName (str) – Provide the FCS database name of the field to query. |
---|---|
Raises : | fcsxml.FCSFieldNotFoundError |
Returns: | (str) Value for the specified field |