-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create first testing book using txt2epub.
- Loading branch information
dixiecko
committed
Jan 5, 2010
1 parent
0da6fe1
commit a151dba
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
import qualified Data.ByteString.Lazy as B | ||
import Codec.EBook | ||
import System.Environment (getArgs) | ||
import Data.List (foldl') | ||
|
||
main = do | ||
fileNames <- getArgs | ||
let book = emptyBook { | ||
bookID = "http://localhost/pokus", | ||
bookAuthor = "Jozef Chroustal", | ||
bookTitle = "Macka a Pes" | ||
} | ||
print book | ||
outdata <- book2Str' book | ||
items <- mapM (loadItems) fileNames | ||
let bookFull = foldl' (addItem2Book) book items | ||
print bookFull | ||
outdata <- book2Str' bookFull | ||
print outdata | ||
B.writeFile "book.epub" outdata | ||
|
||
loadItems :: FilePath -> IO BookItem | ||
loadItems p = do | ||
c <- B.readFile p | ||
return (BookItem ("http://localhost/"++p) p c opsMediatype (Just (ChapterMetadata p))) |