Stability | experimental |
---|---|
Maintainer | fuuzetsu@fuuzetsu.co.uk |
Safe Haskell | None |
| Many booru sites use the same engine (Gelbooru engine) so instead of having
identical parsers across many modules, we simply alias our GenericPost
to
whatever we need.
- data GenericPost = GenericPost {
- heightT :: Integer
- scoreT :: Integer
- file_urlT :: String
- parent_idT :: Maybe Integer
- sample_urlT :: String
- sample_widthT :: Integer
- sample_heightT :: Integer
- preview_urlT :: String
- ratingT :: Rating
- tagsT :: [String]
- idT :: Integer
- widthT :: Integer
- changeT :: String
- md5T :: String
- creator_idT :: Integer
- has_childrenT :: Maybe Bool
- created_atT :: String
- statusT :: String
- sourceT :: String
- has_notesT :: Maybe Bool
- has_commentsT :: Maybe Bool
- preview_widthT :: Integer
- preview_heightT :: Integer
- parsePost :: ArrowXml cat => cat XmlTree GenericPost
- parseRating :: String -> Rating
- parseTags :: String -> [Tag]
- parseBool :: String -> Maybe Bool
Documentation
data GenericPost Source
A post we might expect from many of the sites as a lot of them seem to be based on the Gelbooru engine.
GenericPost | |
|
parsePost :: ArrowXml cat => cat XmlTree GenericPostSource
Fairly naïve parser for all attributes in sites running vanilla
Gelbooru engine. While it catches all attributes in a typical XML post
result, we trust that they are consistent and use read
to deserialise some
values. For sites with non-default replies, custom parsers have to be written.
parseRating :: String -> RatingSource
Parses a string returned from a Gelbooru-like site into
one of the commonly used Rating
s. Note that this is a partial function
so you should make sure that the site in question only ever returns the
values in a format specified in the function