forked from filipg/twilight-library
Add packages
This commit is contained in:
parent
ea12e8ac21
commit
4ae00c6660
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
{-# LANGUAGE Arrows, NoMonomorphismRestriction, TemplateHaskell #-}
|
{-# LANGUAGE Arrows, NoMonomorphismRestriction, TemplateHaskell, QuasiQuotes #-}
|
||||||
import ShadowLibrary.Core
|
import ShadowLibrary.Core
|
||||||
|
|
||||||
import Text.XML.HXT.Core
|
import Text.XML.HXT.Core
|
||||||
@ -12,6 +12,8 @@ import Data.List.Utils (replace)
|
|||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
|
||||||
import Control.Lens.Regex.Text
|
import Control.Lens.Regex.Text
|
||||||
|
import Control.Lens ((^?))
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
getLinkAndText xpathCondition = proc doc -> do
|
getLinkAndText xpathCondition = proc doc -> do
|
||||||
xpathTrees <- getXPathTrees xpathCondition -< doc
|
xpathTrees <- getXPathTrees xpathCondition -< doc
|
||||||
@ -39,17 +41,16 @@ extractRecords = proc startUrl -> do
|
|||||||
toShadowItem :: (((String, String), String), String) -> ShadowItem
|
toShadowItem :: (((String, String), String), String) -> ShadowItem
|
||||||
toShadowItem (((url, releaseTitle), collectionTitle), categoryTitle) =
|
toShadowItem (((url, releaseTitle), collectionTitle), categoryTitle) =
|
||||||
(defaultShadowItem url title) {
|
(defaultShadowItem url title) {
|
||||||
originalDate = Just date,
|
originalDate = T.unpack <$> date,
|
||||||
itype = "periodical",
|
itype = "periodical",
|
||||||
format = Just "pdf",
|
format = Just "pdf",
|
||||||
finalUrl = url
|
finalUrl = url
|
||||||
}
|
}
|
||||||
where title = categoryTitle ++ (" " ++ collectionTitle)
|
where title = categoryTitle ++ (" " ++ collectionTitle)
|
||||||
date = releaseTitle
|
date = getDate $ T.pack $ releaseTitle
|
||||||
-- date = getDate $ releaseTitle
|
|
||||||
|
|
||||||
|
|
||||||
-- getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match
|
getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
let start = "http://zborbielawa.pl/archiwum/"
|
let start = "http://zborbielawa.pl/archiwum/"
|
||||||
|
@ -71,6 +71,8 @@ executable zborbielawa
|
|||||||
, regex-posix
|
, regex-posix
|
||||||
, shadow-library
|
, shadow-library
|
||||||
, lens-regex-pcre
|
, lens-regex-pcre
|
||||||
|
, lens
|
||||||
|
, text
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user