commit d3b1e83c32aa231fd2144b678dd350c1bce4881c Author: Timon Ringwald Date: Wed Aug 3 19:58:31 2022 +0200 initial commit diff --git a/file_parser.go b/file_parser.go new file mode 100644 index 0000000..db80b12 --- /dev/null +++ b/file_parser.go @@ -0,0 +1,3 @@ +package model + +type FileParserFunc func(str string) (file *ParsedFile, ok bool) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9fd5b2e --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.tordarus.net/anime-manager/model + +go 1.18 + +require git.tordarus.net/Tordarus/anilist v1.4.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d7ad1d3 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +git.tordarus.net/Tordarus/anilist v1.4.0 h1:vmdieiWlLFKmNgYnvFnET71psvmK4oOmYDjDCq1O7y4= +git.tordarus.net/Tordarus/anilist v1.4.0/go.mod h1:JkOLl/sN3a1mI3JDVls/oqYi83jrrjH8c86vwrBPXEY= diff --git a/parsed_file.go b/parsed_file.go new file mode 100644 index 0000000..5dda97c --- /dev/null +++ b/parsed_file.go @@ -0,0 +1,10 @@ +package model + +import "git.tordarus.net/Tordarus/anilist" + +type ParsedFile struct { + FileName string + Anime *anilist.Media + Episode int + Parser *Parser +} diff --git a/parsed_torrent.go b/parsed_torrent.go new file mode 100644 index 0000000..f6392d6 --- /dev/null +++ b/parsed_torrent.go @@ -0,0 +1,10 @@ +package model + +import "git.tordarus.net/Tordarus/anilist" + +type ParsedTorrent struct { + Torrent *Torrent + Anime *anilist.Media + Episode int + Parser *Parser +} diff --git a/parser.go b/parser.go new file mode 100644 index 0000000..b809173 --- /dev/null +++ b/parser.go @@ -0,0 +1,12 @@ +package model + +type Parser struct { + Identity string + + TorrentParser TorrentParserFunc + FileParser FileParserFunc +} + +func (p Parser) String() string { + return p.Identity +} diff --git a/torrent.go b/torrent.go new file mode 100644 index 0000000..1e0ef51 --- /dev/null +++ b/torrent.go @@ -0,0 +1,16 @@ +package model + +import "time" + +type Torrent struct { + ID TorrentID `json:"id"` + Title string `json:"title"` + Link string `json:"link"` + Time time.Time `json:"time"` + Seeders int `json:"seeders"` + Leechers int `json:"leechers"` + Downloads int `json:"downloads"` + Trusted bool `json:"trusted"` +} + +type TorrentID string diff --git a/torrent_parser.go b/torrent_parser.go new file mode 100644 index 0000000..73b0a9c --- /dev/null +++ b/torrent_parser.go @@ -0,0 +1,3 @@ +package model + +type TorrentParserFunc func(torrent *Torrent) (parsedTorrent *ParsedTorrent, ok bool)