mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
add bitrate to torr status
This commit is contained in:
@@ -3,6 +3,8 @@ package torr
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"server/ffprobe"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -63,8 +65,16 @@ func (t *Torrent) Preload(index int, size int64) {
|
||||
}
|
||||
}()
|
||||
|
||||
if ffprobe.Exists() {
|
||||
host := "http://127.0.0.1:" + settings.Port + "/stream?link=" + t.Hash().HexString() + "&index=" + strconv.Itoa(index) + "&play"
|
||||
if data, err := ffprobe.ProbeUrl(host); err == nil {
|
||||
t.BitRate = data.Format.BitRate
|
||||
t.DurationSeconds = data.Format.DurationSeconds
|
||||
}
|
||||
}
|
||||
|
||||
// startend -> 8/16 MB
|
||||
startend := int64(t.Info().PieceLength)
|
||||
startend := t.Info().PieceLength
|
||||
if startend < 8*1024*1024 {
|
||||
startend = 8 * 1024 * 1024
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user