Portability | portable |
---|---|
Stability | experimental |
Maintainer | pxqr.sta@gmail.com |
Safe Haskell | None |
Parsing and rendering of magnet URIs.
For more info see: http://magnet-uri.sourceforge.net/magnet-draft-overview.txt
Bittorrent specific info: http://www.bittorrent.org/beps/bep_0009.html
- data Magnet = Magnet {
- exactTopic :: !InfoHash
- displayName :: Maybe Text
- exactLength :: Maybe Integer
- manifest :: Maybe String
- keywordTopic :: Maybe String
- acceptableSource :: Maybe URI
- exactSource :: Maybe URI
- tracker :: Maybe URI
- supplement :: Map Text Text
- nullMagnet :: InfoHash -> Magnet
- simpleMagnet :: Torrent -> Magnet
- detailedMagnet :: Torrent -> Magnet
- parseMagnet :: String -> Maybe Magnet
- renderMagnet :: Magnet -> String
- fromURI :: URI -> Either String Magnet
- toURI :: Magnet -> URI
Magnet
An URI used to identify torrent.
Magnet | |
|
Construction
nullMagnet :: InfoHash -> MagnetSource
Set exact topic only, other params are empty.
simpleMagnet :: Torrent -> MagnetSource
A simple magnet link including infohash (xt
param) and display
name (dn
param).
detailedMagnet :: Torrent -> MagnetSource
Like simpleMagnet
but also include exactLength (xl
param) and
tracker (tr
param).
Conversion
parseMagnet :: String -> Maybe MagnetSource
Try to parse magnet link from urlencoded string.
renderMagnet :: Magnet -> StringSource
Render magnet link to urlencoded string
Extra
fromURI :: URI -> Either String MagnetSource
The same as parseMagnet
but useful if you alread have a parsed
uri.
The same as renderMagnet
but useful if you need an uri.