-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathunit6.pas
141 lines (119 loc) · 4.13 KB
/
unit6.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
134
135
136
137
138
139
140
unit Unit6;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics,
Dialogs, StdCtrls, ExtCtrls, Menus,LocalizedForms;
type
{ TForm6 - pro vytvoření filmu a zároveň pro hromadnou změnu filmu}
TForm6 = class(TLocalizedForm)
Button1: TButton; { Ok}
Button2: TButton; {Storno}
Button3: TButton; {Hledat rok na Internetu}
Button4: TButton; {Další film vytvoř nebo edituj}
ImgListForm6: TImageList;
Label1: TLabel;
LabeledEdit1: TLabeledEdit; { Název}
LabeledEdit2: TLabeledEdit; { Rok}
LabeledEdit3: TLabeledEdit; { Umístění}
ComboBox1: TComboBox; { Media}
StaticText1: TStaticText; { Stubfile}
StaticText2: TStaticText; { Directory}
procedure Button3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure LabeledEdit2EditingDone(Sender: TObject);
procedure LabeledEdit3EditingDone(Sender: TObject);
procedure LabeledEdit3Enter(Sender: TObject);
private
{ private declarations }
procedure updateStubfileADirectory;
public
{ public declarations }
indexSwitch : boolean; { použít index }
indexDefinovan : boolean; { už byl index definován}
indexHodnota : Integer; { hodnota indexu (bez báze)}
indexBaze: Integer; { báze indexu}
umisteniStare:String; { přechozí hodnota umístění}
protected
procedure UpdateTranslation(ALang: String); override;
end;
var
Form6: TForm6;
implementation
uses unit7, { chci pracovat s objekty v unit7 tzn. s FormNastaveni }
unit8, { chci pracovat s objekty v unit8 tzn. scrapovat rok k filmu }
unit1, // v unit1 jsou resource stringy
unGlobalScraper; // je tam timer + kód na využití frmNotScraped (unNotScraped)
{$R *.frm}
{ TForm6 }
procedure TForm6.updateStubfileADirectory;
var
pomString:String;
begin
pomString:=form1.validateFileName(LabeledEdit1.Text);
StaticText1.Caption:= pomString +'.disc';
StaticText2.Caption:= '\'+ pomString+'('+LabeledEdit2.Text+')\';
end;
procedure TForm6.UpdateTranslation(ALang: String);
begin
inherited UpdateTranslation(ALang);
StaticText2.Caption:=rsDirectory2;
LabeledEdit1.EditLabel.Caption:=rsName;
LabeledEdit2.EditLabel.Caption:=rsYear;
LabeledEdit3.EditLabel.Caption:=rsLocation;
end;
procedure TForm6.LabeledEdit2EditingDone(Sender: TObject);
begin
updateStubfileADirectory
end;
procedure TForm6.LabeledEdit3EditingDone(Sender: TObject); {Ukončení editace pole "Umístění"}
var
PomUm: String;
begin
If (indexSwitch=true) then
begin
if indexHodnota=0 then umisteniStare:=LabeledEdit3.Text;
LabeledEdit3.Text:='';
PomUm:=inttostr(indexBaze+indexHodnota) ;
if length(PomUm) =1 then PomUm:=' 00'+PomUm;
if length(PomUm) =2 then PomUm:=' 0'+PomUm;
LabeledEdit3.Text:=umisteniStare+PomUm;
end;
end;
procedure TForm6.LabeledEdit3Enter(Sender: TObject); {Enter do pole "Umístění"}
begin
If (indexHodnota=0) and (indexSwitch=true) then
begin
if MessageDlg(rsPouTIndexUmS, mtConfirmation, [mbYes, mbNo], 0) = mrYes
then
begin
indexDefinovan:=true;
indexBaze:= strtoint(Inputbox(rsBZeIndexu, rsIndexOd, '0'));
end
else
indexSwitch:=false;
end;
end;
procedure TForm6.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
updateStubfileADirectory;
end;
procedure TForm6.Button3Click(Sender: TObject);
var
pomText: string;
scrapovatZnovuToSame: Boolean;
begin
//aktualniScraperFilm:=ScraperyFilm[TScraperFilm(FormNastaveni.FilmScrapers.ItemIndex)];
if LabeledEdit1.Text='' then exit; {s prázdným názvem házi scrapování error 404}
repeat
pomText:=aktualniScraperFilm(LabeledEdit1.Text);
if pomText <>'nenalezeno' then
begin
LabeledEdit2.Text:=pomText;
LabeledEdit1.Text:=FormScraper.vybranyNazev;
end
else
scrapovatZnovuToSame:= globalScraper.notScrapedAction;
until not(scrapovatZnovuToSame) or (pomText<>'nenalezeno');
end;
end.