Like many other people I need to put together a script to import a
batch of files into ResourceSpace along with metadata from a CSV.
Basically I'm hoping to write a PHP script that will do what the edit
and upload pages do, over and over for a batch of assets of various
types.
I've seen the examples on the forum, but as a complete newbie I'm
having trouble clarifying the basic steps an import script needs to
do. This is how it looks to me so far:
1. Read the first line of the CSV, which gives us the filename of the
first asset and its metadata.
2. Create a resource in ResourceSpace, giving it a temporary ref which
is the negative of the ref of the user doing the import. (So if I'm
user 2, give the resource ref -2).
3. Update the resource data for that asset using the data from the
CSV. (Assuming we've worked out the data mapping in advance.)
4. Copy the file into the ResourceSpace filestore.
5. Give the resource a "proper" resource ref.
6. Generate preview files, extracted text and keywords from the file
we've just copied in.
7. Loop back to next line of CSV.
Could some kind benefactor please give us any hints about which
functions we should call to do steps 2 to 6? If there's no function
that'll automatically create the right folder within /filestore to
store a new resource, what file structure should we use so the assets
are properly organised?
Thanks guys
Aethaelweard
Once I had a bunch of numbered files and an accompanying CSV sheet
with metadata. If you have a solid relationship between the filenames
and the same names on your CSV sheet, you might want to just upload
all the resources without metadata first. That's the big part, and
once its done you can leave the files as they are and run a script
against them as many times as you need to get it all right. In your
script, for each line, find the resource that has that filename, and
then for each field, update the proper field in RS.
What I would normally do is rename the headers on the CSV to the
corresponding field IDs in resourcespace. That makes the program much
easier to comprehend...
you find the resource $ref, then for each field,
update_field($ref,$field,"value");
Tom
> --
>
> You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
> To post to this group, send email to resour...@googlegroups.com.
> To unsubscribe from this group, send email to resourcespac...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.
>
>
>
--
Tom Gleason
-
http://resourcespace.blogspot.com/
- J