From 4dfd5cd15a0923203503416e9b877acc89e36530 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sun, 19 Aug 2018 19:43:46 +0300 Subject: [PATCH] fix(feed): fix check adding record on info table --- src/background/mysql.js | 7 ++++--- src/background/spider.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/background/mysql.js b/src/background/mysql.js index e072f5f..d4b7807 100644 --- a/src/background/mysql.js +++ b/src/background/mysql.js @@ -51,10 +51,11 @@ const expand = (sphinx) => { continue; if(typeof values[val] == 'object') - values[val] = JSON.stringify(values[val]) - + valuesData += sphinx.escape(JSON.stringify(values[val])) + ','; + else + valuesData += sphinx.escape(values[val]) + ','; + names += '`' + val + '`,'; - valuesData += sphinx.escape(values[val]) + ','; } names = names.slice(0, -1) valuesData = valuesData.slice(0, -1) diff --git a/src/background/spider.js b/src/background/spider.js index 6650a7e..27e6f1b 100644 --- a/src/background/spider.js +++ b/src/background/spider.js @@ -414,6 +414,16 @@ module.exports = function (send, recive, dataDirectory, version, env) delete torrent.contenttype; } + if(torrent.info && typeof torrent.info == 'string') + { + try { + torrent.info = JSON.parse(torrent.info) + } catch(err) { + logT('add', 'problem with info torrent parse for torrent', torrent.name, 'just ignore') + delete torrent.info + } + } + // clean download info if added if(torrent.download) delete torrent.download @@ -529,6 +539,7 @@ module.exports = function (send, recive, dataDirectory, version, env) piecelength: torrent.piecelength, contentType: torrent.contentType, contentCategory: torrent.contentCategory, + info: torrent.info, }); updateTorrentTrackers(torrent.hash); remoteTrackers.update(torrent)