bitmagnet
bitmagnet copied to clipboard
Torznab API result sort order
- [x] I have checked the existing issues to avoid duplicates
- [x] I have redacted any info hashes and content metadata from any logs or screenshots attached to this issue
Is your feature request related to a problem? Please describe
I noticed that Sonarr is only ever requesting a single page from Bitmagnet when performing a normal RSS sync, and therefore doesn't find anthing.
From the code of Sonarr it looks like Sonarr stops requesting further results from the Indexer when the oldest publishDate
is older than the publishDate
of the previous RSS sync.
The query that Sonarr performs for a RSS sync is /torznab/?t=tvsearch&cat=5000,5030,5040,5045&extended=1&offset=0&limit=100
.
As far as I can see, the result of Bitmagnets /torznab
endpoint has no sort order and the pubDate
can contain wildly different dates. I have seen dates ranging from 2019 to 2024 in a single query. The result also doesn't seem to be the latest torrents from the web UI.
Describe the solution you'd like
I couldn't find anything regarding a default sort order or any recommendations on the sort order in the Torznab specifications. But to me it looks like Sonarr expects that querying the /torznab
endpoint would return the latest torrents in descending order. So the first item
would be the last updated/added torrent in Bitmagnet. Otherwise the RSS sync of Sonarr can't work properly (I think).
Additional context
A sidenote: I have also seen that the channel
contains a pubDate
and lastBuildDate
, both of which have Mon, 01 Jan 0001 00:00:00 +0000
as a value and I couldn't find both of these fields in the Torznab specification for the channel
. I don't know if Sonarr or Radarr is using these fields, but they don't look right to me.
Those extra channel elements appear to be part of the RSS spec, rather than the Torznab or Newznab specs: https://cyber.harvard.edu/rss/rss.html#optionalChannelElements
channel / pubdate:
The publication date for the content in the channel. For example, the New York Times publishes on a daily basis, the publication date flips once every 24 hours. That's when the pubDate of the channel changes. All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).
channel / lastBuildDate:
lastBuildDate The last time the content of the channel changed.
It doesn't look like either is being set properly though.
Regarding the torznab results order, it does appear to be using the latest found torrents internally. You can turn off the DHT crawler and the results in the web UI and the Torznab query should then eventually match once it's finished processing what it has, as long as nothing new is being added.
Regarding the torznab results order, it does appear to be using the latest found torrents internally.
I don't believe it is, from my findings its using the sort order 'Relevance' not 'Published' date.
@ioqy If you are still interested then check out my PR for the details:- https://github.com/bitmagnet-io/bitmagnet/pull/308
@binhex Thank you for the PR. Let's hope that will get merged.