rss: continue to sort results by pubdate desc
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/l3uddz/nabarr/media"
|
"github.com/l3uddz/nabarr/media"
|
||||||
"github.com/lucperkins/rek"
|
"github.com/lucperkins/rek"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -71,6 +72,11 @@ func (j *rssJob) getFeed() ([]media.FeedItem, error) {
|
|||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort response items
|
||||||
|
sort.SliceStable(b.Channel.Items, func(i, j int) bool {
|
||||||
|
return b.Channel.Items[i].PubDate.After(b.Channel.Items[j].PubDate.Time)
|
||||||
|
})
|
||||||
|
|
||||||
// process feed items
|
// process feed items
|
||||||
for p, i := range b.Channel.Items {
|
for p, i := range b.Channel.Items {
|
||||||
// ignore items
|
// ignore items
|
||||||
|
|||||||
Reference in New Issue
Block a user