import shotgun_api3 as api from shotgun import Shotgun SERVER_PATH = 'https://babylondreams.shotgunstudio.com' # change this to https if your studio uses SSL SCRIPT_NAME = 'pythonapi' SCRIPT_KEY = '668ccbf1484e109b4ff5577d9dba5989d1e5fef4' sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY) sg.upload_thumbnail("Version", 52, "/Volumes/ProjectsRaid/WorkingProjects/spacedigital/space-2013_002-youngdracula_series5/img/comps/FD2-VFX-20/outsrc/FD2-VFX-20_outsrc_v01/FD2-VFX-20_outsrc_v01.0092.jpg")
import shotgun_api3 as api from shotgun import Shotgun SERVER_PATH = 'https://babylondreams.shotgunstudio.com' # change this to https if your studio uses SSL SCRIPT_NAME = 'pythonapi' SCRIPT_KEY = '668ccbf1484e109b4ff5577d9dba5989d1e5fef4' sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY) sg.upload_thumbnail( "Version", 52, "/Volumes/ProjectsRaid/WorkingProjects/spacedigital/space-2013_002-youngdracula_series5/img/comps/FD2-VFX-20/outsrc/FD2-VFX-20_outsrc_v01/FD2-VFX-20_outsrc_v01.0092.jpg" )
def makeTake(show, shot, **kwargs): """ Creates the Version/Dailies entity in Shotgun. :param show: Project short name (sg_short_name) :param shot: Shot code (code) :param kwargs: Valid kwargs are name: Name of the take, must be unique comment: Dailies comments version: Dailies take, pts or version number leftMoviePath: Left-eye (or mono) movie file path leftFramesPath: Left-eye (or mono) frames file path rightMoviePath: Right-eye movie file path rightFramesPath: Right-eye frames file path :return: Shotgun entity dict :raise: shotgun.Fault """ try: from shotgun import Shotgun sg = Shotgun(config.SG_SCRIPT_URL, config.SG_SCRIPT_NAME, config.SG_SCRIPT_KEY) except ImportError: raise Exception('error importing shotgun api') log.debug('makeTake: %s' % kwargs) # get show and shot from shotgun _show = getShows(show)[0] _shot = getShots(show, shot)[0] _task = None # look for task results = getTasks(_shot, kwargs.get('task')) if results: _task = results[0] # take version number version = kwargs.get('version') if not version: version = len(getVersions(_shot, _task)) + 1 kwargs.update(version=version) # take name _name = { 'show': show, 'shot': shot, 'sequence': shot.split('_')[0], 'task': kwargs.get('task', ''), 'version': version, 'eye': kwargs.get('eye', ''), } name = kwargs.get('name', config.DAILIES_TAKE_NAME % _name) # basic required fields params = { 'entity': _shot, 'project': _show, config.SG_FIELD_MAP.get('NAME'): name, config.SG_FIELD_MAP.get('COMMENT'): kwargs.get('comment', ''), config.SG_FIELD_MAP.get('TAKE_NUMBER'): str(version), } # shotgun task if _task: params.update(**{'sg_task': _task}) # file paths leftMoviePath = kwargs.get('leftMoviePath') leftFramesPath = kwargs.get('leftFramesPath') rightMoviePath = kwargs.get('rightMoviePath') rightFramesPath = kwargs.get('rightFramesPath') # link to left-eye movie/frames if leftMoviePath: params.update(**{config.SG_FIELD_MAP.get('MOVIE_LEFT'): leftMoviePath}) if leftFramesPath: params.update(**{config.SG_FIELD_MAP.get('FRAMES_LEFT'): leftFramesPath}) # link to right-eye movie/frames if rightMoviePath: params.update(**{config.SG_FIELD_MAP.get('MOVIE_RIGHT'): rightMoviePath}) if rightFramesPath: params.update(**{config.SG_FIELD_MAP.get('FRAMES_RIGHT'): rightFramesPath}) sg_take = sg.create('Version', params) return sg_take