diff --git a/src/scrapers/teamskeet.js b/src/scrapers/teamskeet.js index e3cf1c26..fe900cda 100755 --- a/src/scrapers/teamskeet.js +++ b/src/scrapers/teamskeet.js @@ -45,6 +45,11 @@ async function scrapeScene(scene, channel, parameters, includeTrailers) { const release = {}; release.entryId = scene.id; + + release.attributes = { + entryId: scene.itemId, + }; + release.url = `${channel.type === 'network' || channel.parameters?.layout === 'organic' ? channel.url : channel.parent.url}/movies/${release.entryId}`; release.title = scene.title; diff --git a/src/store-releases.js b/src/store-releases.js index 4e31379f..17b4c62d 100755 --- a/src/store-releases.js +++ b/src/store-releases.js @@ -54,6 +54,7 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce slug, description: decode(release.description), comment: release.comment, + attributes: release.attributes, photo_count: Number(release.photoCount) || null, deep: typeof release.deep === 'boolean' ? release.deep : false, deep_url: release.deepUrl, @@ -439,10 +440,11 @@ async function storeScenes(releases, useBatchId) { shoot_id = COALESCE(new.shoot_id, releases.shoot_id), duration = COALESCE(new.duration, releases.duration), comment = COALESCE(new.comment, releases.comment), + attributes = COALESCE(new.attributes::jsonb || releases.attributes::jsonb, new.attributes::jsonb, releases.attributes::jsonb), deep = new.url IS NOT NULL, updated_at = NOW() FROM json_to_recordset(:scenes) - AS new(id int, url text, date timestamptz, entity json, title text, description text, shoot_id text, duration integer, comment text, deep boolean) + AS new(id int, url text, date timestamptz, entity json, title text, description text, shoot_id text, duration integer, comment text, attributes json, deep boolean) WHERE releases.id = new.id `, { scenes: JSON.stringify(curatedDuplicateReleases),