UNPKG

wakitsu

Version:

Hobby project for managing anime watch list on Kitsu through CLI

77 lines 2.71 kB
import { CLI, CLIFlag } from '../cli.js'; import * as rss from '../../rss.js'; import { Printer } from '../../printer/printer.js'; export class RSSFeedFlag extends CLIFlag { name = ['rss', 'rss-feed']; type = 'multiArg'; helpAliases = [ ...this.name, 'rss', 'feed', 'get rss', 'find rss', 'search rss', 'lookup rss', ]; getHelpLogs() { return [ ['h1', ['RSS Feed']], [ 'p', 'Searches ;x;nyaa.si ;bk;using your provided search terms. This results ' + 'in the number of torrents found, file-name of the latest torrent and ' + 'an RSS feed link.', ], null, [ 'p', ';m;NOTE: ;bk;This allows you to quickly set up RSS for your torrents to be ' + 'downloaded automatically. The number of entries should clue you in on ' + 'whether or not you need to refine your search.', ], null, ]; } getSyntaxHelpLogs() { return [ ['h2', ['Usage']], ['s', ['rss', 'rss-feed'], '<name>'], null, ['h2', ['Details']], ['d', ['name', 'The exact name or partial name of any anime.']], null, ['h2', ['Examples']], ['e', ['rss', 'subsplease bou no hero 1080p']], ['e', ['rss-feed', 'asw berserk 720p']], ]; } async exec() { const stopLoader = Printer.printLoader('RSS Lookup'); const [error, result] = await rss.getFansubRSS(CLI.nonFlagArgs.join(' ')); stopLoader(); if (error && !result) { Printer.printError([`;bc;${error.parseError}`, '', `Failed to parse: ;x;${error.fileName}`], 'Unsupported', 3); return; } if (!error && !result) { Printer.printInfo('Anime Not Found', undefined, 3); return; } Printer.print([ null, ['h2', ['Details']], ['py', ['Query', `;g;${CLI.nonFlagArgs.join(' ')}`], 2], ['py', ['Entries', `${result.entryCount}`]], ['', `;c;RSS: ;x;${result.rss}`, 7], ['', `;c;Raw: ;y;${result.raw}`, 7], null, ['h2', ['Latest Entry']], ['py', ['Title', `${result.title}`], 2], ['py', ['FanSub', `${result.fansub}`], 1], ['py', ['Episode', `${result.episode}`]], ['py', ['Season', `${result.season ?? ';m;unspecified'}`], 1], null, ]); } } //# sourceMappingURL=flag-rss-feed.js.map