h5p / h5p-editor-php-library

68 stars 119 forks source link

Version now in path of content types #18

Open Jakeii opened 7 years ago

Jakeii commented 7 years ago

Hi,

I created https://github.com/tunapanda/h5p-standalone for viewing H5Ps without any server side code.

I'm not sure when this changed, but previously paths to the content types were just the content type name (H5P.Audio), now they include a version (H5P.Audio-1.2). This is fine, I have modified it to work with it. But is there anywhere in the JSON files I can use to determine what the structure would be, so I can make it backward compatible? As using front end JS I can't just scan the directory to determine it.

Thanks

icc commented 7 years ago

Do you mean the paths inside the .h5p files?

To begin with, there weren't any version numbers in the path, but as new content types and dependencies were added the need quickly arose, needing different versions of the same library in packages. So, version numbers were added to the library paths. However, it was seldom needed in exported packages so the old exporter wasn't updated with this feature. Creating a bit of inconsistency between the packages. At the beginning of 2016, as the exporter was refactored to support more advanced file system APIs, like the one used by Moodle, the versioned paths were made default.

I don't know that there's any easy way to detect this. I think you'll need some sort of backend code that checks this and then sets a variable.

Jakeii commented 7 years ago

Thanks for the info, unfortunately by it's very nature there is no backend code! Perhaps I could just try retrieving with the versions and then retry without if it fails.