diff options
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r-- | src/Network/BitTorrent.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index 8bbd774e..7ae43cec 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs | |||
@@ -24,6 +24,7 @@ module Network.BitTorrent | |||
24 | , getSwarm | 24 | , getSwarm |
25 | , getStorage | 25 | , getStorage |
26 | , getTorrentInfo | 26 | , getTorrentInfo |
27 | , getTorrentInfoStr | ||
27 | 28 | ||
28 | -- * Extensions | 29 | -- * Extensions |
29 | , Extension | 30 | , Extension |
@@ -37,6 +38,7 @@ import Network.BitTorrent.Sessions.Types | |||
37 | import Network.BitTorrent.Sessions | 38 | import Network.BitTorrent.Sessions |
38 | import Network.BitTorrent.Extension | 39 | import Network.BitTorrent.Extension |
39 | import Network.BitTorrent.Tracker | 40 | import Network.BitTorrent.Tracker |
41 | import Text.Read | ||
40 | 42 | ||
41 | -- TODO remove fork from Network.BitTorrent.Exchange | 43 | -- TODO remove fork from Network.BitTorrent.Exchange |
42 | -- TODO make all forks in Internal. | 44 | -- TODO make all forks in Internal. |
@@ -61,6 +63,11 @@ addTorrent cs loc @ TorrentLoc {..} = do | |||
61 | removeTorrent :: ClientSession -> InfoHash -> IO () | 63 | removeTorrent :: ClientSession -> InfoHash -> IO () |
62 | removeTorrent ses loc = undefined -- atomically $ unregisterTorrent ses loc | 64 | removeTorrent ses loc = undefined -- atomically $ unregisterTorrent ses loc |
63 | 65 | ||
66 | getTorrentInfoStr :: ClientSession -> String -> IO (Maybe Torrent) | ||
67 | getTorrentInfoStr cs str | ||
68 | | Just infohash <- readMaybe str = getTorrentInfo cs infohash | ||
69 | | otherwise = return Nothing | ||
70 | |||
64 | {- | 71 | {- |
65 | -- | The same as 'removeTorrrent' torrent, but delete all torrent | 72 | -- | The same as 'removeTorrrent' torrent, but delete all torrent |
66 | -- content files. | 73 | -- content files. |