Decoding HTML entities in title, description and location.
This commit is contained in:
parent
d7f9157424
commit
5d3358ed91
|
@ -28,6 +28,7 @@
|
|||
.button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: none;
|
||||
padding: .5rem;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
const config = require('config');
|
||||
const Promise = require('bluebird');
|
||||
const { decode } = require('html-entities');
|
||||
|
||||
const argv = require('./argv');
|
||||
const logger = require('./logger')(__filename);
|
||||
|
@ -29,7 +30,8 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce
|
|||
});
|
||||
|
||||
const curatedRelease = {
|
||||
title: release.title,
|
||||
id: release.id, // release is updated
|
||||
title: decode(release.title),
|
||||
entry_id: release.entryId || null,
|
||||
entity_id: release.entity.id,
|
||||
studio_id: release.studio?.id || null,
|
||||
|
@ -37,7 +39,7 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce
|
|||
date: Number(release.date) ? release.date : null,
|
||||
date_precision: release.datePrecision,
|
||||
slug,
|
||||
description: release.description,
|
||||
description: decode(release.description),
|
||||
comment: release.comment,
|
||||
deep: typeof release.deep === 'boolean' ? release.deep : false,
|
||||
deep_url: release.deepUrl,
|
||||
|
@ -52,10 +54,10 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce
|
|||
}
|
||||
|
||||
if (release.productionLocation) {
|
||||
curatedRelease.production_location = release.productionLocation;
|
||||
curatedRelease.production_location = decode(release.productionLocation);
|
||||
|
||||
if (argv.resolvePlace) {
|
||||
const productionLocation = await resolvePlace(release.productionLocation);
|
||||
const productionLocation = await resolvePlace(decode(release.productionLocation));
|
||||
|
||||
if (productionLocation) {
|
||||
curatedRelease.production_city = productionLocation.city;
|
||||
|
@ -469,8 +471,11 @@ async function storeScenes(releases, useBatchId) {
|
|||
|
||||
const uniqueReleasesWithId = attachReleaseIds(uniqueReleases, storedReleaseEntries, batchId);
|
||||
const duplicateReleasesWithId = attachReleaseIds(duplicateReleases, duplicateReleaseEntries, batchId);
|
||||
const curatedDuplicateReleases = await Promise.all(duplicateReleasesWithId.map((release) => curateReleaseEntry(release, batchId)));
|
||||
const releasesWithId = uniqueReleasesWithId.concat(duplicateReleasesWithId);
|
||||
|
||||
console.log(curatedDuplicateReleases);
|
||||
|
||||
const updated = await knex.raw(`
|
||||
UPDATE releases
|
||||
SET url = COALESCE(new.url, releases.url),
|
||||
|
@ -485,7 +490,7 @@ async function storeScenes(releases, useBatchId) {
|
|||
AS new(id int, url text, date timestamptz, entity json, title text, description text, duration integer, deep boolean)
|
||||
WHERE releases.id = new.id
|
||||
`, {
|
||||
scenes: JSON.stringify(duplicateReleasesWithId),
|
||||
scenes: JSON.stringify(curatedDuplicateReleases),
|
||||
});
|
||||
|
||||
const [actors, storedSeries] = await Promise.all([
|
||||
|
|
Loading…
Reference in New Issue