I was thinking it might be good if you could run movie catalog from the command line to export to a template for example. That way the template could call the program to update the movielist and you would always have a fresh list.

Code: Select all
uses
...
getoptlib, // LA edition
...
procedure TMainWindow.FormShow(Sender: TObject);
var
s, FileToOpen: string;
CmdLineValue, CmdLineOptionIndex: integer; // LA edition
const
CmdLineParametersList : array [0..10] of option = // LA edition
(
( name:'moviefile'; has_arg:required_argument; flag:nil; val:0 ),
( name:'fTranslatedTitle'; has_arg:required_argument; flag:nil; val:1 ),
( name:'fDirector'; has_arg:required_argument; flag:nil; val:2 ),
( name:'fYear'; has_arg:required_argument; flag:nil; val:3 ),
( name:'fCountry'; has_arg:required_argument; flag:nil; val:4 ),
( name:'fActors'; has_arg:required_argument; flag:nil; val:5 ),
( name:'fDescription'; has_arg:required_argument; flag:nil; val:6 ),
( name:'fProducer'; has_arg:required_argument; flag:nil; val:7 ),
( name:'fOriginalTitle'; has_arg:required_argument; flag:nil; val:8 ),
( name:'fMedia'; has_arg:required_argument; flag:nil; val:9 ),
( name:'fURL'; has_arg:required_argument; flag:nil; val:10 )
);
begin
SplashWin.ProgressBar1.Position := 60;
LoadOptions;
SplashWin.ProgressBar1.Position := 60;
ApplyLanguage;
SplashWin.ProgressBar1.Position := 70;
Application.ProcessMessages;
SplashWin.Release;
SplashWin := nil;
FCatalogFile.Modified := False;
with Settings.rOptions.rFiles do
if (AutoLoad) and (AutoLoadFile <> '') then
FileToOpen := AutoLoadFile
else
FileToOpen := '';
// if ParamCount > 0 then // LA edition - removed
// begin // LA edition - removed
// s := ParamStr(1); // LA edition - removed
// if (s <> '') and (s[1] <> '/') then // LA edition - removed
// FileToOpen := s; // LA edition - removed
// end; // LA edition - removed
if FileToOpen <> '' then
FCatalogFile.Open(ExpandFileName(FileToOpen))
else
FCatalogFile.New;
if ParamCount > 0 then // LA edition
begin
if FindCmdLineSwitch('a',['-'], true) then
ActionMovieAddExecute(nil); // this action may ask user for new movie number
while CmdLineValue <> EOF_getopt do
begin
CmdLineOptionIndex := 0;
try
CmdLineValue := getopt_long( argc, argvptr^, 'a', CmdLineParametersList, CmdLineOptionIndex);
case CmdLineValue of
0: if GetInfoFromMediaFile(optarg, FrmMovie) then
begin
FrmMovie.Modified := True;
OnMovieFieldChange(Self);
end;
1: FrmMovie.ETranslatedTitle.Text := optarg;
2: FrmMovie.EDirector.Text := optarg;
3: FrmMovie.EYear.Text := optarg;
4: FrmMovie.ECountry.Text := optarg;
5: FrmMovie.EActors.Text := optarg;
6: FrmMovie.EDescription.Text := optarg;
7: FrmMovie.EProducer.Text := optarg;
8: FrmMovie.EOriginalTitle.Text := optarg;
9: FrmMovie.EMedia.Text := optarg;
10: FrmMovie.EURL.Text := optarg;
end;
except
end;
end;
if FindCmdLineSwitch('s',['-'], true) then
FCatalogFile.Save;
if FindCmdLineSwitch('e',['-'], true) then
ActionExitExecute(nil);
end;
end;