Jump to content

Copy Files from ftrack location to local drive


wael@se-medien.de

Recommended Posts

Posted

I want to download or copy files from the ftrack location , inside this there are several components which id like to copy them to my local drive .i have seen only in the documentation samples for dropbox and how to wrap  my component to a file using dropbox accessor .could this be done but on the local drive?  as the task is to synchronise files between my local drive and ftrack server account components and i could only find diskaccessor and dropbox accessor ..

 

 

  • 4 weeks later...
  • 4 weeks later...
Posted

i am afraid it did not work for me as well, the main issue is i just want to download some files from my ftrack server , could this be done without needing to create a new location and add a component on it ? like a donwload function or soemthing in ftrack which could be called by my python API code 

Posted

Hi,

 

To help you it would be great with some more information on what these files are that you want to copy and in which location they are. Is it something you've uploaded from the web UI (ftrack server location) or is it published via the Connect publisher (e.g. ftrack unamanged location)?

 

Please let me know and maybe I can point you in the right direction.

Posted

Hallo ,

 

These files could be text files, images, or media files . 

 

these files are being uploaded to our ftrack server using python API code by our colleague from his PC , this API simply create a location with diskaccessor and add these files as components on it .

 

Now the main aim is to download these files on a colleague pc located in another country from ftrack server (where we uploaded our files ).

 

The support team informed us that in order to copy files from ftrack server, we have to create a new location and call it target location , then add the uploaded files as components to it using Addcomponent function ,

 

However we faced another big problem , that this method requires an accessor for both the new created target location and the component source location .

 

When we retrieve the component(files uploaded ) from the ftrack server , it does not have an accessor on it, even when i used the getaccessor() method it returned null .

Posted

Are you using the legacy api that you download from the ftrack server or the new ftrack-python-api that you do pip install with?

 

Could you put to gather a self-contained, small example of the code you are running when trying to transfer the file? Try to make it as minimal as possible to highlight the problem.

Posted

My module has two parts 

 

First part : 

 

A user upload some files as components and add them to the ftrack server , noting that this user is on remote place, therefore his diskaccessor wont be saved in the location created . as follows : 

 

Uploading the Files

 

def createLocation(name ,priority=10 ):

    
    
    #localRootPath = raw_input('Please Enter Your FULL Root Path here : \n')
    localRootPath = '/Users/localadmin/Downloads/ftrackProjects/'
                                
    
    location = ftrack.LOCATION_PLUGINS.get(name)
 
    if not location:
        
        accessor = ftrack.DiskAccessor(prefix=localRootPath)
 
        # Create folder structure based on structure of origin .
        structure = ftrack.IdStructure()
 
        # Create a location object
        location = ftrack.ensureLocation(name)
        location = ftrack.Location(
            name,
            accessor=ftrack.DiskAccessor(prefix= localRootPath),
            structure=structure,
            priority=priority
        )
 
        ftrack.LOCATION_PLUGINS.add(location)
 
    return location
 
location = createLocation('ola')
ftrack.LOCATION_PLUGINS.add(location)
inputPath = '/Users/localadmin/Downloads/ftrackProjects/Upload/second/' 
component = ftrack.createComponent(name='test', path='/Users/localadmin/Downloads/ftrackProjects/test.txt', location=location, manageData=True)
 
 
Second Part is Other user in Other Country Download this file 
def get_target_location():
    '''Return configured location instance for target location.'''
    location_name = 'endzfdlgldfgk'
    prefix = os.path.expanduser('/Users/localadmin/Download/ftrackProjects/Upload/second/')
    ftrack.ensureLocation(location_name)
    accessor = ftrack.DiskAccessor(prefix=prefix)
    structure = ftrack.IdStructure()
    target_location = ftrack.Location(
        location_name,
        accessor=accessor,
        structure=structure,
        priority=1
    )
    return target_location
 
target_location = get_target_location()
 
source_location = ftrack.Location('ola')
 
componets = source_location.getComponents()
 
for componet in componets:
 component_id = componet.getId()
 component = ftrack.Component(component_id, location=source_location)
 target_location.addComponent(component)
Posted

Just to clarify, do you want to transfer the files from your computer to your colleagues, second one in another office, using the ftrack server as the shared storage?

 

[your computer] -> [ftrack server] ->  [second computer]

 

In that case you will have to add and read the files from the ftrack.server location

Posted

Thanks for Replying :) , and yes your understanding of my problem was perfect , thats exactly what i want to do but  cant i make a new location using serveracessor and use it instead of using the ftrack.server location which has already alot of files stored on it ? .

 

I want to do that because every file has to have a container and ftrack.server does not allow me to make containers on the componenets .

Posted
Thanks for Replying  :) , and yes your understanding of my problem was perfect , thats exactly what i want to do but  cant i make a new location using serveracessor and use it instead of using the ftrack.server location which has already alot of files stored on it ? .

 

 
In the code you shared above I could not see any usage of the ftrack.server location. Just two custom, disk-based locations.
 
You cannot make another accessor for the ftrack server. But you can of course setup your own Amazon s3/ Dropbox account and make an accessor for that.
 

 

 

I want to do that because every file has to have a container and ftrack.server does not allow me to make containers on the componenets .

 

Do you get an error when you try to add a container component to the ftrack.server location? Could you share a simple code example when this happens?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...