Edit h5p file

Hi!

I am trying to edit h5p file to add xAPI integration with Learning lockers. I am getting this error when I try to uplaod the new h5p file to my drupal site (working correctly with others h5p files) I am working on a Mac, but I try with Windows and it is not working.

I am doing the following:

  1. Download a h5p file from the website, for example Multiple choice (http://h5p.org/multichoice)
  2. Change it format for .h5p to .zip
  3. Extract .zip file, and I get all the directory
  4. Make a small change (a log for example), if I dont change anything it is not workign either
  5. Make a zip file from this file directory
  6. Change the format from .zip to .h5p
  7. Try to upload, and I am getting this error:
  • Warning: file_get_contents(/var/www/html/drupal/sites/default/files/h5p/temp/h5p-556c66113eeb6/713/library.json): failed to open stream: No such file or directory in H5PValidator->getJsonData() (line 1174 of /var/www/html/drupal/sites/all/modules/h5p/library/h5p.classes.php).
  • Could not find library.json file with valid json format for library 713
  • A valid content folder is missing
  • A valid main h5p.json file is missing
  • The uploaded file was not a valid H5P package

 

Who can I create a .h5p file from a directory?How can I edit the example to add xAPI support?

 

Thanks in advance,

 

Aitor

 

falcon's picture

Normally when we see this message it's because you've been in the wrong level when you zipped the folder.. You should have H5P.Multichoice in the root of the zip file.

Also see http://h5p.org/development-environment on how you may set up a development environment for H5P where you won't have to go back and forth between .zip and .h5p. On a sub page there you'll also learn about the H5P CLI allowing you to run the h5p pack command to pack libraries from your development folder.

studyaid's picture

7z.exe a -tzip h5pTEST.h5p -ir!*.? -i!*.json

-t (set Type of archive) switch

-i (Include filenames) switch

<recurse_type> ::= r[- | 0]

!{wildcard}

'*' means a sequence of arbitrary characters.

'?' means any character.

To view the contents of zip folder run:

7z.exe l h5pTEST.h5p

l (List contents of archive) command