mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
adds movie packs handling and movies in series packs
This commit is contained in:
39
scrapers/manual/manual.js
Normal file
39
scrapers/manual/manual.js
Normal file
@@ -0,0 +1,39 @@
|
||||
require('dotenv').config();
|
||||
const repository = require('../../lib/repository');
|
||||
const { parseTorrentFiles } = require('../../lib/torrentFiles');
|
||||
const { Type } = require('../../lib/types');
|
||||
|
||||
async function addMissingEpisodes() {
|
||||
const torrent = { infoHash: '0ec780c2c7f8d5b38e61827f0b53c77c3d22f955' };
|
||||
const torrentFiles = await require('../../lib/torrent').torrentFiles(torrent);
|
||||
const storedFiles = await repository.getFiles(torrent)
|
||||
.then((files) => files.reduce((map, next) => (map[next.fileIndex] = next, map), {}));
|
||||
const imdbId = Object.values(storedFiles)[0].imdbId;
|
||||
|
||||
torrentFiles
|
||||
.filter((file) => !storedFiles[file.fileIndex])
|
||||
.map((file) => ({
|
||||
infoHash: torrent.infoHash,
|
||||
fileIndex: file.fileIndex,
|
||||
title: file.name,
|
||||
size: file.size,
|
||||
imdbId: imdbId,
|
||||
imdbSeason: parseInt(file.name.match(/(\d+)[ .]?-[ .]?\d+/)[1], 10),
|
||||
imdbEpisode: parseInt(file.name.match(/\d+[ .]?-[ .]?(\d+)/)[1], 10),
|
||||
}))
|
||||
.forEach((file) => repository.createFile(file));
|
||||
}
|
||||
|
||||
async function findAllFiles() {
|
||||
const torrent = {
|
||||
infoHash: '6b95e5cfde9aaa71970a14f6bb6b9de19e2cbfa1',
|
||||
title: '[OMDA] Bleach + Filmes + Ovas (480p-720p x264 AAC-MP3) [rich_jc]',
|
||||
type: Type.SERIES
|
||||
};
|
||||
const imdbId = 'tt0434665';
|
||||
|
||||
return parseTorrentFiles(torrent, imdbId).then((files) => console.log(files));
|
||||
}
|
||||
|
||||
//addMissingEpisodes().then(() => console.log('Finished'));
|
||||
findAllFiles().then(() => console.log('Finished'));
|
||||
@@ -20,7 +20,7 @@ const limiter = new Bottleneck({maxConcurrent: 40});
|
||||
async function scrape() {
|
||||
const lastScraped = await repository.getProvider({ name: NAME });
|
||||
const lastDump = { updatedAt: 2147000000 };
|
||||
const checkPoint = moment('2019-03-30 00:00:00', 'YYYY-MMM-DD HH:mm:ss').toDate();
|
||||
const checkPoint = moment('2016-06-17 00:00:00', 'YYYY-MMM-DD HH:mm:ss').toDate();
|
||||
//const lastDump = await pirata.dumps().then((dumps) => dumps.sort((a, b) => b.updatedAt - a.updatedAt)[0]);
|
||||
|
||||
if (!lastScraped.lastScraped || lastScraped.lastScraped < lastDump.updatedAt) {
|
||||
|
||||
Reference in New Issue
Block a user