def getProjectFolder(project): projFolder = project.get('root') if projFolder == '': disk = ftrack.Disk(project.get('diskid')) rootFolder = '' if sys.platform == 'win32': rootFolder = disk.get('windows') elif sys.platform == 'linux2': rootFolder = disk.get('unix') projFolder = os.path.join(rootFolder, project.getName()) return projFolder
def callback(event): """ This plugin creates a template folder structure on disk. """ for entity in event['data'].get('entities', []): if entity.get('entityType') == 'show' and entity['action'] == 'add': project = ftrack.Project(id=entity['entityId']) schemeId = project.get('projectschemeid') scheme = ftrack.ProjectScheme(schemeId) if scheme.get('name') == 'VFX Scheme': projFolder = project.get('root') if projFolder == '': disk = ftrack.Disk(project.get('diskid')) rootFolder = '' if sys.platform == 'win32': rootFolder = disk.get('windows') elif sys.platform == 'linux2': rootFolder = disk.get('unix') projFolder = os.path.join(rootFolder, project.getName()) makeDirs(projFolder) templateFolder = os.path.join(projFolder, 'template_files') copy_tree(TEMPLATE_FILES, templateFolder)