Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

Update stats.go

Cette révision appartient à :
kilo 2017-11-07 21:23:49 +01:00 révisé par GitHub
Parent 8e3d53c702
révision c3cb627268
Signature inconnue de Forgejo
ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 7 ajouts et 4 suppressions

Voir le fichier

@ -113,6 +113,7 @@ func GetStatsHandler(c *gin.Context) {
"leechers": stats.Leechers,
"downloads": stats.Completed,
"filelist": torrentFiles,
"totalsize": fileSize(updateTorrent.Filesize),
})
return
@ -171,11 +172,13 @@ func UpdateTorrentStats(torrent models.Torrent, stats goscrape.Result, currentSt
if len(Files) > 0 {
torrent.FileList = []models.File{}
torrent.Filesize = 0
for i, file := range Files {
torrent.FileList = append(torrent.FileList, models.File{uint(i), torrent.ID, file.DisplayPath(), file.Length()})
JSONFilelist = append(JSONFilelist, FileJSON{file.DisplayPath(), fileSize(file.Length()), "tr-file"})
torrent.Filesize += file.Length()
}
torrent.Update(true)
torrent.Update(false)
}
return
@ -183,9 +186,9 @@ func UpdateTorrentStats(torrent models.Torrent, stats goscrape.Result, currentSt
// FileJSON for file model in json,
type FileJSON struct {
Path string `json:"path"`
Filesize template.HTML `json:"filesize"`
Class string `json:"class"`
Path string `json:"path"`
Filesize template.HTML `json:"filesize"`
Class string `json:"class"`
}
func isEmptyResult(stats goscrape.Result) bool {