-
Notifications
You must be signed in to change notification settings - Fork 2
/
unit9.pas
134 lines (113 loc) · 4.15 KB
/
unit9.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
unit Unit9;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
Buttons,LocalizedForms;
type
{ TFormScrapujVyber }
TFormScrapujVyber = class(TLocalizedForm)
okButton: TBitBtn;
cancelButton: TBitBtn;
scrapujVyberButton: TBitBtn;
jinyScraperButton: TBitBtn;
tabulkaVysledku: TStringGrid;
procedure jinyScraperButtonClick(Sender: TObject);
procedure scrapujVyberButtonClick(Sender: TObject);
procedure mojeAutosize;
private
{ private declarations }
public
{ public declarations }
protected
procedure UpdateTranslation(ALang: String); override;
end;
var
FormScrapujVyber: TFormScrapujVyber;
implementation
uses unit7, // formNastaveni
unit8, // formScraper
unit1, // resource strings
unGlobalScraper; // object globalScraper
{$R *.frm}
{ TFormScrapujVyber }
procedure TFormScrapujVyber.scrapujVyberButtonClick(Sender: TObject);
var
i: Integer;
pomStr: String;
PomStr1: String;
scrapovatZnovuToSame:Boolean;
begin
for I:=tabulkaVysledku.Selection.Top to tabulkaVysledku.Selection.Bottom do
begin
tabulkaVysledku.AutoSizeColumn(0);
if tabulkaVysledku.Cells[2,i]='series' then
begin // --- řádek je seriál
if (i<>tabulkaVysledku.Selection.Top) and (tabulkaVysledku.Cells[0,i]=pomStr) then
begin
tabulkaVysledku.Cells[0,i]:=tabulkaVysledku.Cells[0,i-1];
tabulkaVysledku.Cells[1,i]:=tabulkaVysledku.Cells[1,i-1];
pomStr:= tabulkaVysledku.Cells[0,i];
mojeAutosize;
continue;
end
else
begin
{s prázdným názvem házi scrapování error 404}
If tabulkaVysledku.Cells[0,i]='' then continue;
repeat
PomStr1:= aktualniScraperSerial(tabulkaVysledku.Cells[0,i]);
if PomStr1 <> 'nenalezeno' then
begin
FormScrapujVyber.tabulkaVysledku.Cells[1,i]:=PomStr1;
FormScrapujVyber.tabulkaVysledku.Cells[0,i]:=FormScraper.vybranyNazev;
end
else
scrapovatZnovuToSame:= globalScraper.notScrapedAction;
pomStr:= tabulkaVysledku.Cells[0,i];
mojeAutosize;
until not(scrapovatZnovuToSame) or (pomStr<>'nenalezeno');
continue;
end;
end // --- řádek je seriál
else
begin // --- řádek je film
{s prázdným názvem házi scrapování error 404}
if tabulkaVysledku.Cells[0,i]='' then continue;
repeat
pomStr:=aktualniScraperFilm(tabulkaVysledku.Cells[0,i]);
if pomStr <>'nenalezeno' then
begin
tabulkaVysledku.Cells[1,i]:=PomStr;
tabulkaVysledku.Cells[0,i]:=FormScraper.vybranyNazev;
end
else
scrapovatZnovuToSame:= globalScraper.notScrapedAction;
mojeAutosize;
until not(scrapovatZnovuToSame) or (pomStr<>'nenalezeno');
continue;
end; // --- řádek je film
end;
end;
procedure TFormScrapujVyber.jinyScraperButtonClick(Sender: TObject);
begin
if FormNastaveni.ShowModal = mrOK then
begin
end;
end;
procedure TFormScrapujVyber.mojeAutosize;
begin
tabulkaVysledku.AutoSizeColumns;
if tabulkaVysledku.ColWidths[0]<200 then tabulkaVysledku.ColWidths[0]:=200;
if tabulkaVysledku.ColWidths[1]<50 then tabulkaVysledku.ColWidths[1]:=50;
if tabulkaVysledku.ColWidths[2]<50 then tabulkaVysledku.ColWidths[2]:=50;
tabulkaVysledku.Width:=310;
end;
procedure TFormScrapujVyber.UpdateTranslation(ALang: String);
begin
inherited UpdateTranslation(ALang);
tabulkaVysledku.Columns.Items[0].Title.Caption:=rsName;
tabulkaVysledku.Columns.Items[1].Title.Caption:=rsYear;
tabulkaVysledku.Columns.Items[2].Title.Caption:=rsSort;
end;
end.