mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix sort/id bug
This commit is contained in:
@@ -385,16 +385,19 @@ func (t *Torrent) Stats() TorrentStats {
|
|||||||
st.ConnectedSeeders = tst.ConnectedSeeders
|
st.ConnectedSeeders = tst.ConnectedSeeders
|
||||||
st.HalfOpenPeers = tst.HalfOpenPeers
|
st.HalfOpenPeers = tst.HalfOpenPeers
|
||||||
|
|
||||||
for i, f := range t.Files() {
|
files := t.Files()
|
||||||
|
|
||||||
|
sort.Slice(files, func(i, j int) bool {
|
||||||
|
return files[i].Path() < files[j].Path()
|
||||||
|
})
|
||||||
|
|
||||||
|
for i, f := range files {
|
||||||
st.FileStats = append(st.FileStats, TorrentFileStat{
|
st.FileStats = append(st.FileStats, TorrentFileStat{
|
||||||
Id: i,
|
Id: i,
|
||||||
Path: f.Path(),
|
Path: f.Path(),
|
||||||
Length: f.Length(),
|
Length: f.Length(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sort.Slice(st.FileStats, func(i, j int) bool {
|
|
||||||
return st.FileStats[i].Path < st.FileStats[j].Path
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return st
|
return st
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user