blob: 2b626241afd2cc276e6471895f38b746aca95c07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
module Main (main) where
import Data.Torrent
import Network.Torrent.THP
import System.Environment
import Data.ByteString as B
import Data.ByteString.Lazy as L
import Data.BEncode
main :: IO ()
main = do
[path] <- getArgs
contents <- B.readFile path
let Right contents' = decode contents >>= return . L.toStrict . encode
print (contents' == contents)
-- let (a, b) = showInfos contents
-- print b
-- print a
-- print (encode b == encoded a)
let Right b = decode contents
let Right t = fromBEncode b
let req = defaultRequest (tAnnounce t) (tInfoHash t)
resp <- sendRequest req
print resp
|