mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix preload with ffprobe
This commit is contained in:
@@ -66,7 +66,7 @@ func (t *Torrent) Preload(index int, size int64) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if ffprobe.Exists() {
|
if ffprobe.Exists() {
|
||||||
host := "http://127.0.0.1:" + settings.Port + "/stream?link=" + t.Hash().HexString() + "&index=" + strconv.Itoa(index) + "&play"
|
host := "http://127.0.0.1:" + settings.Port + "/play/" + t.Hash().HexString() + "/" + strconv.Itoa(index) // + "&play"
|
||||||
if data, err := ffprobe.ProbeUrl(host); err == nil {
|
if data, err := ffprobe.ProbeUrl(host); err == nil {
|
||||||
t.BitRate = data.Format.BitRate
|
t.BitRate = data.Format.BitRate
|
||||||
t.DurationSeconds = data.Format.DurationSeconds
|
t.DurationSeconds = data.Format.DurationSeconds
|
||||||
|
|||||||
@@ -119,9 +119,15 @@ func (t *Torrent) WaitInfo() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) GotInfo() bool {
|
func (t *Torrent) GotInfo() bool {
|
||||||
|
// log.TLogln("GotInfo state:", t.Stat)
|
||||||
if t.Stat == state.TorrentClosed {
|
if t.Stat == state.TorrentClosed {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
// assume we have info in preload state
|
||||||
|
// and dont override with TorrentWorking
|
||||||
|
if t.Stat == state.TorrentPreload {
|
||||||
|
return true
|
||||||
|
}
|
||||||
t.Stat = state.TorrentGettingInfo
|
t.Stat = state.TorrentGettingInfo
|
||||||
if t.WaitInfo() {
|
if t.WaitInfo() {
|
||||||
t.Stat = state.TorrentWorking
|
t.Stat = state.TorrentWorking
|
||||||
@@ -250,11 +256,11 @@ func (t *Torrent) GetCache() *torrstor.Cache {
|
|||||||
|
|
||||||
func (t *Torrent) drop() {
|
func (t *Torrent) drop() {
|
||||||
t.muTorrent.Lock()
|
t.muTorrent.Lock()
|
||||||
|
defer t.muTorrent.Unlock()
|
||||||
if t.Torrent != nil {
|
if t.Torrent != nil {
|
||||||
t.Torrent.Drop()
|
t.Torrent.Drop()
|
||||||
t.Torrent = nil
|
t.Torrent = nil
|
||||||
}
|
}
|
||||||
t.muTorrent.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) Close() {
|
func (t *Torrent) Close() {
|
||||||
|
|||||||
Reference in New Issue
Block a user