This commit is contained in:
yourok
2019-09-20 13:21:03 +03:00
parent 478c991dfd
commit 72e8bf891f
2 changed files with 13 additions and 12 deletions

View File

@@ -25,14 +25,15 @@ func Add(bts *torr.BTServer, magnet metainfo.Magnet, save bool) error {
torDb.Size = torr.Length()
torDb.Magnet = magnet.String()
torDb.Timestamp = time.Now().Unix()
files := torr.Files()
files := torr.Stats().FileStats
sort.Slice(files, func(i, j int) bool {
return files[i].Path() < files[j].Path()
return files[i].Path < files[j].Path
})
for _, f := range files {
ff := settings.File{
Name: f.Path(),
Size: f.Length(),
Id: f.Id,
Name: f.Path,
Size: f.Length,
}
torDb.Files = append(torDb.Files, ff)
}