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:
ducalex
2024-04-29 14:10:24 -04:00
committed by GitHub
parent 775b38079f
commit 42b87963fd
8 changed files with 40 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
#VERSION: 1.47
#VERSION: 1.48
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -26,12 +26,16 @@
def prettyPrinter(dictionary):
dictionary['size'] = anySizeToBytes(dictionary['size'])
outtext = "|".join((dictionary["link"], dictionary["name"].replace("|", " "),
str(dictionary["size"]), str(dictionary["seeds"]),
str(dictionary["leech"]), dictionary["engine_url"]))
if 'desc_link' in dictionary:
outtext = "|".join((outtext, dictionary["desc_link"]))
outtext = "|".join((
dictionary["link"],
dictionary["name"].replace("|", " "),
str(anySizeToBytes(dictionary['size'])),
str(dictionary["seeds"]),
str(dictionary["leech"]),
dictionary["engine_url"],
dictionary.get("desc_link", ""), # Optional
str(dictionary.get("pub_date", -1)), # Optional
))
# fd 1 is stdout
with open(1, 'w', encoding='utf-8', closefd=False) as utf8stdout: