mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
Add date column to the built-in search engine
Adds a date column to the built-in search engine to show when a torrent was published/uploaded on the engine site. When a plugin wants to show a date, it can now add a `pub_date` entry to its result dict. The value format is a unix timestamp (an integer representing seconds since epoch). Plugins with no date support will keep working. PR #20703.
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/search/searchhandler.h"
|
||||
#include "base/utils/datetime.h"
|
||||
#include "base/utils/foreignapps.h"
|
||||
#include "base/utils/random.h"
|
||||
#include "base/utils/string.h"
|
||||
@@ -301,6 +302,7 @@ int SearchController::generateSearchId() const
|
||||
* - "nbLeechers"
|
||||
* - "siteUrl"
|
||||
* - "descrLink"
|
||||
* - "pubDate"
|
||||
*/
|
||||
QJsonObject SearchController::getResults(const QList<SearchResult> &searchResults, const bool isSearchActive, const int totalResults) const
|
||||
{
|
||||
@@ -315,7 +317,8 @@ QJsonObject SearchController::getResults(const QList<SearchResult> &searchResult
|
||||
{u"nbSeeders"_s, searchResult.nbSeeders},
|
||||
{u"nbLeechers"_s, searchResult.nbLeechers},
|
||||
{u"siteUrl"_s, searchResult.siteUrl},
|
||||
{u"descrLink"_s, searchResult.descrLink}
|
||||
{u"descrLink"_s, searchResult.descrLink},
|
||||
{u"pubDate"_s, Utils::DateTime::toSecsSinceEpoch(searchResult.pubDate)}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user