removed restrictions on what licenses are resolved

This commit is contained in:
bill bittner 2017-08-08 17:32:03 -07:00
parent d86510f1ef
commit 073aa3100d
4 changed files with 15 additions and 16 deletions

View file

@ -2,7 +2,7 @@ const lbryApi = require('../helpers/lbryApi.js');
const db = require('../models');
const logger = require('winston');
const getAllFreePublicClaims = require('../helpers/functions/getAllFreePublicClaims.js');
const isFreePublicClaim = require('../helpers/functions/isFreePublicClaim.js');
const isFreeClaim = require('../helpers/functions/isFreeClaim.js');
const serveHelpers = require('../helpers/serveHelpers.js');
function checkForLocalAssetByClaimId (claimId, name) {
@ -50,7 +50,7 @@ function getAssetByClaimId (fullClaimId, name) {
lbryApi.resolveUri(`${name}#${fullClaimId}`)
.then(resolveResult => {
// if the claim is free and public, then get it
if (resolveResult.claim && isFreePublicClaim(resolveResult.claim)) {
if (resolveResult.claim && isFreeClaim(resolveResult.claim)) {
lbryApi.getClaim(`${name}#${fullClaimId}`)
.then(getResult => {
let fileInfo = formatGetResultsToFileInfo(getResult);

View file

@ -1,4 +1,4 @@
const isFreePublicClaim = require('./isFreePublicClaim.js');
const isFreeClaim = require('./isFreeClaim.js');
const lbryApi = require('../lbryApi.js');
const logger = require('winston');
@ -11,7 +11,7 @@ function filterForFreePublicClaims (claimsListArray) {
if (!claim.value) {
return false;
}
return isFreePublicClaim(claim);
return isFreeClaim(claim);
});
return freePublicClaims;
}

View file

@ -0,0 +1,11 @@
const logger = require('winston');
module.exports = ({ value }) => {
if (!value.stream.metadata.fee || value.stream.metadata.fee.amount === 0) {
logger.debug('isFreeClaim?', true);
return true;
} else {
logger.debug('isFreePublicClaim?', false);
return false;
}
};

View file

@ -1,12 +0,0 @@
const logger = require('winston');
const licenses = ['Creative Commons', 'Public Domain', 'Creative Commons Attribution 4.0 International', 'Creative Commons Attribution-ShareAlike 4.0 International', 'Creative Commons Attribution-NoDerivatives 4.0 International', 'Creative Commons Attribution-NonCommercial 4.0 International', 'Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International', 'Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International'];
module.exports = ({ value }) => {
if ((licenses.includes(value.stream.metadata.license)) && (!value.stream.metadata.fee || value.stream.metadata.fee.amount === 0)) {
logger.debug('checking isFreePublicClaim...', true);
return true;
} else {
logger.debug('checking isFreePublicClaim...', false);
return false;
}
};