Scraping from Cherry Pimps when available. Showing cover in movie tile.

This commit is contained in:
DebaucheryLibrarian
2020-08-02 03:44:14 +02:00
parent 767437d9aa
commit b4f0501765
6 changed files with 63 additions and 18 deletions

View File

@@ -23,8 +23,6 @@ function curateReleaseEntry(release, batchId, existingRelease, type = 'scene') {
limit: config.titleSlugLength,
});
console.log(release);
const curatedRelease = {
title: release.title,
entry_id: release.entryId || null,
@@ -47,7 +45,7 @@ function curateReleaseEntry(release, batchId, existingRelease, type = 'scene') {
if (type === 'scene') {
curatedRelease.shoot_id = release.shootId || null;
curatedRelease.productionDate = Number(release.productionDate) ? release.productionDate : null;
curatedRelease.production_date = Number(release.productionDate) ? release.productionDate : null;
curatedRelease.duration = release.duration;
}
@@ -260,10 +258,7 @@ async function storeReleases(releases) {
async function storeMovies(movies) {
const [batchId] = await knex('batches').insert({ comment: null }).returning('id');
console.log(movies);
const curatedMovieEntries = movies.map(release => curateReleaseEntry(release, batchId, null, 'movie'));
console.log(curatedMovieEntries);
const storedMovies = await knex.batchInsert('movies', curatedMovieEntries).returning('*');
const moviesWithId = attachReleaseIds(movies, storedMovies);