Skip to content

Commit

Permalink
Fix stat of seeding size of SoulVoice (#62)
Browse files Browse the repository at this point in the history
* fix: soulvoice seeding size

---------

Co-authored-by: lswl.in <[email protected]>
  • Loading branch information
EraserKing and vertex-app authored Aug 6, 2024
1 parent 8593e40 commit 6514ff1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions app/libs/site/SoulVoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,9 @@ class Site {
// 下载
info.leeching = +document.querySelector('img[class=arrowdown]').nextSibling.nodeValue.trim();
// 做种体积
const seedingDocument = await this._getDocument(`${this.index}getusertorrentlistajax.php?userid=${info.uid}&type=seeding`);
const seedingTorrent = [...seedingDocument.querySelectorAll('tr')];
seedingTorrent.shift();
info.seedingSize = 0;
for (const torrent of seedingTorrent) {
const siteStr = torrent.childNodes[3].innerHTML.replace('<br>', ' ').replace(/([KMGTP])B/, '$1iB');
info.seedingSize += util.calSize(...siteStr.split(' '));
}
const seedingDocument = await this._getDocument(`${this.index}getusertorrentlistajax.php?userid=${info.uid}&type=seeding`, true);
const seedingSize = (seedingDocument.match(/\uff1a(\d+\.\d+ [KMGTP]B)/) || [0, '0 B'])[1].replace(/([KMGTP])B/, '$1iB');
info.seedingSize = util.calSize(...seedingSize.split(' '));
return info;
};

Expand Down

0 comments on commit 6514ff1

Please sign in to comment.