mirror of
https://github.com/transmission/transmission
synced 2024-12-23 00:04:06 +00:00
Display more progress information during torrent creation. (#1405)
Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
This commit is contained in:
parent
0155252823
commit
ab1c452dd7
1 changed files with 18 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <stdio.h> /* fprintf() */
|
||||
#include <stdlib.h> /* strtoul(), EXIT_FAILURE */
|
||||
#include <inttypes.h> /* PRIu32 */
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/error.h>
|
||||
|
@ -187,8 +188,7 @@ int tr_main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
printf("Creating torrent \"%s\" ...", outfile);
|
||||
fflush(stdout);
|
||||
printf("Creating torrent \"%s\"\n", outfile);
|
||||
|
||||
b = tr_metaInfoBuilderCreate(infile);
|
||||
|
||||
|
@ -203,13 +203,27 @@ int tr_main(int argc, char* argv[])
|
|||
tr_metaInfoBuilderSetPieceSize(b, piecesize_kib * KiB);
|
||||
}
|
||||
|
||||
char buf[128];
|
||||
printf(b->fileCount > 1 ? " %" PRIu32 " files, %s\n" : " %" PRIu32 " file, %s\n", b->fileCount,
|
||||
tr_formatter_size_B(buf, b->totalSize, sizeof(buf)));
|
||||
printf(b->pieceCount > 1 ? " %" PRIu32 " pieces, %s each\n" : " %" PRIu32 " piece, %s\n", b->pieceCount,
|
||||
tr_formatter_size_B(buf, b->pieceSize, sizeof(buf)));
|
||||
|
||||
tr_makeMetaInfo(b, outfile, trackers, trackerCount, comment, isPrivate);
|
||||
|
||||
uint32_t last = UINT32_MAX;
|
||||
while (!b->isDone)
|
||||
{
|
||||
tr_wait_msec(500);
|
||||
putc('.', stdout);
|
||||
|
||||
uint32_t current = b->pieceIndex;
|
||||
if (current != last)
|
||||
{
|
||||
printf("\rPiece %" PRIu32 "/%" PRIu32 " ...", current, b->pieceCount);
|
||||
fflush(stdout);
|
||||
|
||||
last = current;
|
||||
}
|
||||
}
|
||||
|
||||
putc(' ', stdout);
|
||||
|
|
Loading…
Reference in a new issue