Ticket #214 (closed task: fixed)

Opened 20 months ago

Last modified 12 months ago

Migration script for Plone 2.5/Plumi 0.2.x sites to Plone 3.x/Plumi 0.3.x sites

Reported by: anna Owned by: andycat
Priority: major Milestone: 3.0-beta
Component: PlumiVideoProduct Keywords:
Cc: Who will test this:

Description


Attachments

Change History

Changed 14 months ago by andycat

  • component changed from ATEngageVideo to PlumiVideoProduct

Changed 13 months ago by vik

Here is a sample script to send a file from the filesystem in blob storage - can use any other reader for the file data (e.g. URL or pipe)

import os import transaction

username = 'foo' file = 'file/to/upload.mp4' memtool = getToolByName(portal, 'portal_membership')

memfolder = getattr(memtool.getMembersFolder(), username) ext = os.path.splitext(file)[1][1:] title = os.path.basename(file) memfolder.videos.invokeFactory('PlumiVideo?',title) vid = getattr(memfolder.videos, title) vid.video_file.setContentType('video/%s' % (ext)) vid.video_file.setFilename(title)

#copy the file blobfile = vid.video_file.blob.open('w') vidfile = open(file, 'rb') buffer_size = 1024*1024*16 # 16M buffer - adjust to your system while 1:

copy_buffer = vidfile.read(buffer_size) if copy_buffer:

blobfile.write(copy_buffer)

else:

break

blobfile.close() vidfile.close() transaction.commit()

Changed 13 months ago by vik

D'arghhh..

import os 
import transaction 

username = 'foo'
file = 'file/to/upload.mp4' 
memtool = getToolByName(portal, 'portal_membership')

memfolder = getattr(memtool.getMembersFolder(), username) 
ext = os.path.splitext(file)[1][1:] 
title = os.path.basename(file) 
memfolder.videos.invokeFactory('PlumiVideo',title) 
vid = getattr(memfolder.videos, title) 
vid.video_file.setContentType('video/%s' % (ext)) 
vid.video_file.setFilename(title)

#copy the file
blobfile = vid.video_file.blob.open('w')
vidfile = open(file, 'rb')
buffer_size = 1024*1024*16 # 16M buffer - adjust to your system
while 1:
    copy_buffer = vidfile.read(buffer_size)
    if copy_buffer:
        blobfile.write(copy_buffer)
    else:
        break
blobfile.close()
vidfile.close()
transaction.commit() 

Changed 13 months ago by andycat

The future is outlined here :  https://dev.plone.org/old/plone/ticket/9328

and here :  https://dev.plone.org/old/plone/wiki/PlipContentImExport

We are using a basic approach however.

a Members script which exports a 16 field CSV file, one line per member.

And json_migrator, which writes out content objects to disk as JSON formatted objects.

see  http://dev.plone.org/old/collective/browser/Plumi/branches/plumi-0.2.x/IMPORT-EXPORT.txt

and  http://dev.plone.org/old/collective/log/json_migrator/branches/plumi-0.2.2 [ log view of the branch of the product 'json_migrator' adapted for plumi 0.2.x usage ]

The branch name is annoying , I think i will copy over to a new one 'plumi-0.2.x'

Changed 12 months ago by andycat

  • status changed from new to closed
  • resolution set to fixed

this general task is done. there are more specific tickets lodged about the migration process opened now.

The above branch renaming has been done. The plumi 3.0 / plumi 0.2.x migration scripts are now here:  http://dev.plone.org/old/collective/browser/json_migrator/branches/plumi-0.2.x

Add/Change #214 (Migration script for Plone 2.5/Plumi 0.2.x sites to Plone 3.x/Plumi 0.3.x sites)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.