CSV export
This commit is contained in:
parent
e2f7ebe6de
commit
11c4e92cc7
@ -6,7 +6,8 @@ Personal, bare bones [readwise] alternative.
|
||||
|
||||
Have
|
||||
- Parsers
|
||||
- [ ] Read from kindle
|
||||
- [-] Read from kindle
|
||||
- [ ] Read from readwise
|
||||
- [x] Read from KOReader
|
||||
- [x] Minimal API
|
||||
- Expose random-quote API
|
||||
|
@ -34,16 +34,18 @@ instance FromNamedRecord RwHighlight where
|
||||
<*> m .: "Highlighted at"
|
||||
<*> m .: "Document tags"
|
||||
|
||||
parseDocument :: ByteString -> [RwHighlight]
|
||||
parseDocument :: ByteString -> Either String [RwHighlight]
|
||||
parseDocument d = case decodeByName d of
|
||||
Left _ -> []
|
||||
Right (_, va) -> toList va
|
||||
Left err -> Left err
|
||||
Right (_, va) -> Right $ toList va
|
||||
|
||||
parse :: ByteString -> [Quote]
|
||||
parse d = fmap (\r -> Quote { qQuote = rhHightlight r
|
||||
parse :: ByteString -> Either String [Quote]
|
||||
parse d = case parseDocument d of
|
||||
Left err -> Left err
|
||||
Right rw -> Right $ fmap (\r -> Quote { qQuote = rhHightlight r
|
||||
, qAuthor = rhAuthor r
|
||||
, qTitle = rhTitle r
|
||||
, qPage = rhLocation r
|
||||
, qChapter = Nothing
|
||||
, qCreatedOn = Nothing
|
||||
}) (parseDocument d)
|
||||
}) rw
|
||||
|
Loading…
Reference in New Issue
Block a user