]> Sergey Matveev's repositories - rutrackerer.git/blob - torrent.go
Just a note
[rutrackerer.git] / torrent.go
1 package rutrackerer
2
3 import (
4         "crypto/sha1"
5         "encoding/hex"
6         "strconv"
7         "strings"
8         "time"
9 )
10
11 type Torrent struct {
12         Offset     int64
13         Id         int64
14         Size       int64
15         Title      string
16         Hash       [sha1.Size]byte
17         Registered time.Time
18 }
19
20 func (t *Torrent) CSV() string {
21         return strings.Join([]string{
22                 strconv.FormatInt(t.Offset, 10),
23                 strconv.FormatInt(t.Id, 10),
24                 strconv.FormatInt(t.Size, 10),
25                 hex.EncodeToString(t.Hash[:]),
26                 t.Registered.Format("2006-01-02T15:04:05"),
27                 t.Title,
28         }, "\t")
29 }