diff --git a/src/app/torrent-page.js b/src/app/torrent-page.js
index 243de8a..dd183e8 100644
--- a/src/app/torrent-page.js
+++ b/src/app/torrent-page.js
@@ -22,11 +22,13 @@ import TrackersImages from './trackers-images'
let parseDescriptionText = (text) => {
return text.split("\n").map(function(item) {
- const text = /([A-Za-zА-Яа-я]+:) (.+)/.exec(item)
+ const text = /(.+?:)(.*)/.exec(item)
return (
- {text ? {`${text[1]} `}{text[2]} : item}
+ {
+ text ? {`${text[1]} `}{text[2]} : item
+ }
)
@@ -106,7 +108,7 @@ const TorrentInformation = (props) => {
//leftAvatar={} backgroundColor={blue500} />}
rightIcon={}
primaryText={__('Torrent Name')}
- secondaryText={{torrent.name}}
+ secondaryText={{(torrent.info && torrent.info.name) || torrent.name}}
/>
} backgroundColor={yellow600} />}
@@ -144,7 +146,7 @@ const TorrentInformation = (props) => {
// leftAvatar={} backgroundColor={yellow600} />}
rightIcon={}
primaryText={__('Category')}
- secondaryText={torrent.contentCategory || 'unknown'}
+ secondaryText={(torrent.info && torrent.info.contentCategory) || torrent.contentCategory || 'unknown'}
/>
);
@@ -202,9 +204,9 @@ export default class TorrentPage extends Page {
//this.forceUpdate(); // вызывается через searchingIndicator
// Получаем более новую статистику пира
- if((Date.now() / 1000) - this.torrent.trackersChecked > 10 * 60) {
+ if((Date.now() / 1000) - this.torrent.trackersChecked > 10 * 60) {
window.torrentSocket.emit('checkTrackers', this.torrent.hash);
- }
+ }
}
}, () => {
this.setState({
diff --git a/src/background/strategies/rutracker.js b/src/background/strategies/rutracker.js
index b1badf3..0493b0d 100644
--- a/src/background/strategies/rutracker.js
+++ b/src/background/strategies/rutracker.js
@@ -23,15 +23,24 @@ module.exports = class Rutracker
if(!html)
return
html = await html.textConverted()
+ html = html.replace(/\/g, '\n')
+ html = html.replace(/\>/g, '>\n')
const $ = cheerio.load(html)
const topicTitle = $('#topic-title').text()
if(!topicTitle)
return
+
+ let contentCategory;
+ try {
+ contentCategory = $('.vBottom .nav').text().replace(/[\t]+/g, '').replace(/[\n]+/g, ' ').trim()
+ } catch(er) {}
+
return {
name: topicTitle,
- poster: $('.post_body .postImgAligned').attr('title'),
+ poster: $('.post_body .postImgAligned').attr('title') || $('.post_body .postImg').attr('title'),
description: $('.post_body').first().text(),
rutrackerThreadId: parseInt($('a.magnet-link').attr('data-topic_id')),
+ contentCategory
}
}
}
\ No newline at end of file
diff --git a/tests/strategies/rutracker.test.js b/tests/strategies/rutracker.test.js
index 0caf117..20fcdb9 100644
--- a/tests/strategies/rutracker.test.js
+++ b/tests/strategies/rutracker.test.js
@@ -21,5 +21,6 @@ describe("rutracker", () => {
assert.equal(data.poster, 'http://i44.fastpic.ru/big/2012/1018/a2/4e8740f608387b32b74c5deea72d05a2.jpg')
assert.equal(data.rutrackerThreadId, 4220109)
assert(data.description.includes('выхода'))
+ assert.equal(data.contentCategory, 'Главная » Рок-музыка » Зарубежный Metal » Death, Doom (lossy)')
})
});