Skip to content

Commit

Permalink
Break out of piece size loop
Browse files Browse the repository at this point in the history
Iteration 26431: piece_size=33554432, num_pieces=1783, torrent_file_size=115.65 KiB
Iteration 26432: piece_size=67108864, num_pieces=892, torrent_file_size=98.25 KiB
  • Loading branch information
Audionut committed Oct 12, 2024
1 parent 4da0184 commit 7f5e7da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2473,9 +2473,10 @@ def calculate_piece_size(cls, total_size, min_size, max_size, files):
elif num_pieces > 2000:
piece_size *= 2
if piece_size > our_max_size:
cli_ui.warning(f"Warning: Piece size exceeded 2000 pieces and .torrent will be approximately {torrent_file_size / 1024:.2f} KiB! Using ({num_pieces}) pieces.")
piece_size = our_max_size
break
elif torrent_file_size > 92160: # Break if .torrent size exceeds 90 KiB
break
elif torrent_file_size > 102400:
cli_ui.warning('WARNING: .torrent size will exceed 100 KiB!')
piece_size *= 2
Expand Down

0 comments on commit 7f5e7da

Please sign in to comment.