Skip to content

Commit

Permalink
Allow piece sizes of 32MB
Browse files Browse the repository at this point in the history
  • Loading branch information
SavageCore committed Dec 6, 2023
1 parent 46baf87 commit 5c3284f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
humanfriendly>=10.0
torf>=4.2.2
torf>=4.2.4
PyQt5>=5.15.9
pyqtdarktheme>=2.1.0
pyinstaller>=5.13.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
humanfriendly>=10.0
torf>=4.2.2
torf>=4.2.4
PyQt5>=5.15.9
pyqtdarktheme>=2.1.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
packages=find_packages(),
entry_points={"gui_scripts": ["torf-gui = torf_gui.gui:main"]},
install_requires=[
"torf>=4.2.2",
"torf>=4.2.4",
"humanfriendly>=10.0",
"PyQt5>=5.15.9",
"pyqtdarktheme>=2.1.0",
Expand Down
6 changes: 5 additions & 1 deletion torf_gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
PROGRAM_NAME_VERSION = f"{PROGRAM_NAME} {__version__}"
CREATOR = f"torf-gui/{__version__} (https://github.com/SavageCore/torf-gui)"

PIECE_SIZES = [None] + [2**i for i in range(14, 25)]
PIECE_SIZES = [None] + [2**i for i in range(14, 26)]

if getattr(sys, "frozen", False):
_basedir = sys._MEIPASS
Expand Down Expand Up @@ -412,6 +412,10 @@ def sourceEdited(self, source):

def pieceSizeChanged(self, index):
if getattr(self, "torrent", None):
# If piece size is greater than piece_size_max_default (16 MiB),
# set piece_size_max to the selected piece size
if PIECE_SIZES[index] > 16777216:
self.torrent.piece_size_max = PIECE_SIZES[index]
self.torrent.piece_size = PIECE_SIZES[index]
t_info = self.get_info(self.torrent)
self.updatePieceCountLabel(t_info[3], t_info[2])
Expand Down

0 comments on commit 5c3284f

Please sign in to comment.