YouTube Module

Class Reference

class youtube.YouTubeObject(entityID=0)[source]

This provides an interface for uploading assets and XML to YouTube <http://www.youtube.com>. In addition to basic delivery this script also facilitates status checks on the encoding process once uploaded. When uploaded YouTube will processes the media and XML, and then generates an XML report as to the status of the import. In order to ensure a successful upload, we perform checks on this file to ensure that if it failed, we properly report the status. To do so, YouTubeObject provides two additional methods, YouTubeObject.batchStatusCheck() and YouTubeObject.checkYouTubeXMLStatusFile(). The former method actually utilizes the latter, so ‘checkYouTubeXMLStatusFile‘ will rarely be need to be called directly.

A batch status check can be performed by running the command:

>>> transmogrifier.py -m YouTube -a batchstatuscheck
batchStatusCheck()[source]

Checks on the status of any inprogress batches, as indicated by the presence of *.xml files in the inprogress folder residing in our YouTube support folder.

checkYouTubeXMLStatusFile(filePath)[source]

import YouTube XML status file, verify that our publishing worked

deleteSupportFiles()[source]

Delete Registered support files (media and xml)

loadConfiguration(parser)[source]

Load from configuration file, expects a ConfigParser type object. If you subclass, you should call this function. If we return false then you should abort. or do your own sanity checks

runFunction(function)[source]

Perform action based on passed function

setFCSXMLFile(filePath)[source]

import FCS XML file, and set applicable local values

upload(dirPath='')[source]

Uploads all relative assets to the configured SFTP host via the member variable ytSFTPServer. This is achived by creating an SFTP batch file and then passing to the sftp system binary. This method will also call youtube.YouTubeObject.xmlOut() and will upload the resulting XML file. We will attempt the SFTP transfer as defined by our retryCount configuration variable.

xmlOut(filePath='')[source]

Output our YouTube compliant XML. If passed a filepath for the second Parameter, we write to that file, otherwise we print to stdout

Configuration

The YouTube module has a number of configuration options that will define it’s behavior. The YouTube module will inherent the same configuration file that transmogrifier.py is provided at runtime; by default this file is located at /usr/local/etc/transmogrifier.conf. This file can be usurped with a separate configuration file by providing transmogrifier.py with the --configFile= parameter.

Options utilized by the YouTube module are designated under the [YouTube] config section, as seen in the transmogrifier.conf file shown below:

[YouTube]

host=sftp.myco.youtube.com
username=demo
ownername=AwesomeDemo
retryCount=5
publisherid=10001
host
Specify the server address for uploading your YouTube content.
username
Specify the username used for uploading YouTube content.
retryCount
Specify the number of times to attempt an SFTP transfer before giving up.
publisherid
Specify your YouTube publisher id.
ownername
Specify the Content owner.

For more information about working with Transmogrifier modules, click here

Table Of Contents

Previous topic

ThePlatform Module

Next topic

BrightCove Module

This Page