Search the Community

Showing results for tags 'transfer location'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Company news
    • General announcements
  • ftrack Studio (main app)
    • General discussion
    • Feature requests
    • API
    • Help
    • Actions and Widgets
    • ftrack Go
  • ftrack Review
    • General discussion
    • Feature requests
    • Help
  • Connect and plugins
    • General discussion
    • Connect package releases
    • Feature requests
    • Help
    • Connect plugins releases
  • Advisory Forum
  • Tech preview
    • API
    • New integrations
    • Studio overview
    • ftrack Review

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. auto_transfer.py -------------------------------------------------------------------------------------------------------------------------------- # :coding: utf-8import platform as _platformimport getpassimport loggingimport ftrackTOPIC = 'ftrack.location.component-added and source.user.username={0}'.format(getpass.getuser())sourceLocation = ftrack.Location('source.location')targetLocation = ftrack.Location('target.location')class ComponentAutoTransfer(object): '''Component add sourceLocation to targetLocation.''' def __init__(self, name='ftrack.ComponentAutoTransfer', priority=50): '''Initialise ComponentAutoTransfer with *name* and *priority*.''' self._name = name self._priority = priority super(ComponentAutoTransfer, self).__init__() def getName(self): '''Return name.''' return self._name def getPriority(self): '''Return priority.''' return self._priority def handle(self, event): '''Handle published *event*. event['data'] should contain: * componentId - The id of the component to resolve for. * ''' # Only interested location is User Home location. # locationName = ftrack.pickLocation(event['data']['componentId']).getName() location = ftrack.pickLocation(event['data']['componentId']) if location.getId() != sourceLocation.getId(): print(u'Only Use source.location!! Exclude Location : {0}'.format(location.getName())) return #print(u'Component ID is {0}'.format(event['data']['componentId'])) #print(sourceLocation.getId()) if ftrack.pickLocation(event['data']['componentId']).get('id') == ftrack.Location(sourceLocation).get('id'): componentId = event['data']['componentId'] print componentId sourceComponent = sourceLocation.getComponent(componentId) # Add component to target location (and transfer any data) targetComponent = targetLocation.addComponent(sourceComponent) print(u'Transferred component {0} -> {1}'.format( sourceComponent.getInternalPath(), targetComponent.getInternalPath() )) else: print(event['data']['componentId'])def register(registry, **kw): '''Register auto_transfer plugin.''' logger = logging.getLogger( 'ftrack_plugin:ComponentAutoTransfer.register' ) # Validate that registry is an instance of ftrack.Registry. If not, # assume that register is being called from a new or incompatible API and # return without doing anything. if not isinstance(registry, ftrack.Registry): logger.debug( 'Not subscribing plugin as passed argument {0!r} is not an ' 'ftrack.Registry instance.'.format(registry) ) return plugin = ComponentAutoTransfer() ftrack.EVENT_HUB.subscribe('topic=ftrack.location.component-added and source.user.username={0}'.format(getpass.getuser()), plugin.handle) registry.add(plugin)resolver.py ------------------------------------------------------------------------------------------------------------------------------- # :coding: utf-8import platform as _platformimport getpassimport loggingimport ftrackTOPIC = 'ftrack.location.request-resolve and source.user.username={0}'.format(getpass.getuser())class ComponentInLocationPathResolver(object): '''Resolve the filesystem path of a component in a specific location.''' def __init__(self, name='ftrack.componentInLocationPathResolver', priority=10): '''Initialise resolver with *name* and *priority*.''' self._name = name self._priority = priority super(ComponentInLocationPathResolver, self).__init__() def getName(self): '''Return name.''' return self._name def getPriority(self): '''Return priority.''' return self._priority def handle(self, event): '''Handle published *event*. event['data'] should contain: * componentId - The id of the component to resolve for. * locationName - Name of the location to resolve for. Can be None to indicate location should be determined automatically. * platform - A string representing the platform to resolve for. Can be either 'Windows' or 'Linux'. ''' if getpass.getuser() != event['source']['user']['username']: # Only interested in specific current user topic. return # Extract useful information from passed event. componentId = event['data']['componentId'] platform = event['data']['platform'] if platform and platform != _platform.system(): # Don't resolve paths for other platforms. return locationName = event['data'].get('locationName', None) if not locationName: # Pick a suitable location if none was passed. location = ftrack.pickLocation(componentId) if location is not None: locationName = location.getName() if not locationName: return try: # Attempt to resolve to full filesystem path using locally # available location plugins. location = ftrack.Location(locationName) component = location.getComponent(componentId) resolvedPath = component.getFilesystemPath() except ftrack.FTrackError: return # Return data to send as reply event. return {'path': resolvedPath}def register(registry, **kw): '''Register resolver plugin.''' logger = logging.getLogger( 'ftrack_plugin:resolver.register' ) # Validate that registry is an instance of ftrack.Registry. If not, # assume that register is being called from a new or incompatible API and # return without doing anything. if not isinstance(registry, ftrack.Registry): logger.debug( 'Not subscribing plugin as passed argument {0!r} is not an ' 'ftrack.Registry instance.'.format(registry) ) return plugin = ComponentInLocationPathResolver() ftrack.EVENT_HUB.subscribe('topic=ftrack.location.request-resolve and source.user.username={0}'.format(getpass.getuser()), plugin.handle) registry.add(plugin)---------------------------------------------------------------------------------------------------------------------------------- auto_transfer_error.log -- show below error log.... ERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '10280d1070594b2abc2ddb33d96c84b3'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'ce9b348f-8809-11e3-821c-20c9d081909b', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'5196c741ef6a4617acd0a4429afc0454', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 42, in handle if location.getId() != sourceLocation.getId():AttributeError: 'NoneType' object has no attribute 'getId'ERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '64757e1a507842dbbb268734aaf76807'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'ce9b348f-8809-11e3-821c-20c9d081909b', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'5196c741ef6a4617acd0a4429afc0454', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 42, in handle if location.getId() != sourceLocation.getId():AttributeError: 'NoneType' object has no attribute 'getId'INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): my.server.com86fd5cfc-a7ca-11e5-9360-003048f5c468INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): my.server.comERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '10280d1070594b2abc2ddb33d96c84b3'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'87794940-a750-11e5-a7f8-003048f5c468', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'f52ed905cdda453aab47c935f266e441', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 57, in handle sourceComponent.getInternalPath(),AttributeError: 'Component' object has no attribute 'getInternalPath'86fd5cfc-a7ca-11e5-9360-003048f5c468ERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '64757e1a507842dbbb268734aaf76807'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'87794940-a750-11e5-a7f8-003048f5c468', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'f52ed905cdda453aab47c935f266e441', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 54, in handle targetComponent = targetLocation.addComponent(sourceComponent) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/client.py", line 89, in wrapper result = function(*args, **kw) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/location/base.py", line 518, in addComponent raise ComponentInLocationError(componentId, self.getId())ComponentInLocationError: Component "86fd5cfc-a7ca-11e5-9360-003048f5c468" already exists in location "add7b91a-a3e4-11e5-a4fe-003048f5c468".Only Use source.location!! Exclude Location : ftrack.serverOnly Use source.location!! Exclude Location : ftrack.serverOnly Use source.location!! Exclude Location : ftrack.serverOnly Use source.location!! Exclude Location : ftrack.server86fd5cfc-a7ca-11e5-9360-003048f5c468ERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '10280d1070594b2abc2ddb33d96c84b3'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'add7b91a-a3e4-11e5-a4fe-003048f5c468', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'97300be5074e4455917f802fb9d47b21', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 54, in handle targetComponent = targetLocation.addComponent(sourceComponent) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/client.py", line 89, in wrapper result = function(*args, **kw) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/location/base.py", line 518, in addComponent raise ComponentInLocationError(componentId, self.getId())ComponentInLocationError: Component "86fd5cfc-a7ca-11e5-9360-003048f5c468" already exists in location "add7b91a-a3e4-11e5-a4fe-003048f5c468".86fd5cfc-a7ca-11e5-9360-003048f5c468ERROR:FTrackCore.api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '64757e1a507842dbbb268734aaf76807'} subscription=topic=ftrack.location.component-added and source.user.username=kiseo_kim> for event <Event {'topic': u'ftrack.location.component-added', 'source': {u'id': u'b9d8d67ae5e64de498f08dc7cf683173', u'user': {u'username': u'kiseo_kim'}}, 'target': u'', 'sent': None, 'data': {u'locationId': u'add7b91a-a3e4-11e5-a4fe-003048f5c468', u'componentId': u'86fd5cfc-a7ca-11e5-9360-003048f5c468'}, 'id': u'97300be5074e4455917f802fb9d47b21', 'inReplyToEvent': None}>.Traceback (most recent call last): File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/event/hub.py", line 663, in _handle response = subscriber.callback(event) File "/home/kiseo_kim/ftrack-lib/ftrack_events/auto_transfer.py", line 54, in handle targetComponent = targetLocation.addComponent(sourceComponent) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/client.py", line 89, in wrapper result = function(*args, **kw) File "/app/prog/ftrack_connect/common.zip/FTrackCore/api/location/base.py", line 518, in addComponent raise ComponentInLocationError(componentId, self.getId())ComponentInLocationError: Component "86fd5cfc-a7ca-11e5-9360-003048f5c468" already exists in location "add7b91a-a3e4-11e5-a4fe-003048f5c468". ------------------------------------------------------------------------------------------------------------------------------ What is the reason above error log? (automatic transfer is work fine, but... show above error log...) Thanks.