mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
refactor
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -80,7 +80,7 @@ export default function DialogCacheInfo(props) {
|
|||||||
prc = (cache.Pieces[i].Size / cache.Pieces[i].Length * 100).toFixed(2)
|
prc = (cache.Pieces[i].Size / cache.Pieces[i].Length * 100).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.Readers.forEach((r, k) => {
|
cache.Readers.forEach(r => {
|
||||||
if (i >= r.Start && i <= r.End && i !== r.Reader)
|
if (i >= r.Start && i <= r.End && i !== r.Reader)
|
||||||
cls += " reader-range"
|
cls += " reader-range"
|
||||||
if (i === r.Reader) {
|
if (i === r.Reader) {
|
||||||
@@ -123,6 +123,7 @@ export default function DialogCacheInfo(props) {
|
|||||||
<b>Status </b> {cache.Torrent && cache.Torrent.stat_string && cache.Torrent.stat_string}
|
<b>Status </b> {cache.Torrent && cache.Torrent.stat_string && cache.Torrent.stat_string}
|
||||||
</Typography>
|
</Typography>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div className="cache">
|
<div className="cache">
|
||||||
{pMap.map(itm => (
|
{pMap.map(itm => (
|
||||||
@@ -138,39 +139,39 @@ export default function DialogCacheInfo(props) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCacheMap(cache) {
|
// function getCacheMap(cache) {
|
||||||
if (!cache || !cache.PiecesCount) return ''
|
// if (!cache || !cache.PiecesCount) return ''
|
||||||
var html = ''
|
// var html = ''
|
||||||
for (let i = 0; i < cache.PiecesCount; i++) {
|
// for (let i = 0; i < cache.PiecesCount; i++) {
|
||||||
html += "<span class='piece"
|
// html += "<span class='piece"
|
||||||
let info = i
|
// let info = i
|
||||||
var prcDiv = ""
|
// var prcDiv = ""
|
||||||
if (cache.Pieces && cache.Pieces[i]) {
|
// if (cache.Pieces && cache.Pieces[i]) {
|
||||||
let prc = (cache.Pieces[i].Size / cache.Pieces[i].Length * 100).toFixed(2)
|
// let prc = (cache.Pieces[i].Size / cache.Pieces[i].Length * 100).toFixed(2)
|
||||||
let piece = cache.Pieces[i]
|
// let piece = cache.Pieces[i]
|
||||||
if (piece.Completed && piece.Size >= piece.Length) {
|
// if (piece.Completed && piece.Size >= piece.Length) {
|
||||||
html += ' piece-complete'
|
// html += ' piece-complete'
|
||||||
info += ' 100%'
|
// info += ' 100%'
|
||||||
} else {
|
// } else {
|
||||||
html += ' piece-loading'
|
// html += ' piece-loading'
|
||||||
info += ' ' + prc + '%'
|
// info += ' ' + prc + '%'
|
||||||
prcDiv = "<div class='piece-progress' style='height: " + prc + "%;'></div>"
|
// prcDiv = "<div class='piece-progress' style='height: " + prc + "%;'></div>"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
cache.Readers.forEach((r, k) => {
|
// cache.Readers.forEach((r, k) => {
|
||||||
if (i >= r.Start && i <= r.End && i !== r.Reader)
|
// if (i >= r.Start && i <= r.End && i !== r.Reader)
|
||||||
html += ' reader-range'
|
// html += ' reader-range'
|
||||||
if (i === r.Reader) {
|
// if (i === r.Reader) {
|
||||||
html += ' piece-reader'
|
// html += ' piece-reader'
|
||||||
info += ' reader'
|
// info += ' reader'
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
html += "' title='" + info + "'>"
|
// html += "' title='" + info + "'>"
|
||||||
html += prcDiv
|
// html += prcDiv
|
||||||
html += "</span>"
|
// html += "</span>"
|
||||||
}
|
// }
|
||||||
return html
|
// return html
|
||||||
}
|
// }
|
||||||
|
|
||||||
function getCache(hash, callback) {
|
function getCache(hash, callback) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user