Fixed custom field

This commit is contained in:
zeldaroot 2021-03-26 23:55:16 +02:00
parent aea4cd3240
commit 1accbc8594
3 changed files with 28 additions and 18 deletions

View file

@ -186,8 +186,14 @@ if (Math.ceil(os.freemem()) < 50) {
if (lastmod_stop) {
return next('STOP');
}
var q = {};
q.certainly = true;
q.from =
(task.page === 'xmlpipe2' ? 'xmlpipe2' : 'rt') +
'_' +
config.domain.replace(/[^a-z0-9]/g, '_');
CP_get.movies(
{ certainly: true },
q,
100,
task.page === 'lastmod' ? 'lastmod' : 'kinopoisk-id-up',
i,
@ -1068,9 +1074,11 @@ if (Math.ceil(os.freemem()) < 50) {
op.set(movie, parse[1], set_data);
});
if (movie['custom'] && typeof movie['custom'] === 'object') {
movie['custom']['unique'] =
movie['custom']['unique'] === true ||
movie['custom']['unique'] === 'true';
if (typeof movie['custom']['unique'] !== 'undefined') {
movie['custom']['unique'] =
movie['custom']['unique'] === true ||
movie['custom']['unique'] === 'true';
}
if (movie['custom']['imdb_id']) {
movie['custom']['imdb_id'] = movie['custom'][
'imdb_id'
@ -1092,7 +1100,7 @@ if (Math.ceil(os.freemem()) < 50) {
}
});
} else {
movie['custom'] = { unique: false };
movie['custom'] = {};
}
if (
movie['title_ru'] &&

View file

@ -445,7 +445,7 @@ router.all('/', function(req, res) {
parseInt(req.query['kp_id'].replace(/[^0-9]/g, '')) + '') ||
(req.body &&
req.body['kinopoisk'] &&
parseInt(req.body['kinopoisk'].replace(/[^0-9]/g, '')))
parseInt(req.body['kinopoisk'].replace(/[^0-9]/g, '')) + '')
});
}
if (

View file

@ -165,18 +165,20 @@ router.get('/:id', function(req, res) {
movie.custom = {};
}
var player = CP_player.code('movie', movie);
player.player = player.player.replace(
'data-player=',
'data-url="' +
origin +
'/api?' +
(id_key || 'kp_id') +
'=' +
id_value +
'&type=' +
movie.type +
'&player" data-player='
);
player.player = player.player
.replace(/data-url="[^"]*"/, '')
.replace(
'data-player=',
'data-url="' +
origin +
'/api?' +
(id_key || 'kp_id') +
'=' +
id_value +
'&type=' +
movie.type +
'&player" data-player='
);
return res.send(
'<!DOCTYPE html><html lang="' +
config.language +