torrent 10000.0.1 → 10000.1.0
raw patch · 3 files changed
+17/−8 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Torrent: Torrent :: ByteString -> [ByteString] -> ByteString -> Maybe ByteString -> TorrentInfo -> Torrent
+ Data.Torrent: Torrent :: Maybe ByteString -> [ByteString] -> ByteString -> Maybe ByteString -> TorrentInfo -> Torrent
- Data.Torrent: [tAnnounce] :: Torrent -> ByteString
+ Data.Torrent: [tAnnounce] :: Torrent -> Maybe ByteString
Files
- CHANGELOG +8/−0
- src/Data/Torrent.hs +7/−6
- torrent.cabal +2/−2
CHANGELOG view
@@ -1,3 +1,11 @@+haskell-torrent (10000.1.0) unstable; urgency=medium++ * Don't crash when parsing a torrent with no announce value.+ Torrents commonly have only an announce-list.+ * tAnnounce converted to Maybe ByteString (API change)++ -- Joey Hess <id@joeyh.name> Sun, 19 Mar 2017 01:02:16 -0400+ haskell-torrent (10000.0.1) unstable; urgency=medium * Added showTorrent.
src/Data/Torrent.hs view
@@ -18,6 +18,7 @@ import Data.BEncode.Parser import Data.Binary import Data.Generics+import Data.Maybe import qualified Data.ByteString.Lazy as BS import Data.ByteString.Lazy (ByteString)@@ -26,7 +27,7 @@ data Torrent = Torrent- { tAnnounce :: ByteString+ { tAnnounce :: Maybe ByteString , tAnnounceList :: [ByteString] , tComment :: ByteString , tCreatedBy :: Maybe ByteString@@ -76,7 +77,7 @@ parseTorrent :: BParser Torrent parseTorrent = do- announce <- bbytestring $ dict "announce"+ announce <- optional $ bbytestring $ dict "announce" creator <- optional $ bbytestring $ dict "created by" info <- dict "info" setInput info@@ -100,10 +101,10 @@ return $ MultiFile files name pLen pieces serializeTorrent :: Torrent -> BEncode-serializeTorrent torrent = BDict $ Map.fromList- [ ("announce", BString $ tAnnounce torrent)- , ("comment", BString $ tComment torrent)- , ("info", info)+serializeTorrent torrent = BDict $ Map.fromList $ catMaybes+ [ (\b -> ("announce", BString b)) <$> (tAnnounce torrent)+ , Just ("comment", BString $ tComment torrent)+ , Just ("info", info) ] where info = BDict $ Map.fromList $
torrent.cabal view
@@ -1,5 +1,5 @@ Name: torrent-Version: 10000.0.1+Version: 10000.1.0 Cabal-Version: >= 1.6 Maintainer: Joey Hess <id@joeyh.name> Author: Lemmih <lemmih@gmail.com>@@ -22,4 +22,4 @@ source-repository head type: git- location: git://git.kitenet.net/haskell-torrent.git+ location: git://git.joeyh.name/haskell-torrent.git