node_import or import-export

jmeckley - October 18, 2006 - 20:21

I'm trying to import events with terms & files into my website using node_import. I can upload the node and event correctly, but the file and term are not propigating to the db. I assume this is due to the 1:N relationship in the BLL. Is there a way to adjust node_import to accept the term and files fields?

My plan is to FTP the associated files and then import the nodes. The files are 45 minute mp3s so I'm not about to use the interface to transfer these files. Just to confirm: the acutal file is not required when saving a node via the import routine?

If node_import only operates with 1:1 entities import-export module may be the solution. This will require some coding on my part as import-export does not handel file or event entities natively. It does appear to handel term entity.

Questions about import-export:

  1. Since event entities have a 1:1 relationship with nodes via the logic (not db schema) would this information automatically be handeled by the module the same way node_import works?
  2. The function import_export_nodeapi has 'hooks' for story, page, book and image. Is this where I would add a hook for files (and event if needed)?
    • Would I need to add code anywhere else to hook files(event) into the import/export process?
    • If so is there an example of how to do this?

I'm currently running 4.6.8

CCK, Node Import and attachments

nathan573 - October 30, 2006 - 17:12

I'm trying to do something similar. I'm trying to create a media library that can handle any file type and, of course, I don't want to have to create each media item/node individually, having to manually attach the files to their nodes.

My main requirements:

1. FTPing the media to the server (lots of large files)
2. batch or mass uploading (importing) the accompanying node data (node title, taxonomy terms, etc.)

My problem would be solved if _Node Import_ could somehow import file attachments along with the other CSV formatted node data. I would create a custom CCK content type that had my desired fields and then use _Node Import_ to get the media data fields into Drupal. Then, as subsequent media needed to be added piecemiel, the "create content" administration function could be used normally, using the custom content type. The end result would be nodes with taxonomy and attachments that I could use _Views_ to display to the user.

How I'm going to do it if I don't find a better way:


  1. Create a custom CCK content type - title, file size, file format, relative path to a preview thumbnail, relative path to the media (i.e. /mediafiles/product/sideview.pdf)

  • FTP the preview thumbnails and files to the server (where the relative paths point to)
  • Create a spreadsheet with fields commensurate to the CCK content type I created and save it as a CSV file
  • Import the CSV using _Node Import_
  • Create a custom CCK content template that displays the thumbnail and file download path
  • Use _Views_ to display the nodes based on their taxonomy terms.

  • The main flaw of this for me is there is no easy way to add more media items/nodes via "create content". I'd be able to add the node data via "create content" since the CCK custom content type shows up in the interface, but then I'd have to FTP the preview file and media file manually to the correct directories.

    Ideally I'd be able to upload the preview thumbnail and the file attachment via the "create content" interface, needing FTP only for batches.

     
     

    Drupal is a registered trademark of Dries Buytaert.