I wrote a little filter for af_comics for this feed: https://www.stuttmann-karikaturen.de/feed.rss
Additionally to showing the full-res image I’d also like to add the date from the title as updated tag, as the feed doesn’t provide it.
Is there any way to add the date in an af_comics filter?
Like $article["updated"] = date()->format("r"); or so?
i don’t have the code in front of me right now but this could probably work, i think entire article object is passed to the plugin and almost everything could be modified (except for GUID).
Alright, so I got the right idea.
Could you point out which datetime format has to be provided? Unix timestamp? ISO 8601 (e.g. 2004-02-12T15:19:21+00:00)? Something else?
This works now: $article["timestamp"] = "2018/03/08 09:12:17";
Nice!
However, I noticed that the debug message happens to be the old date, as it is logged before the variable is overwritten. Could be confusing. [10:45:33/12705] date 1568198733 [2019/09/11 10:45:33]
Maybe a solution would be to not overwrite entry_timestamp_fmt, but entry_timestamp? That way one would have to use either $article["pubDate"] or $article["updated"], depending on being RSS or Atom. The benefit would be, that the date format wouldn’t be so strict, as strtotime() is used.
rss feeds can pass timestamp in various random (and broken) formats, i think it would be unfair to force plugins to deal with this bullshit, additionally i think tt-rss parser abstracts those xml fields away.
i thought about passing unformatted timestamp to plugins and formatting it later but it’s not like this makes a lot of difference in the end.
i agree that the debugging output message should be moved though.
e: maybe we should pass entry_timestamp to plugin, as received from the parser, and the error handling block for invalid/unparsed timestamps and formatting should be moved below plugin hook handler. this way it would be harder for a misbehaving plugin to break feed updates by passing an invalid timestamp and causing an exception on INSERT, etc.
i think this would pass unixtime to plugins. it’s not as flexible as something strtotime() would happily eat but at least it would be harder to break, and slightly easier to modify / generate for plugins.