summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-11-29 20:30:20 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-11-29 20:30:20 +0400
commitd4ee859973b200d3f81ea56b2e40847ed8c93510 (patch)
treebdcafaa8c121cbb5fe8f893f8a1178e0f43ae4c7
parent6fe1682a933f1546d1bb181c6596461b32111025 (diff)
Add documentation to Magnet module
-rw-r--r--src/Data/Torrent/Client.hs1
-rw-r--r--src/Data/Torrent/Magnet.hs47
2 files changed, 32 insertions, 16 deletions
diff --git a/src/Data/Torrent/Client.hs b/src/Data/Torrent/Client.hs
index 122f779d..a21a9c92 100644
--- a/src/Data/Torrent/Client.hs
+++ b/src/Data/Torrent/Client.hs
@@ -193,6 +193,7 @@ libClientInfo = ClientInfo IlibHSbittorrent version
193{----------------------------------------------------------------------- 193{-----------------------------------------------------------------------
194-- For torrent file 194-- For torrent file
195-----------------------------------------------------------------------} 195-----------------------------------------------------------------------}
196-- TODO collect information about createdBy torrent field
196{- 197{-
197renderImpl :: ClientImpl -> Text 198renderImpl :: ClientImpl -> Text
198renderImpl = T.pack . L.tail . show 199renderImpl = T.pack . L.tail . show
diff --git a/src/Data/Torrent/Magnet.hs b/src/Data/Torrent/Magnet.hs
index 887e8379..097f4b8e 100644
--- a/src/Data/Torrent/Magnet.hs
+++ b/src/Data/Torrent/Magnet.hs
@@ -5,7 +5,13 @@
5-- Stability : provisional 5-- Stability : provisional
6-- Portability : portable 6-- Portability : portable
7-- 7--
8-- Parsing and rendering of magnet URIs. 8-- Magnet URI scheme is an standard defining Magnet links. Magnet
9-- links are refer to resources by hash, in particular magnet links
10-- can refer to torrent using corresponding infohash. In this way,
11-- magnet links can be used instead of torrent files.
12--
13-- This module provides bittorrent specific implementation of magnet
14-- links.
9-- 15--
10-- For more info see: 16-- For more info see:
11-- <http://magnet-uri.sourceforge.net/magnet-draft-overview.txt> 17-- <http://magnet-uri.sourceforge.net/magnet-draft-overview.txt>
@@ -59,32 +65,41 @@ import Data.Torrent.URN
59 65
60 66
61-- TODO multiple exact topics 67-- TODO multiple exact topics
62-- TODO supplement 68-- TODO render/parse supplement for URI/query
63 69
64-- | An URI used to identify torrent. 70-- | An URI used to identify torrent.
65data Magnet = Magnet 71data Magnet = Magnet
66 { -- | Resource hash. 72 { -- | Torrent infohash hash. Can be used in DHT queries if no
67 exactTopic :: !InfoHash 73 -- 'tracker' provided.
74 exactTopic :: !InfoHash -- TODO InfoHash -> URN?
68 75
69 -- | Might be used to display name while waiting for metadata. 76 -- | A filename for the file to download. Can be used to
70 , displayName :: Maybe Text 77 -- display name while waiting for metadata.
78 , displayName :: Maybe Text
71 79
72 -- | Size of the resource in bytes. 80 -- | Size of the resource in bytes.
73 , exactLength :: Maybe Integer 81 , exactLength :: Maybe Integer
74 82
75 , manifest :: Maybe Text 83 -- | URI pointing to manifest, e.g. a list of further items.
84 , manifest :: Maybe Text
76 85
77 -- | Search string. 86 -- | Search string.
78 , keywordTopic :: Maybe Text 87 , keywordTopic :: Maybe Text
79 88
80 , acceptableSource :: Maybe URI 89 -- | A source to be queried after not being able to find and
81 , exactSource :: Maybe URI 90 -- download the file in the bittorrent network in a defined
91 -- amount of time.
92 , acceptableSource :: Maybe URI
82 93
83 , tracker :: Maybe URI 94 -- | Direct link to the resource.
95 , exactSource :: Maybe URI
84 96
85 , supplement :: Map Text Text 97 -- | URI to the tracker.
86 } deriving (Eq, Ord, Typeable) 98 , tracker :: Maybe URI
87 99
100 -- | Additional or experimental parameters.
101 , supplement :: Map Text Text
102 } deriving (Eq, Ord, Typeable)
88 103
89instance QueryValueLike Integer where 104instance QueryValueLike Integer where
90 toQueryValue = toQueryValue . show 105 toQueryValue = toQueryValue . show