importfeed: Display feed title
When importing a bunch of feeds, this makes it more clear what it's working on. Also, I sometimes want to delete a particular feed from a list of feeds but don't know which url belongs to the feed, and this solves that. Control characters are filtered out just to protect against some feed putting escape character stuff in the feed, which could be a security problem. (Control characters also get filtered out of importfeed filenames.) Sponsored-by: Luke Shumaker on Patreon
This commit is contained in:
parent
f1672fe171
commit
2323af3736
2 changed files with 18 additions and 9 deletions
|
@ -11,6 +11,7 @@ git-annex (10.20230228) UNRELEASED; urgency=medium
|
|||
* Added arm64 build for ancient kernels, needed to support Android phones
|
||||
whose kernels are too old to support kernels used by the current arm64
|
||||
build.
|
||||
* importfeed: Display feed title.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 27 Feb 2023 12:31:14 -0400
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import Text.Feed.Query
|
|||
import Text.Feed.Types
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.Map as M
|
||||
import Data.Char
|
||||
import Data.Time.Clock
|
||||
import Data.Time.Format
|
||||
import Data.Time.Calendar
|
||||
|
@ -93,15 +94,22 @@ getFeed addunlockedmatcher opts cache url = do
|
|||
-- ourselves because it goes out of its way to handle encodings.
|
||||
go tmpf = liftIO (parseFeedFromFile' tmpf) >>= \case
|
||||
Nothing -> debugfeedcontent tmpf "parsing the feed failed"
|
||||
Just f -> case findDownloads url f of
|
||||
[] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"
|
||||
l -> do
|
||||
showEndOk
|
||||
ifM (and <$> mapM (performDownload addunlockedmatcher opts cache) l)
|
||||
( clearFeedProblem url
|
||||
, void $ feedProblem url
|
||||
"problem downloading some item(s) from feed"
|
||||
)
|
||||
Just f -> do
|
||||
case map sanitizetitle $ decodeBS $ fromFeedText $ getFeedTitle f of
|
||||
"" -> noop
|
||||
t -> showNote ('"' : t ++ "\"")
|
||||
case findDownloads url f of
|
||||
[] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"
|
||||
l -> do
|
||||
showEndOk
|
||||
ifM (and <$> mapM (performDownload addunlockedmatcher opts cache) l)
|
||||
( clearFeedProblem url
|
||||
, void $ feedProblem url
|
||||
"problem downloading some item(s) from feed"
|
||||
)
|
||||
sanitizetitle c
|
||||
| isControl c = '_'
|
||||
| otherwise = c
|
||||
debugfeedcontent tmpf msg = do
|
||||
feedcontent <- liftIO $ readFile tmpf
|
||||
fastDebug "Command.ImportFeed" $ unlines
|
||||
|
|
Loading…
Add table
Reference in a new issue