forked from DebaucheryLibrarian/traxxx
Improved module structure. Added individual scene scrapers for Jules Jordan and XEmpire.
This commit is contained in:
@@ -11,15 +11,17 @@ const formatters = {
|
||||
return '\x1b[90mNot available\x1b[0m';
|
||||
}
|
||||
|
||||
if (rating.stars === null) {
|
||||
if ((rating.likes === 0 && rating.dislikes === 0) || rating.stars === 0) {
|
||||
return '\x1b[90mUnrated\x1b[0m';
|
||||
}
|
||||
|
||||
if (rating.likes === null || rating.dislikes === null) {
|
||||
if (rating.stars) {
|
||||
return `\x1b[93m★ ${rating.stars.toFixed(2)}\x1b[0m`;
|
||||
}
|
||||
|
||||
return `\x1b[93m★\x1b[0m ${rating.stars.toFixed(2)} \x1b[92m▲\x1b[0m ${String(rating.likes).padEnd(3)} \x1b[31m▼\x1b[0m ${String(rating.dislikes).padEnd(3)}`;
|
||||
const stars = rating.likes || rating.dislikes ? Math.floor(((rating.likes * 5 + rating.dislikes) / (rating.likes + rating.dislikes)) * 100) / 100 : null;
|
||||
|
||||
return `\x1b[93m★\x1b[0m ${stars.toFixed(2)} \x1b[92m▲\x1b[0m ${String(rating.likes).padEnd(3)} \x1b[31m▼\x1b[0m ${String(rating.dislikes).padEnd(3)}`;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ const config = require('config');
|
||||
const blessed = require('neo-blessed');
|
||||
const moment = require('moment');
|
||||
const opn = require('opn');
|
||||
const clipboard = require('clipboardy');
|
||||
|
||||
const argv = require('../argv');
|
||||
const formatters = require('./formatters');
|
||||
|
||||
function render(scenes, screen) {
|
||||
function renderReleases(scenes, screen) {
|
||||
const tableTop = blessed.Text({
|
||||
content: config.columns.reduce((acc, column, index) => `${acc}${'─'.repeat(column.width)}${index < config.columns.length - 1 ? '┬' : '┐\x1b[0m'}`, '\x1b[30m┌'),
|
||||
});
|
||||
@@ -102,4 +104,15 @@ function render(scenes, screen) {
|
||||
screen.render();
|
||||
}
|
||||
|
||||
module.exports = render;
|
||||
function renderScene(scene, _screen) {
|
||||
console.log(scene);
|
||||
|
||||
if (argv.copy) {
|
||||
clipboard.writeSync(scene.filename);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
renderReleases,
|
||||
renderScene,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user