Update hook passing paths now

This commit is contained in:
Ben Sarmiento
2023-11-23 03:03:52 +01:00
parent addac3cc9f
commit d82265a0ad
4 changed files with 37 additions and 19 deletions

View File

@@ -25,12 +25,14 @@ type Torrent struct {
Name string `json:"filename"`
Progress int `json:"-"`
Links []string `json:"links"`
Added string `json:"-"`
}
func (i *Torrent) UnmarshalJSON(data []byte) error {
type Alias Torrent
aux := &struct {
Progress float64 `json:"progress"`
Added string `json:"added"`
*Alias
}{
Alias: (*Alias)(i),
@@ -41,6 +43,9 @@ func (i *Torrent) UnmarshalJSON(data []byte) error {
}
i.Progress = int(math.Round(aux.Progress))
i.Added = strings.Replace(aux.Added, "Z", "+01:00", 1)
return nil
}