HIGHLY IN DEVELOPMENT: Do not use for production
This importer harvests episodes and series (lecture recordings) from Opencast instances and pushes them as external references to an Edu-Sharing instance.
- Edu-Sharing 6.0
- NodeJS 10.12.0 or higher
- Clone repository and change into repository folder
- Install dependencies
npm install
- Add new user to your Edu-Sharing instance. For more information see Edu-Sharing documentation.
- Rename
.env.template
file to.env
- Edit
.env
file as described in the comments.
Minimum required variables are Edu-Sharing host specs (protocol, domain), user and password.
# (Required) Edu-Sharing host
ES_HOST_PROTO=http
ES_HOST_DOMAIN=localhost
# (Required) Edu-Sharing User to publish Opencast content with
ES_USER=opencast
ES_PASSWORD=opencast
- Rename
config.oc-instances.js.template
toconfig.oc-instances.js
in folder./src/config/
- Edit
./src/config/config.oc-instances.js
and add Opencast instances as JSON objects (orgName, orgUrl, protocol, domain). Keys with org Prefix are nescessary for a minimal metadata set of Edu-Sharing nodes. Optionally, the ROR can be specified.
{
orgName: 'Opencast',
orgUrl: 'https://opencast.org',
protocol: 'https',
domain: 'develop.opencast.org',
blacklistedIds: []
}
List Ids of oc-records you don't want to import into edu-sharing in blacklistedIds.
- Run
npm start
in repository directory.
npm start
// or directly
node src/index.js
Config file can be found in src/config/config.js
. It contains four JSON objects each for Edu-Sharing, Opencast, Logger and Filter functionalities.
config.es = {
// Edu-Sharing instance config from .env file
host: {
// [...]
},
// Edu-Sharing http requests settings
settings: {
// Maximal number of http requests send to Edu-Sharing instance at once.
// Reduce value to reduce Edu-Sharing load.
// Increase carefully: In some cases Edu-Sharing was not able to process more than 2 requests parallel.
maxPendingPromises: 2
},
// Edu-Sharing API routes
routes: {
// [...]
}
}
config.oc = {
// Force update episodes and series from Opencast instances
forceUpdate: false,
// Opencast instances from /src/config/config.oc-instances.js
instances: ocInstances,
// Opencast http requests settings
settings: {
maxPendingPromises: 2, // Maximal number of simultaneous https requests
requestOffset: 5 // Number of requested episodes and series (like pagination)
},
// Opencast API routes
routes: {
// [...]
},
// Storage file names
filenames: {
episodes: 'ocEpisodes.json',
series: 'ocSeries.json',
episodesData: 'episodesData.json',
seriesData: 'seriesData.json'
}
}
// Logger settings
config.logger = {
folderPath: './logs/',
dateBasedFileNaming: true,
fileNamePrefix: 'es-oc-importer_',
fileNameExtension: '.log',
timeZone: 'Europe/Berlin',
dateFormat: 'YYYY-MM-DD',
timeFormat: 'HH:mm:ss',
logLevel: 'debug',
onlyFileLogging: false
}
// Filter settings (only harvest episodes with allowed licences)
// Mind the formatting if you add new licences like CC-BY-NC-ND
config.filter = {
allowedLicences: ['CC0', 'CC-BY', 'CC-BY-SA', 'PD', 'PDM']
}
Define mapping of opencast-values to edu-sharing-values in src/config/mapping.js
.
- Get all published episodes from Opencast Instance
- Filter episodes by open licences
- Get all published series from Opencast Instance
- Edu-Sharing authentication (Basic auth or Bearer token)
- Create folder structure in Edu-Sharing user workspace (a folder for every Opencast series)
- Create a node/children for every episode (Alfresco API)
- Update metadata for all nodes/childrens
- Update thumbnails/preview images for episodes nodes/children
- Set permissions for all nodes/childrens to public
- Setup development environment. You can use the official Edu-Sharing docker container.
- Follow all minimum config steps as described above.
- Run nodemon to watch for file changes
npm run dev
Linting and formatting is run by a husky-hook with every commit. See package.json
file for config.
You can also run linting and formatting via this commands:
npm run format
npm run lint
npm run lint:fix
💻 virtUOS (University Osnabrück)
- www: virtuos.uni-osnabrueck.de
- Github: @virtUOS
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator