Skip to content

Commit

Permalink
added reverse order to list of history torrents.
Browse files Browse the repository at this point in the history
  • Loading branch information
elgatito committed Oct 5, 2019
1 parent 712b468 commit 508819e
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions api/history.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import (
"github.com/elgatito/elementum/database"
"github.com/elgatito/elementum/xbmc"

"github.com/asdine/storm"
"github.com/gin-gonic/gin"
)

@@ -23,10 +24,7 @@ func History(ctx *gin.Context) {

items := []*xbmc.ListItem{}
var ths []database.TorrentHistory
if err := database.GetStormDB().All(&ths); err != nil {
log.Infof("Could not get list of history items: %s", err)
}
if err := database.GetStormDB().AllByIndex("Dt", &ths); err != nil {
if err := database.GetStormDB().AllByIndex("Dt", &ths, storm.Reverse()); err != nil {
log.Infof("Could not get list of history items: %s", err)
}

2 changes: 1 addition & 1 deletion api/torrents.go
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ func InTorrentsMap(tmdbID string) *bittorrent.TorrentFile {

// InTorrentsHistory ...
func InTorrentsHistory(infohash string) *bittorrent.TorrentFile {
if !config.Get().UseTorrentHistory {
if !config.Get().UseTorrentHistory || infohash == "" {
return nil
}

0 comments on commit 508819e

Please sign in to comment.