h-booru-0.3.0.0: Haskell library for retrieving data from various booru image sites

Copyright(c) Mateusz Kowalczyk 2013-2014
LicenseGPL-3
Maintainerfuuzetsu@fuuzetsu.co.uk
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010
Extensions
  • ScopedTypeVariables
  • UnicodeSyntax
  • ExplicitForAll
  • LambdaCase

HBooru.Network

Description

Module providing functions to interface with some booru sites. Amongst other things, it should (semi-transparently) handle post count limits. The user should simply be able to ask for all images with certain rather than worrying about hard limits per page set by the sites &c.

Synopsis

Documentation

fetchTaggedPosts :: (Postable s d, CoerceResponse d r) => s -> d -> [Tag] -> ExcIO [ImageTy s d] Source

Given a Site, DataFormat and a list of Tags, naively fetch the first page or so and parse it to the appropriate image type. Both the site and the format need to together form an instance of Postable and the data format has to exist in an instance of CoerceResponse. Uses fetchPostPage to fetch the data.

fetchTaggedPostsIndexed :: (CoerceResponse r a, PostablePaged s r) => s -> r -> [Tag] -> Integer -> ExcIO [ImageTy s r] Source

As fetchTaggedPosts but works with sites which allow indexing by page.

fetchPostPage :: (Postable s d, CoerceResponse d r) => s -> d -> [Tag] -> ExcIO r Source

Given an instance of Postable, CoerceResponse, and a list of Tags, fetch the post page.

fetchPostPageIndexed :: (PostablePaged s d, CoerceResponse d r) => s -> d -> [Tag] -> Integer -> ExcIO r Source

Given an instance of Postable, CoerceResponse, and a list of Tags, fetch the post page.

fetchResponse :: CoerceResponse r r' => String -> r -> ExcIO r' Source

Given a URL and protocol, tries to fetch a response.

fetchPostCount :: (Postable s r, Counted s r, CoerceResponse r a) => s -> r -> [Tag] -> ExcIO Integer Source

Uses fetchPostPage to parse the number of posts available based on provided Tags.

fetchAllTaggedPosts :: (CoerceResponse r a, PostablePaged s r) => s -> r -> [Tag] -> IO [ImageTy s r] Source

Attemps to fetch all posts from a site, from all its pages. The upper limit of images per page is used.

downloadFiles Source

Arguments

:: [(String, FilePath)]

URL with save location

-> TChan DownloadStatus

Channel to send back status info on

-> Int

Max threads to run at once. Bounded to minimum of 1.

-> IO () 

Downloads the given files. Writes the status information back to the provided TChan.