spee.ch/server/controllers/api/claim/publish/createBasicPublishParams.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-04-27 18:54:36 +02:00
const logger = require('winston');
2018-06-06 04:34:24 +02:00
const { details, publishing } = require('@config/siteConfig');
2018-04-27 18:54:36 +02:00
const createBasicPublishParams = (filePath, name, title, description, license, nsfw, thumbnail) => {
logger.debug(`Creating Publish Parameters`);
// provide defaults for title
if (title === null || title.trim() === '') {
title = name;
}
// provide default for description
if (description === null || description.trim() === '') {
description = '';
}
// provide default for license
if (license === null || license.trim() === '') {
license = ' '; // default to empty string
}
// create the publish params
const publishParams = {
name,
file_path: filePath,
bid : 0.01,
metadata : {
description,
title,
author : details.title,
language: 'en',
license,
nsfw,
},
claim_address: publishing.primaryClaimAddress,
};
// add thumbnail to channel if video
if (thumbnail) {
publishParams['metadata']['thumbnail'] = thumbnail;
}
2018-05-03 03:16:23 +02:00
logger.debug('publish params:', publishParams);
2018-04-27 18:54:36 +02:00
return publishParams;
};
module.exports = createBasicPublishParams;