ftrack_utils:Imported toml

This commit is contained in:
Jakub Trllo 2018-11-29 17:02:49 +01:00
parent c684a84df2
commit f415883a66
2 changed files with 12 additions and 5 deletions

View file

@ -11,7 +11,7 @@ from pype import lib
from ftrack_action_handler import BaseAction from ftrack_action_handler import BaseAction
from bson.objectid import ObjectId from bson.objectid import ObjectId
from avalon import io, inventory from avalon import io, inventory
from avalon.vendor import toml
from pype.ftrack import ftrack_utils from pype.ftrack import ftrack_utils
class SyncToAvalon(BaseAction): class SyncToAvalon(BaseAction):

View file

@ -4,10 +4,10 @@ from pprint import *
import ftrack_api import ftrack_api
from pype import lib from pype import lib
import avalon.io as io import avalon.io as io
import avalon.api import avalon.api
import avalon import avalon
from avalon.vendor import toml
from app.api import Logger from app.api import Logger
log = Logger.getLogger(__name__) log = Logger.getLogger(__name__)
@ -59,10 +59,17 @@ def get_apps(entity):
apps = [] apps = []
for app in entity['custom_attributes']['applications']: for app in entity['custom_attributes']['applications']:
try: try:
label = toml.load(lib.which_app(app))['label'] app_config = {}
apps.append({'name':app, 'label':label}) app_file = toml.load(avalon.lib.which_app(app))
app_config['name'] = app
app_config['label'] = app_file['label']
if 'ftrack_label' in app_file:
app_config['ftrack_label'] = app_file['ftrack_label']
apps.append(app_config)
except Exception as e: except Exception as e:
print('Error with application {0} - {1}'.format(app, e)) log.warning('Error with application {0} - {1}'.format(app, e))
return apps return apps
def get_config(entity): def get_config(entity):