mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
update
This commit is contained in:
@@ -3,10 +3,11 @@ package torr
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent"
|
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
|
||||||
"server/log"
|
"server/log"
|
||||||
sets "server/settings"
|
sets "server/settings"
|
||||||
|
|
||||||
|
"github.com/anacrolix/torrent"
|
||||||
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -24,11 +25,19 @@ func AddTorrent(spec *torrent.TorrentSpec, title, poster string) (*Torrent, erro
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
torDB := GetTorrentDB(spec.InfoHash)
|
||||||
|
|
||||||
if torr.Title == "" {
|
if torr.Title == "" {
|
||||||
torr.Title = title
|
torr.Title = title
|
||||||
|
if title == "" && torDB != nil {
|
||||||
|
torr.Title = torDB.Title
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if torr.Poster == "" {
|
if torr.Poster == "" {
|
||||||
torr.Poster = poster
|
torr.Poster = poster
|
||||||
|
if torr.Poster == "" && torDB != nil {
|
||||||
|
torr.Poster = torDB.Poster
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if torr.Title == "" {
|
if torr.Title == "" {
|
||||||
@@ -75,7 +84,11 @@ func ListTorrent() []*Torrent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(ret, func(i, j int) bool {
|
sort.Slice(ret, func(i, j int) bool {
|
||||||
|
if ret[i].Timestamp != ret[j].Timestamp {
|
||||||
return ret[i].Timestamp > ret[j].Timestamp
|
return ret[i].Timestamp > ret[j].Timestamp
|
||||||
|
} else {
|
||||||
|
return ret[i].Title > ret[j].Title
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -34,28 +34,21 @@ type TorrentStatus struct {
|
|||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Poster string `json:"poster"`
|
Poster string `json:"poster"`
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Hash string `json:"hash,omitempty"`
|
Hash string `json:"hash,omitempty"`
|
||||||
|
|
||||||
Stat TorrentStat `json:"stat"`
|
Stat TorrentStat `json:"stat"`
|
||||||
StatString string `json:"stat_string"`
|
StatString string `json:"stat_string"`
|
||||||
|
|
||||||
LoadedSize int64 `json:"loaded_size,omitempty"`
|
LoadedSize int64 `json:"loaded_size,omitempty"`
|
||||||
TorrentSize int64 `json:"torrent_size,omitempty"`
|
TorrentSize int64 `json:"torrent_size,omitempty"`
|
||||||
|
|
||||||
PreloadedBytes int64 `json:"preloaded_bytes,omitempty"`
|
PreloadedBytes int64 `json:"preloaded_bytes,omitempty"`
|
||||||
PreloadSize int64 `json:"preload_size,omitempty"`
|
PreloadSize int64 `json:"preload_size,omitempty"`
|
||||||
|
|
||||||
DownloadSpeed float64 `json:"download_speed,omitempty"`
|
DownloadSpeed float64 `json:"download_speed,omitempty"`
|
||||||
UploadSpeed float64 `json:"upload_speed,omitempty"`
|
UploadSpeed float64 `json:"upload_speed,omitempty"`
|
||||||
|
|
||||||
TotalPeers int `json:"total_peers,omitempty"`
|
TotalPeers int `json:"total_peers,omitempty"`
|
||||||
PendingPeers int `json:"pending_peers,omitempty"`
|
PendingPeers int `json:"pending_peers,omitempty"`
|
||||||
ActivePeers int `json:"active_peers,omitempty"`
|
ActivePeers int `json:"active_peers,omitempty"`
|
||||||
ConnectedSeeders int `json:"connected_seeders,omitempty"`
|
ConnectedSeeders int `json:"connected_seeders,omitempty"`
|
||||||
HalfOpenPeers int `json:"half_open_peers,omitempty"`
|
HalfOpenPeers int `json:"half_open_peers,omitempty"`
|
||||||
|
|
||||||
BytesWritten int64 `json:"bytes_written,omitempty"`
|
BytesWritten int64 `json:"bytes_written,omitempty"`
|
||||||
BytesWrittenData int64 `json:"bytes_written_data,omitempty"`
|
BytesWrittenData int64 `json:"bytes_written_data,omitempty"`
|
||||||
BytesRead int64 `json:"bytes_read,omitempty"`
|
BytesRead int64 `json:"bytes_read,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user