[Zope-CMF] Uploading many files

Tres Seaver tseaver@palladion.com
Sun, 03 Jun 2001 22:44:00 -0400


Scott wrote:

> I'd like to avoid using ttw to add metadata, as my server is under
> powered - P133.  It takes several seconds to update anything.  I have
> seen references to accessing properties via FTP, but have not found any
> more than just references - no details on how to do this.  
> 
> My ideal is to have a file with something like:
> 
> id: 01.jpg
> title: First Image
> description: blah blah
> subject: subject
> 
> id: 02.jpg
> etc...
> 
> and run an import.  Any help on this would be appreciated.  RTFM would
> be acceptable if it's clear somewhere.  I haven't found it yet.  yet...


You can accomplish this, but it will require two passes.  First,

use FTP to upload the images.  Then, run a script (a PythonScript
would do nicely) which you generate from the data on your filesystem.

For instsnce, you would create a PythonScript in the directory to
which you uploaded the files::

   ## Script (Python) "blast_image_metadata"
   ## title=Blast in Image Metadata
   img_metadata = ( { 'id' : '01.jpg'
                    , 'title' : 'First Image'
                    , 'description' : 'blah, blah'
                    , 'subject' : ( 'subject' )
                    }
                  , { 'id' : '02.jpg'
                  #etc.
                    }
                  )
   for d in img_metadata:
       img = getattr( context, d[ 'id' ] )
       img.editMetadata( title=d] 'title' ]
                       , description=d[ 'description' ]
                       , subject=d[ 'subject' ]
                       )

and then you would run it (from its "Test" tab) to
populate the metadata of the uploaded images.

Hope this helps,

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org