def __init__(self): sgSite = 'https://chimneypot.shotgunstudio.com' scriptName = 'dBase' scriptKey = '729a76955455909c79f6d90262bb9fbe9186b92b' self.db = Shotgun(sgSite, scriptName, scriptKey)
def main(): parser = argparse.ArgumentParser(description=DESCRIPTION) parser.add_argument( "--path", help="Output directory path for schema files.", required=True, ) parser.add_argument( "--shotgun", help="A SG site url, a script name and its key", required=True, ) args = parser.parse_args() sg_url = args.shotgun sg = Shotgun(sg_url, login=raw_input("Login: "******"schema.pickle"), os.path.join(schema_dir, "schema_entity.pickle"), )
def addSrc(): repo = '/mnt/karramba' shotFoldList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'src', 'tmp'] seqFoldList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'shots'] dataFoldList = [ 'cache', 'geo', 'render', 'shadowmap', 'sim', 'track', 'photonmap' ] outFoldList = ['dailies', 'hires'] site = 'https://chimneypot.shotgunstudio.com' scriptName = 'addSrc' scriptKey = 'd7dac4e2c55faf486875dfb944ffc9d8e49a0c44' sg = Shotgun(site, scriptName, scriptKey) projList = sg.find('Project', [], ['name']) for i in projList: print 'id:' + str(i['id']) + ' ' + i['name'] prId = int(raw_input('Print project id:')) proj = sg.find_one('Project', [['id', 'is', prId]], ['name']) if not [x for x in os.listdir(repo) if x == proj['name']]: print "Project doesn't exist in repository" return s = os.sep prPath = repo + s + proj['name'] seqPath = prPath + s + 'film' + s + 'sequences' seqList = os.listdir(prPath + s + 'src') for i in seqList: sequenceFold = prPath + s + 'film' + s + 'sequences' os.makedirs(sequenceFold + s + i) for j in seqFoldList: os.makedirs(sequenceFold + s + i + s + j) for d in dataFoldList: os.makedirs(sequenceFold + s + i + s + 'data' + s + d) for o in outFoldList: os.makedirs(sequenceFold + s + i + s + 'out' + s + o) shList = os.listdir(prPath + s + 'src' + s + i) for sh in shList: shFold = sequenceFold + s + i + s + 'shots' os.makedirs(shFold + s + sh) for f in shotFoldList: os.makedirs(shFold + s + sh + s + f) for ds in dataFoldList: os.makedirs(shFold + s + sh + s + 'data' + s + ds) for ot in outFoldList: os.makedirs(shFold + s + sh + s + 'out' + s + ot) shutil.move(prPath + s + 'src' + s + i + s + sh, shFold + s + sh + s + 'src') os.system('ln -sf ' + shFold + s + sh + s + 'src ' + prPath + s + 'src' + s + i + s + sh)
def _create_instance(self): instance = Shotgun(self.base_url, 'dummy_script_name', 'dummy_api_key', connect=False) instance.config = self.config return instance
def createProject(): site = 'https://chimneypot.shotgunstudio.com' scriptName = 'createProject' scriptKey = '90699580e396b61d3acfb71e0595adde7458dfd4' repo = '/mnt/karramba/' rootList = ['film', 'out', 'ref', 'src', 'temp'] filmList = ['assets', 'sequences'] assetList = ['light', 'material', 'mattepaint', 'model', 'rig', 'shader', 'textures'] shotList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'src', 'tmp'] sqList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'shots'] dataList = ['cache', 'geo', 'render', 'shadowmap', 'sim', 'track', 'photonmap'] outList = ['dailies', 'hires'] prName = raw_input('Print project name:') prPath = repo + prName if not os.path.exists(prPath): os.mkdir(prPath) for i in rootList: os.makedirs(prPath + os.sep + i) for i in filmList: os.makedirs(prPath + os.sep + 'film' + os.sep + i) for i in assetList: os.makedirs(prPath + os.sep + 'film' + os.sep + 'assets' + os.sep + i) for i in outList: os.makedirs(prPath + os.sep + 'out' + os.sep + i) sg = Shotgun(site, scriptName, scriptKey) sg.create('Project', {'name':prName})
def main(): """ Map Shotgun users to JIRA users using their respective emails. """ logger_settings, shotgun_settings, jira_settings, project = _get_settings() # Apply settings if logger_settings: logging.config.dictConfig(logger_settings) # Set the logger settings first since JIRA session is chatty. jira = JiraSession( jira_settings["site"], basic_auth=(jira_settings["user"], jira_settings["secret"]), ) if not jira.is_jira_cloud: logger.error("This script can be run for JIRA Cloud only.") return 1 sg = Shotgun( shotgun_settings["site"], script_name=shotgun_settings["script_name"], api_key=shotgun_settings["script_key"], ) sync_jira_users_into_shotgun(sg, jira, project) return 0
def __init__(self): ''' creates the connection to the server and connects to database. creates list of Ids form the database collections that needs to convert to shotgun collections ''' SERVER_PATH = "https://hcpstudio.shotgunstudio.com" SCRIPT_NAME = 'sgApi' SCRIPT_KEY = '3899a8466f2cea694c2ba5341d871da845509d18d96a4feb7fb8d147de0fa819' self.sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY) self.dbObjectID = ObjectId() master = DaoMaster() session = DaoMaster.getSession() self.itemInstance = session.getItemsDao() self.ItemStatusList = ['rdy', 'ip', 'app', 'crnt', 'outd','dep', 'vari', 'rej'] self.ItemType = ['Source', 'Prop', 'Environment', 'Character', 'Rig', 'Fx', 'Template', 'Geometry', 'Art', 'Shader', 'Texture', 'Cache', 'ImageSequence', 'DCC', 'None'] self.ItemClass = ['Item', 'Asset', 'superAsset']
def SvcDoRun(self): servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) self.sg = Shotgun('https://xxxxxxxxxxxxxxxx.shotgunstudio.com', 'timelogservice', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') self.main()
def _connectToSG(self, kmode): SERVER_PATH = kmode[KparamSGserver] SCRIPT_USER = kmode[KparamSGscript] SCRIPT_KEY = kmode[KparamSGkey] try: SG = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY) return SG except lib.httplib2.ServerNotFoundError, err: raise ShotgunExceptions(msg=err.message, error=err)
def connect_to_shotgun(self): ''' URL - your studio Shotgun url USER can be a human login or a script name KEY - a password in a human case ''' from shotgun_api3 import Shotgun sg = Shotgun(URL, USER, KEY, ca_certs=CACERTS) return sg
def _pubBttn(self): base_url = "http://bubblebathbay.shotgunstudio.com" script_name = 'playBlastPublisher' api_key = '718daf67bfd2c7e974f24e7cbd55b86bb101c4e5618e6d5468bc4145840e4558' sgsrv = Shotgun(base_url = base_url , script_name = script_name, api_key = api_key, ensure_ascii=True, connect=True) selectedShots = sorted([item.text(0) for item in self.shotTreeWidgetItems if item.checkState(0)]) for shot in selectedShots: if shot in self.srcPath.keys(): destPath = self._getPublishPath(shot) srcPath = self.srcPath[str(shot)] ext = os.path.splitext(srcPath)[-1] # print os.path.basename(srcPath) # while os.path.exists(os.path.join(str(destPath), os.path.basename(srcPath))): # print "In Loop" # print os.path.basename(srcPath) # allFiles= os.listdir(destPath) # publishFiles = [] # if allFiles: # for allFile in allFiles: # if allFile.endswith(ext): # print allFile # publishFiles.append(allFile) # versionNumber = int(sorted(publishFiles)[-1].split('.v')[1].split(ext)[0]) # versionNumber += 1 # if versionNumber < 10: # publishFileName = '%sLayout.v%03d%s' % (shotName.replace('_', ''), versionNumber, ext) # self.publishPath = os.path.join(self.publishPath, publishFileName) # self.playblastName = os.path.basename(self.publishPath) # else: # publishFileName = '%sLayout.v%02d%s' % (shotName.replace('_', ''), versionNumber, ext) # self.publishPath = os.path.join(self.publishPath, publishFileName) # self.playblastName = os.path.basename(self.publishPath) # shutil.copy2(srcPath, destPath) shotName = '%s_%s' % (self._getEpisodeName(shot), self._getShotName(shot)) getShotTasks = self.tk.shotgun.find_one('Shot', filters = [["code", "is", shotName]], fields=['id', 'tasks']) taskName = self.comboBox.currentText() self.playblastName = os.path.basename(srcPath) publishMovPath = os.path.join(destPath, self.playblastName).replace('\\', '/') shutil.copy2(srcPath, destPath) for task in getShotTasks['tasks']: if task['name'] == taskName: taskId = task['id'] data = { 'project': {'type':'Project','id': 66}, 'code': self.playblastName, 'description': 'Playblast published', 'sg_path_to_movie': publishMovPath, 'sg_status_list': 'rev', 'entity': {'type':'Shot', 'id':getShotTasks['id']}, 'sg_task': {'type':'Task', 'id':taskId}, 'user': {'type':'HumanUser', 'id':92} } result = sgsrv.create('Version', data) result2 = sgsrv.upload("Version", result['id'], publishMovPath, "sg_uploaded_movie") print "Published %s" % self.playblastName
def __init__(self, parent=None): # set up the UI and variable here - don't forget to call updateUI at end super(dMFXsubmitterDialog, self).__init__(parent) self.acceptDrops() self.setupUi(self) # generic call to setup the Ui provided by Qt self.password = '' self.version_file_path = '' self.user = '' self.user_id = '' self.user_name = '' self.user_initials = '' self.submit_movie = False self.movie_file_path = '' self.description = '' self.login_status = False self.allOK = True self.submit_call_track = True self.version_type = 'Shot' self.created_version_id = None self.sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY) self.sgu = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY) self.users_with_initals = INITIALS_LIST self.user_list = [] self.lineEdit_versionFile.dragEnterEvent = types.MethodType( dragEnterEvent, self.lineEdit_versionFile) self.lineEdit_versionFile.dropEvent = types.MethodType( dropEvent, self.lineEdit_versionFile) self.lineEdit_versionFile.setAcceptDrops(True) self.lineEdit_versionFile.setDragEnabled(True) self.lineEdit_forReview.dragEnterEvent = types.MethodType( dragEnterEvent, self.lineEdit_forReview) self.lineEdit_forReview.dropEvent = types.MethodType( dropEvent, self.lineEdit_forReview) self.lineEdit_forReview.setAcceptDrops(True) self.lineEdit_forReview.setDragEnabled(True) # start things happening... get the users from sg and populate them into the drop-down self.update_user_list() self.connect(self, SIGNAL('update'), self.updateUI) self.new_value = 'this is not a new value' #self.emit(SIGNAL("update")) self.updateUI()
def get_standalone_sg(): conf_data = ShotgunConfParser.sg_conf_data() sg_api_path = conf_data.get("sg_api_path") if sg_api_path not in sys.path: sys.path.insert(0, sg_api_path) from shotgun_api3 import Shotgun SERVER_PATH = conf_data.get("sg_site") SCRIPT_NAME = conf_data.get("script_name") SCRIPT_KEY = conf_data.get("api_key") return Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY)
def getentitiesfromshotgun(name): sg = Shotgun(const.SHOTGUN_URL, const.API_NAME, const.API_KEY) sgname = name if name in const.ENTITY_MAP: sgname = const.ENTITY_MAP[name] fields = sg.schema_field_read(sgname) rawents = sg.find(sgname, [['project', 'is', { 'type': 'Project', 'id': 70 }]], list(fields.keys())) pp(rawents) clean = [] for ent in rawents: if 'image' in ent and ent['image']: directory = "data/filestorage/%s/%s/%s" % (name, ent['id'], "image") if not os.path.exists(os.path.dirname(directory)): os.makedirs(os.path.dirname(directory)) sg.download_attachment({'url': ent['image']}, directory) ent['image'] = directory for field in fields: if fields[field]['data_type']['value'] == 'url' and ent[field]: pp(ent) directory = "data/filestorage/%s/%s/%s" % (name, ent['id'], ent[field]['name']) if not isinstance(ent['id'], int): directory = "data/filestorage/%s/%s/%s" % ( name, ent['id']['value'], ent[field]['name']) if not os.path.exists(os.path.dirname(directory)): os.makedirs(os.path.dirname(directory)) sg.download_attachment(ent[field], directory) ent[field] = directory ent[field] = { "value": ent[field], "type": fields[field]['data_type']['value'] } ent.pop("created_at", None) ent.pop("created_by", None) ent.pop("updated_at", None) ent.pop("updated_by", None) ent.pop("filmstrip_image", None) ent.pop("cached_display_name", None) dic = {} dic['type'] = {'type': 'text', 'value': ent.pop('type')} for f in ent: dic[fields[f]['name']['value']] = ent[f] clean.append(dic) return clean
def connect(self): settings = copy.deepcopy(self.settings_dict) db_url = getattr(settings, 'SHOTGUN_URL', None) script_name = getattr(settings, 'SHOTGUN_SCRIPT_NAME', None) api_key = getattr(settings, 'SHOTGUN_KEY', None) self.connected = True self.connection = Shotgun(base_url=db_url, script_name=script_name, api_key=api_key)
def getentitydatafromshotgun(): sg = Shotgun(const.SHOTGUN_URL, const.API_NAME, const.API_KEY) entityData = sg.schema_entity_read({'type': 'Project', 'id': 70}) visibleEntities = [] for entityName in entityData: fields = sg.schema_field_read(entityName) if 'project' in fields: if entityData[entityName]['visible']['value']: visibleEntities.append(entityData[entityName]['name']['value']) print("\"" + entityData[entityName]['name']['value'] + "\": \"" + entityName + "\",") return visibleEntities
def _log_into_sg(is_headless): """ Ensures that the user is logged into Shotgun. If not logged, the credentials are queried. If out of date, useful defaults are provided. :param bool is_headless: If True, logging won't attempt to ask for credentials. :returns: Shotgun connection and associated HumanUser entity. """ # Assume the file is empty originally. data = _get_credentials_from_file() # No session token, create a new connection. if not data.get("session_token"): return _create_new_connection(is_headless, data) # Try to create a session with the session token that is stored. sg = Shotgun(data["site"], session_token=data["session_token"]) try: return sg, _get_self(sg, data["login"]) except AuthenticationFault: pass print "Session token expired. Retrieving password from keyring." password = _get_password(data["site"], data["login"]) # If there is no password, ask for the credentials from scratch. if not password: print "Password not found in keyring or empty." return _create_new_connection(is_headless, data) try: sg = Shotgun(data["site"], login=data["login"], password=password) data["session_token"] = sg.get_session_token() with open(_get_credential_file_path(), "w") as f: json.dump(data, f) return sg, _get_self(sg, data["login"]) except AuthenticationFault: print "Password in keychain doesnt't seem to work. Did you change it?" return _create_new_connection(is_headless, data)
def setUpClass(cls): # Set some class properties so you can pass these off to all your test cases cls.baseUrl = os.environ.get("BASE_URL", "") cls.browser = os.environ.get("BROWSER", "chrome") cls.username = os.environ.get("USERNAME", "") cls.password = os.environ.get("PASSWORD", "") cls.project_id = os.environ.get("TEST_PROJECT_ID", 66) # Create a Shotgun API connection object cls.sg = Shotgun(cls.baseUrl, login=cls.username, password=cls.password) # Create a web driver cls.site = SG.ShotgunSite(baseUrl=cls.baseUrl, browser=cls.browser)
def __init__(self, prototype, *args, **kwargs): self._free_instances = [] # Construct a prototype Shotgun if we aren't given one. if not isinstance(prototype, Shotgun): kwargs.setdefault('connect', False) prototype = Shotgun(prototype, *args, **kwargs) self._prototype = prototype # Remember stuff to apply onto real instances. self.base_url = prototype.base_url self.config = prototype.config
def setUpClass(cls): """ Connect to both servers and resolve all users. """ # Connect to Shotgun cls._sg = Shotgun( os.environ["SGJIRA_SG_SITE"], login=os.environ["SGJIRA_SG_TEST_USER"], password=os.environ["SGJIRA_SG_TEST_PASSWORD"], ) # Resolve the project by name cls._sg_project = cls._sg.find_one( "Project", [["name", "is", os.environ["SGJIRA_SG_TEST_PROJECT"]]]) assert cls._sg_project is not None # Resolve first Shotgun user cls._sg_user_1 = cls._sg.find_one( "HumanUser", [["login", "is", os.environ["SGJIRA_SG_TEST_USER"]]]) assert cls._sg_user_1 is not None # Resolve second Shotgun user. cls._sg_user_2 = cls._sg.find_one( "HumanUser", [["login", "is", os.environ["SGJIRA_SG_TEST_USER_2"]]]) assert cls._sg_user_2 is not None # Connecet to JIRA. cls._jira = JIRA( os.environ["SGJIRA_JIRA_SITE"], basic_auth=( os.environ["SGJIRA_JIRA_TEST_USER"], os.environ["SGJIRA_JIRA_TEST_USER_SECRET"], ), ) # Resolve JIRA Project key. cls._jira_project = os.environ["SGJIRA_JIRA_TEST_PROJECT_KEY"] assert cls._jira_project is not None # Resolve first JIRA user key. cls._jira_user_1 = cls._jira.myself()[cls.USER_ID_FIELD] cls._jira_user_1_login = cls._jira.myself()["name"] cls._jira_user_2 = getattr( cls._jira.user(os.environ["SGJIRA_JIRA_TEST_USER_2"]), cls.USER_ID_FIELD) cls._jira_user_2_login = cls._jira.user( os.environ["SGJIRA_JIRA_TEST_USER_2"]).name
def __init__(self): ''' creates the connection to the shotgun site by api ''' ''' shotgun conection ''' SERVER_PATH = "https://hcpstudio.shotgunstudio.com" SCRIPT_NAME = 'Tracker' SCRIPT_KEY = '99b5c166044037cc2d04646b1dfd58b2f44e8a146b710b425b8f561f2a21e49d' self.sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY) self.userId = None self.userDic = {} self.tasks = None self.projectPath = None
def _get_projects_list(): sg = Shotgun('http://yoursite.com', 'your_api', '123456') filters = [['sg_status', 'is', 'Active'], ['tank_name', 'is_not', '']] fields = ['name'] order = [{'field_name': 'name', 'direction': 'asc'}] projectsDic = sg.find('Project', filters, fields, order) newProjectsDic = [] for project in projectsDic: newProjectsDic.append(project['name'].replace(' ', '')) return newProjectsDic
def home(language): ''' Show introduction ''' ui = i18n[language] if request.method == 'POST': print("request form: ", request.form, flush=True) print("request form: ", list(request.form), flush=True) data = {} data['entity_type'] = request.form.get('entity_type', None) data['entity_id'] = request.form.get('selected_ids', None) data['project_name'] = request.form.get('project_name', None) data['project_id'] = request.form.get('project_id', None) hostname = request.host.split(":") config['vod_url'] = "{}{}:{}".format(configure['vod']['site']['ssl'], hostname[0], configure['vod']['site']['url']) print("config: ", config, flush=True) try: sg = Shotgun("{}{}".format(configure['shotgun']['site']['ssl'],\ request.form.get("server_hostname", None)), \ configure['shotgun']['site']['script_name'] , \ configure['shotgun']['site']['script_key'], \ sudo_as_login=request.form.get("user_login", None)) config["sg"] = sg print("prefs: ", sg.preferences_read(), flush=True) except Exception as e: return render_template('%s.html' % 'message', message=ui['message']['auth_error']) if len(data['entity_id'].split(",")) == 1: entityhandler = entity_handler(config, data) if data["entity_type"] != "Task": data['tasks'] = entityhandler.get_tasks() print("Tasks: ", data['tasks'], flush=True) data['entity_name'] = entityhandler.get_entity_name() return render_template('%s.html' % 'index', data=data, i18n=ui["index"], language=language) else: message = ui['message']['select_error'].format( len(data['entity_id'].split(","))) return render_template('%s.html' % 'message', message=message) else: return render_template('%s.html' % 'message', message=ui['message']['server_up'])
def create_sg_connection(self): """ Creates a Shotgun instance using the script user's credentials. The Shotgun instance will connect upon its first request. :returns: A Shotgun instance. """ # No need to instantiate the ShotgunWrapper because we're not using # session-based authentication. return Shotgun(self._host, script_name=self._api_script, api_key=self._api_key, http_proxy=self._http_proxy, connect=False)
def setUpClass(cls): if os.getenv("TK_FRAMEWORK_CONSULADOUTILS") not in sys.path: sys.path.insert(0, os.getenv("TK_FRAMEWORK_CONSULADOUTILS")) from python.shotgun_model import shotgun_model import python.shotgun_globals as shotgun_globals from shotgun_api3 import Shotgun # pragma: no cover cls._context = ContextMock() cls._sg = Shotgun( os.getenv("SG_HOST"), script_name=os.getenv("SG_SCRIPT_NAME"), api_key=os.getenv("SG_API_KEY"), ) cls.shotgun_model = shotgun_model cls.shotgun_globals = shotgun_globals
def submitShotgunTicket(output, jobList): currentuser = str(User.currentUser().name()) title = "AtS - %s" % currentuser desc = [] desc.append(output + "\n") desc.append("JOBLIST:") for job in jobList: desc.append(str(job.key()) + " - " + str(job.name())) sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY) id = sg.find("HumanUser", [['login', 'is', currentuser]], ['id']) userid = id[0] ticket_data = { 'created_by': { 'type': 'HumanUser', 'id': userid['id'] }, 'title': title, 'description': "\n".join(desc), 'addressings_to': [{ 'type': 'Group', 'id': 19 }, { 'type': 'HumanUser', 'id': userid['id'] }], 'project': { 'type': 'Project', 'id': 178 }, 'sg_service': { 'type': 'CustomNonProjectEntity01', 'id': 27 }, } sg_ticket = sg.create('Ticket', ticket_data, ['id']) new_ticket_url = SERVER_PATH + "/detail/Ticket/" + str(sg_ticket['id']) QDesktopServices.openUrl(QUrl(new_ticket_url))
def _create_new_connection(is_headless, data): """ Creates a new Shotgun connection based on user input. :param bool is_headless: Indicates if the script was invoked without a shell. :param dict data: Data found in the credentials file. :returns: A Shotgun connection and a user entity for the loged in user. """ if is_headless: raise UserInteractionRequiredError() # If the credentials didn't work or the file didn't exist, # ask for the credentials. site = _get_credential("Site", data.get("site", "")) login = _get_credential("Login", data.get("login", "")) sg = None # While we don't have a valid connection, keep asking for a password. while not sg: password = getpass("Password: "******"Authentication failure. Bad password?" print sg = None else: _set_password(site, login, password) # Update the data dictionary. Note that the dictionary can also # contain information about Toggl, so we need to update it # instead of creating a new one. data["site"] = site data["login"] = login data["session_token"] = session_token with open(_get_credential_file_path(), "w") as f: json.dump(data, f) return sg, _get_self(sg, login)
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) notificationList = [] # sender, receiver, date, message, noteDict ) notificationList.append( notification("Cyrilc", "john", datetime.datetime.now(), "Wait for approval ! rhooooooo lr lr bon y va oui ou non il est l'heure d'ylller j'ai faim. et de toute facon il est l'heure", "pas") ) notificationList.append( notification("Donat", "john", datetime.datetime.now(), "Peu continuer !", "pas") ) notificationList.append( notification("MikeB", "john", datetime.datetime.now(), "Oui c'est sympas", "pas") ) notificationList.append( notification("Aurelien", "john", datetime.datetime.now(), "Launch Time", "pas") ) notificationList.append( notification("Thomas", "john", datetime.datetime.now(), "Wait for appoval", "pas") ) notificationList.append( notification("James", "john", datetime.datetime.now(), "Approved", "pas") ) notificationList.append( notification("Mike", "john", datetime.datetime.now(), "Aurevoir John !", "pas") ) notificationList.append( notification("Tristan", "john", datetime.datetime.now(), "Bonjour John !", "pas") ) notificationList.append( notification("Eric", "john", datetime.datetime.now(), "Bonjour John !", "pas") ) notificationList.append( notification("Francois", "john", datetime.datetime.now(), "Bonjour John !", "pas") ) path_to_shotgunApi = getPathToShotgunApi() sys.path.append(path_to_shotgunApi) from shotgun_api3 import Shotgun self.SERVER_PATH = "https://nozon.shotgunstudio.com" self.SCRIPT_NAME = 'noteManager' self.SCRIPT_KEY = '30b93ec002ce2e22ecd6fb31fdda6063797deed1d612b4f6ca39e8030104707c' self.sg = Shotgun(self.SERVER_PATH, self.SCRIPT_NAME, self.SCRIPT_KEY) sg_spawnedNotes = self.sg.find("CustomEntity04", [ ['sg_note','is_not', None] ] , ["project"] ) for a in sg_spawnedNotes : print a self.setMinimumWidth(1000) self.setMinimumHeight(50) self.noteBarW = NotificationBar(notificationList, ["jack","popeye","james","conan le barbare"]) button = QtGui.QPushButton("pafpaf") #button.clicked.connect(self.noteBarW.addNotification) lay = QtGui.QVBoxLayout() lay.addWidget(button) lay.addWidget(self.noteBarW) lay.addWidget(QtGui.QPushButton("pafpaf")) self.setLayout(lay) lay.setSpacing(0) lay.setContentsMargins(0,0,0,0) self.show()
def getShotsBySeqId(seq_id): site = 'https://chimneypot.shotgunstudio.com' scriptName = 'AssetBrowser' scriptKey = 'c35ab5f5322d4b1e8b6488bb315c03e5f38881ea' sg = Shotgun(site, scriptName, scriptKey) fields = ['id', 'type', 'code'] filters = [['sg_sequence', 'is', {'type': 'Sequence', 'id': seq_id}]] shots = sg.find("Shot", filters, fields) if len(shots) < 1: print "couldn't find any shots" #exit(0) else: None return shots
def main(script, project): ## get shotgun script information && create the shotgun instance SERVER_PATH = "" SCRIPT_NAME = '' SCRIPT_KEY = '' sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY) projectList = getProjectList(sg, logging, project) ## get list of episodes to update episodeList = getEpisodeList(sg, logging, projectList['projectID']) ## for each episode in episode list ## set its path to XML && get shotList and sequenceList for i in range(0, len(episodeList)): ## get the full episode name, episodeID, && duration episodeName = episodeList[i]['code'] episodeID = episodeList[i]['id'] episodeDuration = episodeList[i]['sg_duration'] ## get the episode, xmlName, xmlFolder and path for the episode episode = episodeName.split('_') episode = episode[1] xmlName = episode.lower() + "_shotdata.xml" xmlFolder = projectList[ 'pathToProject'] + '\\05_PROD\\EPISODES\\' + episodeName + "\\99_PIPELINE\\" xmlPath = xmlFolder + xmlName ## get the sequences and shot info sequenceList = getSequenceList(sg, logging, episodeID) shotList = getShotList(sg, logging, episodeID) ## update the XML updateXML(xmlPath, episodeName, episodeDuration, sequenceList, shotList) ## update the episode to active episodeData = {'sg_status_list': 'act'} episodeUpdate = sg.update('Scene', episodeID, episodeData)