include url in json output

The input field is consistently the url of the feed, which makes sense
as that is the user input, but to differentiate multiple urls downloaded
from a feed when using --json-progress -J, need the url that is being
downloaded too.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-09 16:59:44 -04:00
parent 7919349cee
commit 2fdf0ae38d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -459,14 +459,18 @@ runDownload todownload url extension cache cv getter = do
)
startUrlDownload :: TMVar Bool -> ToDownload -> URLString -> CommandPerform -> CommandStart
startUrlDownload cv todownload url a = starting "addurl"
(ActionItemOther (Just (UnquotedString url)))
(SeekInput [feedurl todownload])
(a `onException` recordfailure)
startUrlDownload cv todownload url a = do
starting "addurl"
(ActionItemOther (Just (UnquotedString url)))
(SeekInput [feedurl todownload])
(go `onException` recordfailure)
where
recordfailure = do
void $ feedProblem url "download failed"
liftIO $ atomically $ tryPutTMVar cv False
go = do
maybeAddJSONField "url" url
a
defaultTemplate :: String
defaultTemplate = "${feedtitle}/${itemtitle}${extension}"