1
0
Fork 0
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:
Koro 2021-08-07 06:15:06 -04:00 committed by GitHub
parent 0155252823
commit ab1c452dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
fflush(stdout);
uint32_t current = b->pieceIndex;
if (current != last)
{
printf("\rPiece %" PRIu32 "/%" PRIu32 " ...", current, b->pieceCount);
fflush(stdout);
last = current;
}
}
putc(' ', stdout);