mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
update
This commit is contained in:
@@ -58,6 +58,9 @@ func ListViewed(hash string) []*Viewed {
|
|||||||
var err error
|
var err error
|
||||||
if hash != "" {
|
if hash != "" {
|
||||||
buf := tdb.Get("Viewed", hash)
|
buf := tdb.Get("Viewed", hash)
|
||||||
|
if len(buf) == 0 {
|
||||||
|
return []*Viewed{}
|
||||||
|
}
|
||||||
var indeces map[int]struct{}
|
var indeces map[int]struct{}
|
||||||
err = json.Unmarshal(buf, &indeces)
|
err = json.Unmarshal(buf, &indeces)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -72,6 +75,9 @@ func ListViewed(hash string) []*Viewed {
|
|||||||
keys := tdb.List("Viewed")
|
keys := tdb.List("Viewed")
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
buf := tdb.Get("Viewed", key)
|
buf := tdb.Get("Viewed", key)
|
||||||
|
if len(buf) == 0 {
|
||||||
|
return []*Viewed{}
|
||||||
|
}
|
||||||
var indeces map[int]struct{}
|
var indeces map[int]struct{}
|
||||||
err = json.Unmarshal(buf, &indeces)
|
err = json.Unmarshal(buf, &indeces)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -86,5 +92,5 @@ func ListViewed(hash string) []*Viewed {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.TLogln("Error list viewed:", err)
|
log.TLogln("Error list viewed:", err)
|
||||||
}
|
}
|
||||||
return nil
|
return []*Viewed{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,13 +62,12 @@ func GetTorrent(hashHex string) *Torrent {
|
|||||||
|
|
||||||
tor = GetTorrentDB(hash)
|
tor = GetTorrentDB(hash)
|
||||||
|
|
||||||
tr, err := NewTorrent(tor.TorrentSpec, bts)
|
go func() {
|
||||||
if err != nil {
|
tr, _ := NewTorrent(tor.TorrentSpec, bts)
|
||||||
log.TLogln("error get torrent db:", err)
|
|
||||||
}
|
|
||||||
if tr != nil {
|
if tr != nil {
|
||||||
go tr.GotInfo()
|
tr.GotInfo()
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
return tor
|
return tor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user