From 6210722bbf16bdc671bc1331e0e929c4335cf9af Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 12 Jun 2016 21:29:54 +0200 Subject: typo --- meta/torrent.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'meta') diff --git a/meta/torrent.go b/meta/torrent.go index 358ed01..656e2c9 100644 --- a/meta/torrent.go +++ b/meta/torrent.go @@ -26,13 +26,9 @@ func (i Info) SingleFile() bool { return len(i.Files) > 0 } -// returns pieceCoung and size of last piece -func (i Info) pieceCount() int { - n := i.Length / i.PieceLength - if i.Length%i.PieceLength > 0 { - n++ - } - return n +// PieceCopunt returns count of full pieces and size of last piece +func (i Info) PieceCount() (int, int) { + return i.Length / i.PieceLength, i.Length % i.PieceLength } func (i Info) String() string { @@ -44,9 +40,9 @@ func (i Info) String() string { i.Length += f.Length } } - s += fmt.Sprintf("%s (%d)\n", i.Name, i.Length) - s += fmt.Sprintf("chunks: %d × %d + %d\n", - i.Length/i.PieceLength, i.PieceLength, i.Length%i.PieceLength) + s += fmt.Sprintf("%s (%d) ", i.Name, i.Length) + full, last := i.PieceCount() + s += fmt.Sprintf("%d × %d + %d\n", full, i.PieceLength, last) return s } -- cgit v1.2.3