From: Ramakrishnan Muthukrishnan Date: Wed, 4 Feb 2015 15:31:20 +0000 (+0530) Subject: WIP: create MetaInfo structure from torrentfile X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/uri/flags/%3C?a=commitdiff_plain;h=98d545d08350a363724b70e69b4311b465a771c9;p=functorrent.git WIP: create MetaInfo structure from torrentfile --- diff --git a/src/Main.hs b/src/Main.hs index 7ab4712..6d4b3ce 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -3,10 +3,17 @@ module Main where import System.Environment (getArgs) import qualified Data.ByteString.Char8 as BC import qualified Bencode as Benc +import qualified Metainfo as MInfo +import Text.ParserCombinators.Parsec + +printError :: ParseError -> IO () +printError e = putStrLn "parse error" main :: IO () main = do args <- getArgs torrentStr <- BC.readFile (head args) - let metadata = Benc.decode torrentStr + case (Benc.decode torrentStr) of + Right d -> MInfo.mkMetaInfo d + Left e -> printError e putStrLn "done" diff --git a/src/Metainfo.hs b/src/Metainfo.hs new file mode 100644 index 0000000..b8240c5 --- /dev/null +++ b/src/Metainfo.hs @@ -0,0 +1 @@ +module Metainfo where