2022-08-03 19:58:31 +02:00
|
|
|
package model
|
|
|
|
|
2022-08-15 14:52:35 +02:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
)
|
2022-08-03 19:58:31 +02:00
|
|
|
|
|
|
|
type Torrent struct {
|
2022-08-03 23:43:16 +02:00
|
|
|
ID TorrentID
|
|
|
|
Title string
|
|
|
|
Link string
|
|
|
|
Time time.Time
|
|
|
|
Seeders int
|
|
|
|
Leechers int
|
|
|
|
Downloads int
|
|
|
|
Trusted bool
|
2022-08-03 19:58:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type TorrentID string
|
2022-08-15 14:52:35 +02:00
|
|
|
|
|
|
|
func (t Torrent) String() string {
|
|
|
|
return fmt.Sprintf("id: %s | title: %s | seeders: %d | leechers: %d | downloads: %d | trusted: %t | upload time: %s",
|
|
|
|
t.ID,
|
|
|
|
t.Title,
|
|
|
|
t.Seeders,
|
|
|
|
t.Leechers,
|
|
|
|
t.Downloads,
|
|
|
|
t.Trusted,
|
|
|
|
t.Time,
|
|
|
|
)
|
|
|
|
}
|
2022-08-15 14:55:06 +02:00
|
|
|
|
|
|
|
func (t Torrent) StringWithoutTitle() string {
|
|
|
|
return fmt.Sprintf("id: %s | seeders: %d | leechers: %d | downloads: %d | trusted: %t | upload time: %s",
|
|
|
|
t.ID,
|
|
|
|
t.Seeders,
|
|
|
|
t.Leechers,
|
|
|
|
t.Downloads,
|
|
|
|
t.Trusted,
|
2022-08-15 14:58:24 +02:00
|
|
|
t.Time.Format("2006-01-02 15:04:05"),
|
2022-08-15 14:55:06 +02:00
|
|
|
)
|
|
|
|
}
|