reformat peers info

This commit is contained in:
nikk gitanes
2024-02-22 10:38:14 +03:00
parent 4d2fd19f65
commit 26e7956ef9
9 changed files with 13 additions and 12 deletions

View File

@@ -45,7 +45,7 @@ func Start(port, sslport, sslCert, sslKey string, sslEnabled, roSets, searchWA b
l.Close() l.Close()
} }
if err != nil { if err != nil {
log.TLogln("Port", sslport, "already in use! Please set different port for HTTPS. Abort") log.TLogln("Port", sslport, "already in use! Please set different ssl port for HTTPS. Abort")
os.Exit(1) os.Exit(1)
} }
} }
@@ -59,7 +59,7 @@ func Start(port, sslport, sslCert, sslKey string, sslEnabled, roSets, searchWA b
l.Close() l.Close()
} }
if err != nil { if err != nil {
log.TLogln("Port", port, "already in use! Please set different sslport for HTTP. Abort") log.TLogln("Port", port, "already in use! Please set different port for HTTP. Abort")
os.Exit(1) os.Exit(1)
} }
// remove old disk caches // remove old disk caches

View File

@@ -62,7 +62,7 @@ func (t *Torrent) Preload(index int, size int64) {
// Запуск лога в отдельном потоке // Запуск лога в отдельном потоке
go func() { go func() {
for t.Stat == state.TorrentPreload { for t.Stat == state.TorrentPreload {
stat := fmt.Sprint(file.Torrent().InfoHash().HexString(), " ", utils2.Format(float64(t.PreloadedBytes)), "/", utils2.Format(float64(t.PreloadSize)), " Speed:", utils2.Format(t.DownloadSpeed), " Peers:[", t.Torrent.Stats().ConnectedSeeders, "]", t.Torrent.Stats().ActivePeers, "/", t.Torrent.Stats().TotalPeers) stat := fmt.Sprint(file.Torrent().InfoHash().HexString(), " ", utils2.Format(float64(t.PreloadedBytes)), "/", utils2.Format(float64(t.PreloadSize)), " Speed:", utils2.Format(t.DownloadSpeed), " Peers:", t.Torrent.Stats().ActivePeers, "/", t.Torrent.Stats().TotalPeers, " [Seeds:", t.Torrent.Stats().ConnectedSeeders, "]")
log.TLogln("Preload:", stat) log.TLogln("Preload:", stat)
t.AddExpiredTime(time.Second * time.Duration(settings.BTsets.TorrentDisconnectTimeout)) t.AddExpiredTime(time.Second * time.Duration(settings.BTsets.TorrentDisconnectTimeout))
time.Sleep(time.Second) time.Sleep(time.Second)
@@ -158,7 +158,7 @@ func (t *Torrent) Preload(index int, size int64) {
wg.Wait() wg.Wait()
} }
log.TLogln("End preload:", file.Torrent().InfoHash().HexString(), "Peers:[", t.Torrent.Stats().ConnectedSeeders, "]", t.Torrent.Stats().ActivePeers, "/", t.Torrent.Stats().TotalPeers) log.TLogln("End preload:", file.Torrent().InfoHash().HexString(), "Peers:", t.Torrent.Stats().ActivePeers, "/", t.Torrent.Stats().TotalPeers, "[ Seeds:", t.Torrent.Stats().ConnectedSeeders, "]")
} }
func (t *Torrent) findFileIndex(index int) *torrent.File { func (t *Torrent) findFileIndex(index int) *torrent.File {

View File

@@ -51,7 +51,7 @@ export const PeersWidget = ({ data }) => {
return ( return (
<StatisticsField <StatisticsField
title={t('Peers')} title={t('Peers')}
value={getPeerString(data) || '0 · 0 / 0'} value={getPeerString(data) || '0 / 0 · 0'}
iconBg={iconBGColor} iconBg={iconBGColor}
valueBg={valueBGColor} valueBg={valueBGColor}
icon={SwapVerticalCircleIcon} icon={SwapVerticalCircleIcon}

View File

@@ -72,7 +72,7 @@
"Offline": "Извън линия", "Offline": "Извън линия",
"OK": "OK", "OK": "OK",
"OpenLink": "Отвори линк", "OpenLink": "Отвори линк",
"Peers": "Пиъри", "Peers": "Пиъри·Сийдъри",
"PiecesCount": "Брой парчета", "PiecesCount": "Брой парчета",
"PiecesLength": "Дължина на парчетата", "PiecesLength": "Дължина на парчетата",
"Playlist": "Плейлист", "Playlist": "Плейлист",

View File

@@ -72,7 +72,7 @@
"Offline": "Offline", "Offline": "Offline",
"OK": "OK", "OK": "OK",
"OpenLink": "Open link", "OpenLink": "Open link",
"Peers": "Peers", "Peers": "Peers·Seeds",
"PiecesCount": "Pieces count", "PiecesCount": "Pieces count",
"PiecesLength": "Pieces length", "PiecesLength": "Pieces length",
"Playlist": "Playlist", "Playlist": "Playlist",

View File

@@ -72,7 +72,7 @@
"Offline": "Сервер недоступен", "Offline": "Сервер недоступен",
"OK": "OK", "OK": "OK",
"OpenLink": "Открыть", "OpenLink": "Открыть",
"Peers": "Пиры", "Peers": "Пиры·Сиды",
"PiecesCount": "Кол-во блоков", "PiecesCount": "Кол-во блоков",
"PiecesLength": "Размер блока", "PiecesLength": "Размер блока",
"Playlist": "Плейлист", "Playlist": "Плейлист",

View File

@@ -72,7 +72,7 @@
"Offline": "Сервер не доступний", "Offline": "Сервер не доступний",
"OK": "OK", "OK": "OK",
"OpenLink": "Відкрити", "OpenLink": "Відкрити",
"Peers": "Піри", "Peers": "Піри·Сіди",
"PiecesCount": "К-сть блоків", "PiecesCount": "К-сть блоків",
"PiecesLength": "Розмір блоку", "PiecesLength": "Розмір блоку",
"Playlist": "Плейлист", "Playlist": "Плейлист",

View File

@@ -72,7 +72,7 @@
"Offline": "离线", "Offline": "离线",
"OK": "确定", "OK": "确定",
"OpenLink": "打开链接", "OpenLink": "打开链接",
"Peers": "Peers", "Peers": "Peers·Seeds",
"PiecesCount": "块数量", "PiecesCount": "块数量",
"PiecesLength": "块长度", "PiecesLength": "块长度",
"Playlist": "播放列表", "Playlist": "播放列表",

View File

@@ -20,8 +20,9 @@ export function humanizeSpeed(speed) {
} }
export function getPeerString(torrent) { export function getPeerString(torrent) {
if (!torrent || !torrent.connected_seeders) return null if (!torrent || !torrent.active_peers) return null
return `${torrent.connected_seeders} · ${torrent.active_peers} / ${torrent.total_peers}` const seeders = typeof torrent.connected_seeders !== 'undefined' ? torrent.connected_seeders : 0
return `${torrent.active_peers} / ${torrent.total_peers} · ${seeders}`
} }
export const shortenText = (text, sympolAmount) => export const shortenText = (text, sympolAmount) =>