mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
handles series type mismatch if is in movie category
This commit is contained in:
@@ -81,6 +81,10 @@ function getTorrent(torrent) {
|
||||
})
|
||||
}
|
||||
|
||||
function getTorrentsBasedOnTitle(titleQuery, type) {
|
||||
return Torrent.findAll({ where: { title: { [Op.regexp]: `${titleQuery}` }, type: type } });
|
||||
}
|
||||
|
||||
function createTorrent(torrent) {
|
||||
return Torrent.upsert(torrent);
|
||||
}
|
||||
@@ -133,8 +137,9 @@ module.exports = {
|
||||
connect,
|
||||
getProvider,
|
||||
updateProvider,
|
||||
getTorrent,
|
||||
createTorrent,
|
||||
getTorrent,
|
||||
getTorrentsBasedOnTitle,
|
||||
createFile,
|
||||
getFiles,
|
||||
getFilesBasedOnTitle,
|
||||
|
||||
@@ -8,6 +8,10 @@ async function createTorrentEntry(torrent) {
|
||||
const titleInfo = parse(torrent.title);
|
||||
const searchTitle = escapeTitle(titleInfo.title).toLowerCase();
|
||||
|
||||
if (titleInfo.seasons && torrent.type === Type.MOVIE) {
|
||||
// sometimes series torrent might be put into movies category
|
||||
torrent.type = Type.SERIES;
|
||||
}
|
||||
if (!torrent.imdbId && torrent.type !== Type.ANIME) {
|
||||
torrent.imdbId = await getImdbId({ name: searchTitle, year: titleInfo.year, type: torrent.type })
|
||||
.catch(() => undefined);
|
||||
|
||||
@@ -16,7 +16,7 @@ async function parseTorrentFiles(torrent) {
|
||||
// throw new Error(`Mismatching entry type for ${torrent.name}: ${torrent.type}!=${metadata.type}`);
|
||||
// }
|
||||
|
||||
if (torrent.type === Type.MOVIE) {
|
||||
if (torrent.type === Type.MOVIE && !parsedTorrentName.seasons) {
|
||||
if (parsedTorrentName.complete) {
|
||||
return torrentFiles(torrent)
|
||||
.then(files => files.filter(file => file.size > MIN_SIZE))
|
||||
|
||||
Reference in New Issue
Block a user