Add attr to differentiate trackers for future
This commit is contained in:
+17
-16
@@ -12,16 +12,21 @@ type SearchResult struct {
|
||||
Items []Item `xml:"channel>item"`
|
||||
}
|
||||
|
||||
type JackettIndexer struct {
|
||||
ID string `xml:"id,attr"`
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Title string `xml:"title"`
|
||||
Link string `xml:"link"`
|
||||
Guid string `xml:"guid"`
|
||||
PubDate string `xml:"pubDate"`
|
||||
Size int64 `xml:"size"`
|
||||
Description string `xml:"description"`
|
||||
Categories []string `xml:"category"`
|
||||
Enclosure Enclosure `xml:"enclosure"`
|
||||
TorznabAttrs []TorznabAttr `xml:"attr"`
|
||||
Title string `xml:"title"`
|
||||
Link string `xml:"link"`
|
||||
Guid string `xml:"guid"`
|
||||
PubDate string `xml:"pubDate"`
|
||||
Size int64 `xml:"size"`
|
||||
Description string `xml:"description"`
|
||||
Categories []string `xml:"category"`
|
||||
Enclosure Enclosure `xml:"enclosure"`
|
||||
TorznabAttrs []TorznabAttr `xml:"attr"`
|
||||
JackettIndexer JackettIndexer `xml:"jackettindexer"`
|
||||
}
|
||||
|
||||
type Enclosure struct {
|
||||
@@ -36,18 +41,13 @@ type TorznabAttr struct {
|
||||
}
|
||||
|
||||
var (
|
||||
parserFactory = rutracker.NewParserFactory()
|
||||
filter = rutracker.NewFilter()
|
||||
rutrackerParserFactory = rutracker.NewRuTrackerParserFactory()
|
||||
)
|
||||
|
||||
func (sr *SearchResult) ToProto() *pb.SearchResponse {
|
||||
var pbItems []*pb.SearchItem
|
||||
|
||||
for _, item := range sr.Items {
|
||||
if !filter.IsKnownCategory(item.Categories) {
|
||||
continue
|
||||
}
|
||||
|
||||
pbAttrs := make([]*pb.TorznabAttr, len(item.TorznabAttrs))
|
||||
for j, attr := range item.TorznabAttrs {
|
||||
pbAttrs[j] = &pb.TorznabAttr{
|
||||
@@ -56,7 +56,8 @@ func (sr *SearchResult) ToProto() *pb.SearchResponse {
|
||||
}
|
||||
}
|
||||
|
||||
release := parserFactory.GetParser(item.Categories).Parse(item.Title)
|
||||
// TODO add the check from what tracker the result is to properly get the parser and thus parse it
|
||||
release := rutrackerParserFactory.GetParser(item.Categories).Parse(item.Title)
|
||||
|
||||
pbItems = append(pbItems, &pb.SearchItem{
|
||||
Title: item.Title,
|
||||
|
||||
Reference in New Issue
Block a user