diff --git a/migrations/20230725001453_caps.js b/migrations/20230725001453_caps.js index 9bac273c..95a85550 100644 --- a/migrations/20230725001453_caps.js +++ b/migrations/20230725001453_caps.js @@ -5,7 +5,8 @@ exports.up = async (knex) => { table.integer('release_id') .notNullable() .references('id') - .inTable('releases'); + .inTable('releases') + .onDelete('cascade'); table.text('media_id') .notNullable() diff --git a/migrations/20230801225038_scene_titles.js b/migrations/20230801225038_scene_titles.js index 8d6f0e5e..7cb3aa4b 100644 --- a/migrations/20230801225038_scene_titles.js +++ b/migrations/20230801225038_scene_titles.js @@ -2,10 +2,18 @@ exports.up = async (knex) => { await knex.schema.alterTable('releases', (table) => { table.specificType('alt_titles', 'text ARRAY'); }); + + await knex.schema.alterTable('movies', (table) => { + table.specificType('alt_titles', 'text ARRAY'); + }); }; exports.down = async (knex) => { await knex.schema.alterTable('releases', (table) => { table.dropColumn('alt_titles'); }); + + await knex.schema.alterTable('movies', (table) => { + table.dropColumn('alt_titles'); + }); }; diff --git a/src/app.js b/src/app.js index c07f3cf4..f226742b 100755 --- a/src/app.js +++ b/src/app.js @@ -14,6 +14,7 @@ const http = require('./utils/http'); const logger = require('./logger')(__filename); const knex = require('./knex'); +const redis = require('./redis'); const fetchUpdates = require('./updates'); const { fetchScenes, fetchMovies } = require('./deep'); const { storeScenes, storeMovies, associateMovieScenes } = require('./store-releases'); @@ -212,6 +213,8 @@ async function init() { await http.destroyBrowserSessions(); knex.destroy(); + redis.disconnect(); + done = true; } diff --git a/src/scrapers/aziani.js b/src/scrapers/aziani.js index c43f231f..9656a11e 100755 --- a/src/scrapers/aziani.js +++ b/src/scrapers/aziani.js @@ -36,7 +36,7 @@ function scrapeAll(scenes, site) { }); } -function scrapeScene({ html, qu }, url) { +function scrapeScene({ html, qu }, url, channel) { const release = { url }; release.entryId = qu.q('.stdimage', 'id', true).match(/set-target-(\d+)/)[1]; @@ -58,7 +58,7 @@ function scrapeScene({ html, qu }, url) { const poster = qu.img('a img'); release.poster = getFallbacks(poster); - release.photos = qu.imgs('.featured-video img', 'src0_1x').map((source) => getFallbacks(source)); + release.caps = qu.imgs('.featured-video img', 'src0_1x', { origin: channel.url }).map((source) => getFallbacks(source)); return release; }