summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Torrent.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index 8e837b56..a1df0034 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -33,7 +33,7 @@ module Data.Torrent
33 33
34 -- * Files layout 34 -- * Files layout
35 , Layout, contentLayout 35 , Layout, contentLayout
36 , contentLength, fileOffset 36 , contentLength, fileCount, fileOffset
37 , pieceCount, blockCount 37 , pieceCount, blockCount
38 , isSingleFile, isMultiFile 38 , isSingleFile, isMultiFile
39 39
@@ -415,6 +415,11 @@ contentLength :: ContentInfo -> Integer
415contentLength SingleFile { ciLength = len } = len 415contentLength SingleFile { ciLength = len } = len
416contentLength MultiFile { ciFiles = tfs } = sum (map fiLength tfs) 416contentLength MultiFile { ciFiles = tfs } = sum (map fiLength tfs)
417 417
418-- | Get count of all files in torrent.
419fileCount :: ContentInfo -> Int
420fileCount SingleFile {..} = 1
421fileCount MultiFile {..} = length ciFiles
422
418-- | Find count of pieces in the torrent. If torrent size is not a 423-- | Find count of pieces in the torrent. If torrent size is not a
419-- multiple of piece size then the count is rounded up. 424-- multiple of piece size then the count is rounded up.
420pieceCount :: ContentInfo -> Int 425pieceCount :: ContentInfo -> Int