Skip to content

Commit 2f137bc

Browse files
add grid column with two extra values
- Torrent version: Show if this torrent is V1, V2 or hybrid - Padding (beb 47) Shows if this torrent has padding beb 47 or not
1 parent 65b79c6 commit 2f137bc

File tree

3 files changed

+94
-54
lines changed

3 files changed

+94
-54
lines changed

source/code/controlergridtorrentdata.pas

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ TControlerGridTorrentData = class
2828
//The collumn must be in this design order.
2929
FTorrentFile, //0
3030
FInfoFileName, //1
31-
FInfoHash, //2
32-
FCreatedOn, //3
33-
FCreatedBy, //4
34-
FComment, //5
35-
FPrivateTorrent, //6
36-
FInfoSource, //7
37-
FPieceLength, //8
38-
FTotaSize, //9
39-
FIndexOrder //10
31+
FTorrentVersion, //2
32+
FPadding, //3
33+
FInfoHash, //4
34+
FCreatedOn, //5
35+
FCreatedBy, //6
36+
FComment, //7
37+
FPrivateTorrent, //8
38+
FInfoSource, //9
39+
FPieceLength, //10
40+
FTotaSize, //11
41+
FIndexOrder //12
4042
: TGridColumn;
4143

4244
FRowIsMovedNeedUpdate: boolean;
@@ -49,15 +51,17 @@ TControlerGridTorrentData = class
4951
//All the string that can be written to grid.
5052
TorrentFile, //0
5153
InfoFileName, //1
52-
InfoHash, //2
53-
CreatedOn, //3
54-
CreatedBy, //4
55-
Comment, //5
56-
PrivateTorrent, //6
57-
InfoSource, //7
58-
PieceLength, //8
59-
TotaSize, //9
60-
IndexOrder //10
54+
TorrentVersion, //2
55+
Padding, //3
56+
InfoHash, //4
57+
CreatedOn, //5
58+
CreatedBy, //6
59+
Comment, //7
60+
PrivateTorrent, //8
61+
InfoSource, //9
62+
PieceLength, //10
63+
TotaSize, //11
64+
IndexOrder //12
6165
: UTF8String;
6266

6367
procedure ClearAllImageIndex;
@@ -135,6 +139,8 @@ procedure TControlerGridTorrentData.AppendRow;
135139
//write all the string to the cell.
136140
WriteCell(FTorrentFile, TorrentFile);
137141
WriteCell(FInfoFileName, InfoFileName);
142+
WriteCell(FTorrentVersion, TorrentVersion);
143+
WriteCell(FPadding, Padding);
138144
WriteCell(FInfoHash, InfoHash);
139145
WriteCell(FCreatedOn, CreatedOn);
140146
WriteCell(FCreatedBy, CreatedBy);
@@ -183,15 +189,17 @@ constructor TControlerGridTorrentData.Create(StringGridTorrentData: TStringGrid)
183189
//Track the column
184190
AddColumn(FTorrentFile, 0);
185191
AddColumn(FInfoFileName, 1);
186-
AddColumn(FInfoHash, 2);
187-
AddColumn(FCreatedOn, 3);
188-
AddColumn(FCreatedBy, 4);
189-
AddColumn(FComment, 5);
190-
AddColumn(FPrivateTorrent, 6);
191-
AddColumn(FInfoSource, 7);
192-
AddColumn(FPieceLength, 8);
193-
AddColumn(FTotaSize, 9);
194-
AddColumn(FIndexOrder, 10);
192+
AddColumn(FTorrentVersion, 2);
193+
AddColumn(FPadding, 3);
194+
AddColumn(FInfoHash, 4);
195+
AddColumn(FCreatedOn, 5);
196+
AddColumn(FCreatedBy, 6);
197+
AddColumn(FComment, 7);
198+
AddColumn(FPrivateTorrent, 8);
199+
AddColumn(FInfoSource, 9);
200+
AddColumn(FPieceLength, 10);
201+
AddColumn(FTotaSize, 11);
202+
AddColumn(FIndexOrder, 12);
195203

196204
//Fillin the tag value
197205
UpdateColumnTag;

