mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'master' into 230-torrents-category
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
utils2 "server/utils"
|
||||
|
||||
"github.com/anacrolix/torrent"
|
||||
"github.com/anacrolix/torrent/metainfo"
|
||||
|
||||
@@ -266,7 +268,10 @@ func (t *Torrent) drop() {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Torrent) Close() {
|
||||
func (t *Torrent) Close() bool {
|
||||
if t.cache != nil && t.cache.GetUseReaders() > 0 {
|
||||
return false
|
||||
}
|
||||
t.Stat = state.TorrentClosed
|
||||
|
||||
t.bt.mu.Lock()
|
||||
@@ -274,6 +279,7 @@ func (t *Torrent) Close() {
|
||||
t.bt.mu.Unlock()
|
||||
|
||||
t.drop()
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *Torrent) Status() *state.TorrentStatus {
|
||||
@@ -329,7 +335,7 @@ func (t *Torrent) Status() *state.TorrentStatus {
|
||||
|
||||
files := t.Files()
|
||||
sort.Slice(files, func(i, j int) bool {
|
||||
return files[i].Path() < files[j].Path()
|
||||
return utils2.CompareStrings(files[i].Path(), files[j].Path())
|
||||
})
|
||||
for i, f := range files {
|
||||
st.FileStats = append(st.FileStats, &state.TorrentFileStat{
|
||||
|
||||
Reference in New Issue
Block a user