Added movie URL file support. Fixed Gamma movie API scraper movie URL.

This commit is contained in:
DebaucheryLibrarian 2022-02-03 00:04:48 +01:00
parent 1dc38ffacc
commit 3d80e9d77b
4 changed files with 15 additions and 3 deletions

View File

@ -110,6 +110,8 @@ function initReleasesActions(store, router) {
$query: String! $query: String!
$limit:Int = 20 $limit:Int = 20
$offset:Int = 0 $offset:Int = 0
$hasAuth: Boolean!
$userId: Int
) { ) {
connection: searchMoviesConnection( connection: searchMoviesConnection(
query: $query query: $query
@ -126,6 +128,8 @@ function initReleasesActions(store, router) {
} }
} }
`, { `, {
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
query, query,
limit, limit,
offset: Math.max(0, (pageNumber - 1)) * limit, offset: Math.max(0, (pageNumber - 1)) * limit,

View File

@ -174,8 +174,11 @@ async function init() {
const storedScenes = argv.save ? await storeScenes(deepScenes) : []; const storedScenes = argv.save ? await storeScenes(deepScenes) : [];
const moviesFromFile = argv.moviesFile && await getFileEntries(argv.moviesFile);
const movieUrls = (argv.movie || []).concat(moviesFromFile || []);
const sceneMovies = deepScenes ? deepScenes.filter((scene) => scene.movie).map((scene) => ({ ...scene.movie, entity: scene.entity })) : []; const sceneMovies = deepScenes ? deepScenes.filter((scene) => scene.movie).map((scene) => ({ ...scene.movie, entity: scene.entity })) : [];
const deepMovies = argv.sceneMovies || argv.movie ? await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]) : sceneMovies; const deepMovies = argv.sceneMovies || argv.movie || movieUrls ? await fetchMovies([...movieUrls, ...(sceneMovies || []), ...[]]) : sceneMovies;
const movieScenes = argv.movieScenes ? deepMovies.map((movie) => movie.scenes?.map((scene) => ({ ...scene, movie, entity: movie.entity }))).flat().filter(Boolean) : []; const movieScenes = argv.movieScenes ? deepMovies.map((movie) => movie.scenes?.map((scene) => ({ ...scene, movie, entity: movie.entity }))).flat().filter(Boolean) : [];
const deepMovieScenes = argv.deep ? await fetchScenes(movieScenes) : movieScenes; const deepMovieScenes = argv.deep ? await fetchScenes(movieScenes) : movieScenes;

View File

@ -107,6 +107,11 @@ const { argv } = yargs
describe: 'Scrape movie info from URL', describe: 'Scrape movie info from URL',
type: 'array', type: 'array',
}) })
.option('movie-file', {
describe: 'Scrape movie info from URLs in a file',
type: 'string',
alias: 'movies-file',
})
.option('deep', { .option('deep', {
describe: 'Fetch details for all releases', describe: 'Fetch details for all releases',
type: 'boolean', type: 'boolean',

View File

@ -448,8 +448,8 @@ async function scrapeReleaseApi(data, site, options) {
if (data.cover_path) { if (data.cover_path) {
release.covers = [ release.covers = [
getImageSources(`/${data.cover_path}_front_400x625.jpg?width=450&height=636&format=webp`), getImageSources(`${data.cover_path}_front_400x625.jpg?width=450&height=636&format=webp`),
getImageSources(`/${data.cover_path}_back_400x625.jpg?width=450&height=636&format=webp`), getImageSources(`${data.cover_path}_back_400x625.jpg?width=450&height=636&format=webp`),
]; ];
} }