UNPKG

@airplanegobrr/jackett-api

Version:
66 lines 4.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RssResultModel = void 0; class RssResultModel { constructor(_indexerId, _indexerName, _title, _publishDate, _category, _downloadLink, /** _size Size of the torrent content **/ _size, _fileCount, _grabs, _seeders, _peers) { this._indexerId = _indexerId; this._indexerName = _indexerName; this._title = _title; this._publishDate = _publishDate; this._category = _category; this._downloadLink = _downloadLink; this._size = _size; this._fileCount = _fileCount; this._grabs = _grabs; this._seeders = _seeders; this._peers = _peers; } get indexerId() { return this._indexerId; } get indexerName() { return this._indexerName; } get title() { return this._title; } get publishDate() { return this._publishDate; } get category() { return this._category; } get downloadLink() { return this._downloadLink; } get size() { return this._size; } get fileCount() { return this._fileCount; } get grabs() { return this._grabs; } get seeders() { return this._seeders; } get peers() { return this._peers; } static fromJson(data) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; const torznabData = {}; (_a = data["torznab:attr"]) === null || _a === void 0 ? void 0 : _a.forEach((torznabDataItem) => { var _a, _b, _c, _d; return Object.assign(torznabData, { [(_b = (_a = torznabDataItem === null || torznabDataItem === void 0 ? void 0 : torznabDataItem.$) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "unknown"]: (_d = (_c = torznabDataItem === null || torznabDataItem === void 0 ? void 0 : torznabDataItem.$) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : "0", }); }); return new RssResultModel((_e = (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data.jackettindexer) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.$) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : "unknown", (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.jackettindexer) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g._) !== null && _h !== void 0 ? _h : "unknown", (_k = (_j = data === null || data === void 0 ? void 0 : data.title) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : "Untitled", new Date((_m = (_l = data === null || data === void 0 ? void 0 : data.pubDate) === null || _l === void 0 ? void 0 : _l[0]) !== null && _m !== void 0 ? _m : Date.now()), (_o = data === null || data === void 0 ? void 0 : data.category) !== null && _o !== void 0 ? _o : [], (_s = (_r = (_q = (_p = data === null || data === void 0 ? void 0 : data.enclosure) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.$) === null || _r === void 0 ? void 0 : _r.url) !== null && _s !== void 0 ? _s : "", Number((_w = (_v = (_u = (_t = data === null || data === void 0 ? void 0 : data.enclosure) === null || _t === void 0 ? void 0 : _t[0]) === null || _u === void 0 ? void 0 : _u.$) === null || _v === void 0 ? void 0 : _v.length) !== null && _w !== void 0 ? _w : 0), Number((_y = (_x = data === null || data === void 0 ? void 0 : data.files) === null || _x === void 0 ? void 0 : _x[0]) !== null && _y !== void 0 ? _y : 0), Number((_0 = (_z = data === null || data === void 0 ? void 0 : data.grabs) === null || _z === void 0 ? void 0 : _z[0]) !== null && _0 !== void 0 ? _0 : 0), Number((_1 = torznabData["seeders"]) !== null && _1 !== void 0 ? _1 : 0), Number((_2 = torznabData["peers"]) !== null && _2 !== void 0 ? _2 : 0)); } } exports.RssResultModel = RssResultModel; //# sourceMappingURL=rss-result.model.js.map