/
structs.go
132 lines (112 loc) · 3.6 KB
/
structs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package newznab
import (
"time"
)
// NZB represents an NZB found on the index
type NZB struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Size int64 `json:"size,omitempty"`
AirDate time.Time `json:"air_date,omitempty"`
PubDate time.Time `json:"pub_date,omitempty"`
UsenetDate time.Time `json:"usenet_date,omitempty"`
NumGrabs int `json:"num_grabs,omitempty"`
SourceEndpoint string `json:"source_endpoint"`
SourceAPIKey string `json:"source_apikey"`
Category []string `json:"category,omitempty"`
Info string `json:"info,omitempty"`
Genre string `json:"genre,omitempty"`
Resolution string `json:"resolution,omitempty"`
Poster string `json:"poster,omitempty"`
Group string `json:"group,omitempty"`
// TV Specific stuff
TVDBID string `json:"tvdbid,omitempty"`
Season string `json:"season,omitempty"`
Episode string `json:"episode,omitempty"`
TVTitle string `json:"tvtitle,omitempty"`
Rating int `json:"rating,omitempty"`
// Movie Specific stuff
IMDBID string `json:"imdb,omitempty"`
IMDBTitle string `json:"imdbtitle,omitempty"`
IMDBYear int `json:"imdbyear,omitempty"`
IMDBScore float32 `json:"imdbscore,omitempty"`
CoverURL string `json:"coverurl,omitempty"`
// Torznab specific stuff
Seeders int `json:"seeders,omitempty"`
Peers int `json:"peers,omitempty"`
InfoHash string `json:"infohash,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
IsTorrent bool `json:"is_torrent,omitempty"`
}
// SearchResponse is a RSS version of the response.
type SearchResponse struct {
NZBs []RawNZB `xml:"channel>item"`
}
type SearchResponseJson1 struct {
Title string `json:"title,omitempty"`
Channel struct {
Item []RawNZBJson1 `json:"item"`
} `json:"channel"`
}
type SearchResponseJson2 struct {
Item []RawNZBJson2 `json:"item"`
}
// RawNZB represents a single NZB item in search results.
type RawNZB struct {
Title string `xml:"title,omitempty"`
Link string `xml:"link,omitempty"`
Size int64 `xml:"size,omitempty"`
GUID struct {
GUID string `xml:",chardata"`
} `xml:"guid,omitempty"`
Source struct {
URL string `xml:"url,attr"`
} `xml:"source,omitempty"`
Date string `xml:"pubDate,omitempty"`
Enclosure struct {
URL string `xml:"url,attr"`
} `xml:"enclosure,omitempty"`
Attributes []struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
} `xml:"attr"`
}
type RawNZBJson1 struct {
Title string `json:"title,omitempty"`
Link string `json:"link,omitempty"`
Guid string `json:"guid,omitempty"`
Size int64 `json:"size,omitempty"`
Date string `json:"pubDate,omitempty"`
Enclosure struct {
Attributes struct {
URL string `json:"url"`
} `json:"@attributes,omitempty"`
} `json:"enclosure,omitempty"`
Attributes []struct {
Attribute struct {
Name string `json:"name"`
Value string `json:"value"`
} `json:"@attributes,omitempty"`
} `json:"attr,omitempty"`
}
type RawNZBJson2 struct {
Title string `json:"title,omitempty"`
Link string `json:"link,omitempty"`
Size int64 `json:"size,omitempty"`
GUID struct {
GUID string `json:"text,omitempty"`
} `json:"guid,omitempty"`
Date string `json:"pubDate,omitempty"`
Enclosure struct {
URL string `json:"_url"`
} `json:"enclosure,omitempty"`
Attributes []struct {
Name string `json:"_name"`
Value string `json:"_value"`
} `json:"newznab:attr,omitempty"`
Attributes2 []struct {
Name string `json:"_name"`
Value string `json:"_value"`
} `json:"nntmux:attr,omitempty"`
}