From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 4 Feb 2015 15:55:06 +0000 (+0530)
Subject: WIP: info record
X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/module-simplejson._speedups.html?a=commitdiff_plain;h=58bb9d54d0d8b31bef6c855ba4c6048b3cdc3f72;p=functorrent.git

WIP: info record
---

diff --git a/src/Metainfo.hs b/src/Metainfo.hs
index 4522863..58a2369 100644
--- a/src/Metainfo.hs
+++ b/src/Metainfo.hs
@@ -1,9 +1,19 @@
 module Metainfo where
 
 import qualified Bencode as Benc
+import qualified Data.ByteString.Char8 as BC
 import Data.Time.Clock
 
-data Metainfo = MetaInfo { info :: Benc.BVal
+-- only single file mode supported for the time being.
+data Info = Info { pieceLength :: Integer
+                 , pieces :: BC.ByteString
+                 , private :: Maybe Integer
+                 , name :: String
+                 , lengthInBytes :: Integer
+                 , md5sum :: Maybe String }
+          deriving (Eq)
+
+data Metainfo = MetaInfo { info :: Info
                          , announce :: String
                          , announceList :: Maybe [[String]]
                          , creationDate :: Maybe UTCTime