source/code/main.lfm

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object FormTrackerModify: TFormTrackerModify
55
Width = 1179
66
AllowDropFiles = True
77
Caption = 'Bittorrent Tracker Editor'
8-
ClientHeight = 587
8+
ClientHeight = 607
99
ClientWidth = 1179
1010
Constraints.MinHeight = 500
1111
Constraints.MinWidth = 700
@@ -16,10 +16,10 @@ object FormTrackerModify: TFormTrackerModify
1616
OnDropFiles = FormDropFiles
1717
OnShow = FormShow
1818
Position = poScreenCenter
19-
LCLVersion = '2.2.6.0'
19+
LCLVersion = '3.6.0.0'
2020
object PageControl: TPageControl
2121
Left = 0
22-
Height = 587
22+
Height = 607
2323
Top = 0
2424
Width = 1179
2525
ActivePage = TabSheetTrackersList
@@ -28,15 +28,15 @@ object FormTrackerModify: TFormTrackerModify
2828
TabOrder = 0
2929
object TabSheetTrackersList: TTabSheet
3030
Caption = 'Trackers List'
31-
ClientHeight = 561
31+
ClientHeight = 581
3232
ClientWidth = 1171
3333
object PanelTop: TPanel
3434
Left = 0
35-
Height = 561
35+
Height = 581
3636
Top = 0
3737
Width = 1171
3838
Align = alClient
39-
ClientHeight = 561
39+
ClientHeight = 581
4040
ClientWidth = 1171
4141
TabOrder = 0
4242
object GroupBoxNewTracker: TGroupBox
@@ -62,19 +62,19 @@ object FormTrackerModify: TFormTrackerModify
6262
end
6363
object GroupBoxPresentTracker: TGroupBox
6464
Left = 1
65-
Height = 353
65+
Height = 373
6666
Top = 207
6767
Width = 1169
6868
Align = alClient
6969
Caption = 'Present trackers in all torrent files. Select the one that you want to keep.'
70-
ClientHeight = 335
70+
ClientHeight = 355
7171
ClientWidth = 1165
7272
Constraints.MinHeight = 100
7373
ParentBidiMode = False
7474
TabOrder = 1
7575
object StringGridTrackerOnline: TStringGrid
7676
Left = 0
77-
Height = 335
77+
Height = 355
7878
Top = 0
7979
Width = 1165
8080
Align = alClient
@@ -100,30 +100,30 @@ object FormTrackerModify: TFormTrackerModify
100100
end
101101
object TabSheetPublicPrivateTorrent: TTabSheet
102102
Caption = 'Public/Private'
103-
ClientHeight = 561
103+
ClientHeight = 581
104104
ClientWidth = 1171
105105
object PanelTopPublicTorrent: TPanel
106106
Left = 0
107-
Height = 561
107+
Height = 581
108108
Top = 0
109109
Width = 1171
110110
Align = alClient
111-
ClientHeight = 561
111+
ClientHeight = 581
112112
ClientWidth = 1171
113113
TabOrder = 0
114114
object GroupBoxPublicPrivateTorrent: TGroupBox
115115
Left = 1
116-
Height = 559
116+
Height = 579
117117
Top = 1
118118
Width = 1169
119119
Align = alClient
120120
Caption = 'Checked items are public torrent. WARNING: change public/private setting will change torrent Hash info.'
121-
ClientHeight = 541
121+
ClientHeight = 561
122122
ClientWidth = 1165
123123
TabOrder = 0
124124
object CheckListBoxPublicPrivateTorrent: TCheckListBox
125125
Left = 0
126-
Height = 541
126+
Height = 561
127127
Top = 0
128128
Width = 1165
129129
Align = alClient
@@ -135,15 +135,15 @@ object FormTrackerModify: TFormTrackerModify
135135
end
136136
object TabSheetTorrentData: TTabSheet
137137
Caption = 'Data/Info'
138-
ClientHeight = 561
138+
ClientHeight = 581
139139
ClientWidth = 1171
140140
object StringGridTorrentData: TStringGrid
141141
Left = 0
142-
Height = 561
142+
Height = 581
143143
Top = 0
144144
Width = 1171
145145
Align = alClient
146-
ColCount = 11
146+
ColCount = 13
147147
ColumnClickSorts = True
148148
Columns = <
149149
item
@@ -156,11 +156,21 @@ object FormTrackerModify: TFormTrackerModify
156156
Title.Caption = 'Info Filename'
157157
Width = 250
158158
end
159+
item
160+
ReadOnly = True
161+
Title.Caption = 'Torrent Version'
162+
Width = 100
163+
end
164+
item
165+
ReadOnly = True
166+
Title.Caption = 'Padding (beb 47)'
167+
Width = 100
168+
end
159169
item
160170
MaxSize = 250
161171
ReadOnly = True
162172
Title.Caption = 'Info Hash'
163-
Width = 280
173+
Width = 439
164174
end
165175
item
166176
ReadOnly = True
@@ -201,8 +211,10 @@ object FormTrackerModify: TFormTrackerModify
201211
end
202212
item
203213
ReadOnly = True
214+
SizePriority = 0
204215
Title.Alignment = taRightJustify
205216
Title.Caption = 'IndexOrder (internal used)'
217+
Width = 0
206218
Visible = False
207219
end>
208220
FixedCols = 0
@@ -213,7 +225,9 @@ object FormTrackerModify: TFormTrackerModify
213225
ColWidths = (
214226
250
215227
250
216-
280
228+
100
229+
100
230+
439
217231
145
218232
145
219233
160
@@ -230,7 +244,7 @@ object FormTrackerModify: TFormTrackerModify
230244
end
231245
object TabSheetPrivateTrackers: TTabSheet
232246
Caption = 'Private Trackers'
233-
ClientHeight = 561
247+
ClientHeight = 581
234248
ClientWidth = 1171
235249
object GroupBoxItemsForPrivateTrackers: TGroupBox
236250
Left = 0
@@ -244,15 +258,15 @@ object FormTrackerModify: TFormTrackerModify
244258
TabOrder = 0
245259
object CheckBoxSkipAnnounceCheck: TCheckBox
246260
Left = 0
247-
Height = 19
261+
Height = 17
248262
Top = 0
249263
Width = 284
250264
Align = alTop
251265
Caption = 'Skip Announce Check in the URL (-SAC)'
252-
OnChange = CheckBoxSkipAnnounceCheckChange
253266
ParentShowHint = False
254267
ShowHint = True
255268
TabOrder = 0
269+
OnChange = CheckBoxSkipAnnounceCheckChange
256270
end
257271
object GroupBoxInfoSource: TGroupBox
258272
Left = 0
@@ -266,12 +280,12 @@ object FormTrackerModify: TFormTrackerModify
266280
TabOrder = 1
267281
object CheckBoxRemoveAllSourceTag: TCheckBox
268282
Left = 8
269-
Height = 19
283+
Height = 17
270284
Top = 8
271-
Width = 132
285+
Width = 130
272286
Caption = 'Remove all source tag'
273-
OnChange = CheckBoxRemoveAllSourceTagChange
274287
TabOrder = 0
288+
OnChange = CheckBoxRemoveAllSourceTagChange
275289
end
276290
object LabeledEditInfoSource: TLabeledEdit
277291
Left = 8

source/code/main.pas

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,25 @@ procedure TFormTrackerModify.ViewUpdateOneTorrentFileDecoded;
17481748
//Copy all the torrent info to the grid column.
17491749
FControlerGridTorrentData.TorrentFile := TorrentFileNameStr;
17501750
FControlerGridTorrentData.InfoFileName := FDecodePresentTorrent.Name;
1751-
FControlerGridTorrentData.InfoHash := FDecodePresentTorrent.InfoHash;
1751+
FControlerGridTorrentData.TorrentVersion :=
1752+
FDecodePresentTorrent.TorrentVersionToString;
1753+
case FDecodePresentTorrent.TorrentVersion of
1754+
tv_V1:
1755+
begin
1756+
FControlerGridTorrentData.InfoHash := 'V1: ' + FDecodePresentTorrent.InfoHash_V1;
1757+
end;
1758+
tv_V2:
1759+
begin
1760+
FControlerGridTorrentData.InfoHash := 'V2: ' + FDecodePresentTorrent.InfoHash_V2;
1761+
end;
1762+
tv_Hybrid:
1763+
begin // Show only V2 hash. No space for both V1 and V2
1764+
FControlerGridTorrentData.InfoHash := 'V2: ' + FDecodePresentTorrent.InfoHash_V2;
1765+
end;
1766+
else
1767+
FControlerGridTorrentData.InfoHash := 'N/A'
1768+
end;
1769+
FControlerGridTorrentData.Padding := FDecodePresentTorrent.PaddingToString;
17521770
FControlerGridTorrentData.CreatedOn := DateTimeStr;
17531771
FControlerGridTorrentData.CreatedBy := FDecodePresentTorrent.CreatedBy;
17541772
FControlerGridTorrentData.Comment := FDecodePresentTorrent.Comment;

0 commit comments

Comments
 (0)