Modyfikacja parametru originalDate
This commit is contained in:
parent
1c5fe464b3
commit
11683b816c
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
/home/arab/tajemnica-atari/shadow-library.cabal:
|
||||
hash: 714bd61ef22b868b423c5ab32edbbca76e241ecb2075dced142701878c34217a
|
||||
/home/arab/tajemnica-atari/app/tajemnicaatari.hs:
|
||||
hash: bddee13012273b21b906bb8fbd691a21a711b4572235a59201b82b3843f2c862
|
||||
hash: d6d30253647c843a66123cc3a966da1ec5db47b670cfbccc24a2b7289493980c
|
||||
|
Binary file not shown.
Binary file not shown.
@ -19,7 +19,7 @@ stack install
|
||||
Wynikiem pracy robota będzie zbiór elementów ShadowItem. Oto przypładowy rekord ShadowItem:
|
||||
|
||||
```
|
||||
ShadowItem {url = Just "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/3_91/3_91_offline.zip", title = "Tajemnica Atari TA 3/91 DjVu OFFLINE (plik ZIP, 1.6MB)", itype = "periodical", originalDate = Just "3_91", creator = Nothing, format = Just "zip", lang = Just "pol", finalUrl = "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/3_91/3_91_offline.zip", description = Nothing}
|
||||
ShadowItem {url = Just "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/4_91/4_91_offline.zip", title = "Tajemnica Atari TA 4/91 DjVu OFFLINE (plik ZIP, 1.9MB)", itype = "periodical", originalDate = Just "1991-4", creator = Nothing, format = Just "zip", lang = Just "pol", finalUrl = "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/4_91/4_91_offline.zip", description = Nothing}
|
||||
|
||||
```
|
||||
|
||||
|
1
Robot_Haskell_Rafał_Sobański.txt
Normal file
1
Robot_Haskell_Rafał_Sobański.txt
Normal file
@ -0,0 +1 @@
|
||||
https://git.wmi.amu.edu.pl/s470627/tajemnica-atari
|
@ -11,6 +11,8 @@ import Data.List.Utils (replace)
|
||||
import Text.Regex.Posix
|
||||
import Text.Printf
|
||||
|
||||
import Data.List.Utils
|
||||
|
||||
|
||||
extractRecords = extractLinksWithText "//a[@class='ramka']" -- pary adres-tytuł
|
||||
|
||||
@ -20,19 +22,21 @@ extractRecords = extractLinksWithText "//a[@class='ramka']" -- pary adres-tytu
|
||||
toShadowItem :: ((String, String), String) -> ShadowItem
|
||||
toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||
(defaultShadowItem url title) {
|
||||
originalDate = Just date,
|
||||
originalDate = Just newFormatDate,
|
||||
itype = "periodical",
|
||||
format = Just "zip",
|
||||
finalUrl = url
|
||||
}
|
||||
where title = "Tajemnica Atari " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
|
||||
date = getDate url
|
||||
splitDate = split "_" date
|
||||
newFormatDate = "19" ++ splitDate !! 1 ++ "-" ++splitDate !! 0
|
||||
|
||||
getDate url =
|
||||
case url =~~ "/([1-9]_9[0-9]|1[0-2]_9[0-9]|[1-9]-[1-9]_9[0-9]|1[0-2]-1[0-2]_9[0-9])/" :: Maybe [[String]] of
|
||||
Just [[_, year]] -> year
|
||||
otherwise -> error $ "unexpected url: " ++ url
|
||||
|
||||
|
||||
|
||||
main = do
|
||||
let start = "http://krap.pl/mirrorz/atari/horror.mirage.com.pl/pixel/"
|
||||
|
Loading…
Reference in New Issue
Block a user