Added reindex command

This commit is contained in:
zeldaroot 2021-04-21 20:19:36 +03:00
parent 3df7af574a
commit 7fa2f465b0
4 changed files with 27 additions and 15 deletions

View File

@ -2917,13 +2917,13 @@ while [ "${WHILE}" -lt "2" ]; do
docker exec "${CP_DOMAIN_}" /usr/bin/cinemapress container movies
exit 0
;;
"reload"|"actual"|"available"|"speed"|"cron" )
"reload"|"actual"|"available"|"reindex"|"speed"|"cron" )
_br "${2}"
read_domain "${2}"
sh_not
_s "${2}"
docker exec "${CP_DOMAIN_}" /usr/bin/cinemapress container "${1}" "${3}" \
>>/var/log/docker_"${1}"_"$(date '+%d_%m_%Y')".log 2>&1
docker exec "${CP_DOMAIN_}" /usr/bin/cinemapress container "${1}" "${3}"
_br
exit 0
;;
"container" )
@ -2953,7 +2953,7 @@ while [ "${WHILE}" -lt "2" ]; do
docker_actual
elif [ "${2}" = "mirror" ]; then
docker_mirror
elif [ "${2}" = "available" ]; then
elif [ "${2}" = "available" ] [ "${2}" = "reindex" ]; then
docker_available "${3}"
elif [ "${2}" = "passwd" ]; then
docker_passwd "${3}"

View File

@ -94,6 +94,7 @@ async.series(
i,
false,
function(err, movies) {
console.log('PAGE', i, '(', (i - 1) * 500, '-', i * 500, ')');
i++;
if (err) {
console.error(err);
@ -105,7 +106,10 @@ async.series(
1,
function(movie, key, callback) {
CP_get.movies(
{ query_id: movie.query_id },
{
from: process.env.CP_RT,
ids: movie.query_id
},
1,
'',
1,
@ -122,7 +126,7 @@ async.series(
return callback(err);
});
} else {
console.log('NOT AVAILABLE:', movie.query_id);
console.log('NOT INDEX ID:', movie.query_id);
not_available++;
return callback();
}
@ -134,6 +138,9 @@ async.series(
},
function(err) {
if (err) console.error(err);
if (movies.length !== 500) {
return next('STOP');
}
return next();
}
);
@ -145,9 +152,11 @@ async.series(
},
function() {
if (not_available) {
console.log('NOT AVAILABLE', not_available, 'MOVIES');
console.log('');
console.log('NOT AVAILABLE', not_available, 'IDs');
} else {
console.log('ALL MOVIES AVAILABLE');
console.log('');
console.log('ALL MOVIES INDEXED');
}
return callback();
}

View File

@ -2666,17 +2666,17 @@ function saveData(collection, movies, callback) {
CP_save.save(rt, 'rt', function(save_e) {
setTimeout(function() {
CP_get.movies(
{ id: rt.id + '' },
{
from: process.env.CP_RT,
ids: rt.id
},
1,
'',
1,
false,
function(get_e, available) {
if (err || !available || !available.length) {
console.log(
rt.id,
'SAVE: ' + save_e + ' GET: ' + get_e
);
console.log(rt.id, 'CRASH INDEXER!');
} else {
saved[rt.id] = 1;
console.log(

View File

@ -247,8 +247,11 @@ function moviesGet(query, count, sorting, page, structure, options, callback) {
delete query.id_where;
} else if (query.ids) {
q._select = '*';
q._where =
"`all_movies` = '_" + config.domain.replace(/[^a-z0-9]/g, '_') + "_'";
if (typeof query.ids === 'string') {
q._where = "MATCH('@query_id (" + query.ids + ")')";
} else {
q._where = '';
}
delete query.ids;
} else {
q._where = createWhere() + q._where;