From: Ramakrishnan Muthukrishnan Date: Tue, 25 Jul 2017 07:25:20 +0000 (+0530) Subject: Metainfo: Info may or may not be present X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/priv/prod.html?a=commitdiff_plain;h=e34d1a385e2d7fcfd495fc080afef92f4f6429c9;p=functorrent.git Metainfo: Info may or may not be present --- diff --git a/src/FuncTorrent/Metainfo.hs b/src/FuncTorrent/Metainfo.hs index 13e7979..e555074 100644 --- a/src/FuncTorrent/Metainfo.hs +++ b/src/FuncTorrent/Metainfo.hs @@ -41,7 +41,7 @@ data Info = Info { pieceLength :: !Integer , md5sum :: !(Maybe String) } deriving (Eq, Show) -data Metainfo = Metainfo { info :: !Info +data Metainfo = Metainfo { info :: !(Maybe Info) , announceList :: ![String] , creationDate :: !(Maybe Integer) , comment :: !(Maybe String) @@ -67,7 +67,7 @@ mkInfo _ = Nothing mkMetaInfo :: BVal -> Either String Metainfo mkMetaInfo (Bdict m) = - let (Just info') = mkInfo $ m ! "info" + let info' = mkInfo $ m ! "info" announce' = lookup "announce" m announceList' = lookup "announce-list" m creationDate' = lookup "creation date" m