Command line support
Command line support
Hi,
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. Or maybe if you could access the .amc file right away like a db?
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. Or maybe if you could access the .amc file right away like a db?
hi [b]antp[/b]!
do you still have command-line support in your plans?
I think it is one-two hours exersice
Please add the following features there (with regards to input):
- option to add new item (new movie)
- full path to file with possibility to extract video info from it (like when drag&drop the file now)
- possibility to assign value to each field
- save and exit
For ex., I have file D:\Movies\New Good Movie.[LA].avi
Usage of amc.exe can be like
amc.exe -n -file:"D:\Movies\New Good Movie.[LA].avi" -fieldMovieName:"New Good Movie" -fieldMedia:"D:\Movies\" -x
where -n - add new record
-file - extract video info from file
-fieldFieldName - add into into FieldName
-x - save and exot
do you still have command-line support in your plans?
I think it is one-two hours exersice
Please add the following features there (with regards to input):
- option to add new item (new movie)
- full path to file with possibility to extract video info from it (like when drag&drop the file now)
- possibility to assign value to each field
- save and exit
For ex., I have file D:\Movies\New Good Movie.[LA].avi
Usage of amc.exe can be like
amc.exe -n -file:"D:\Movies\New Good Movie.[LA].avi" -fieldMovieName:"New Good Movie" -fieldMedia:"D:\Movies\" -x
where -n - add new record
-file - extract video info from file
-fieldFieldName - add into into FieldName
-x - save and exot
command line support is very useful item!
I've done first step, which will probably encourage you to add this feature in next version of AMC
Here is the code, which supports command line:
(I've used getopt component)
(I am not specialist in a coding, so, I've just chosen the easiest code... there is no good handling of errors etc. But it works.)
The following parameters in command line are supported:
-a add new item in the list (there is no sense to use command line w/o this parameter really - data will be written in frame, which doesn't belong to any movie)
-s save catalog
-x exit AMC
--moviefile file from which media info should be imported (long values and values with spaces should be passed in brackets, for ex. --moviefile="C:\Program Files\my movie.avi")
--fTranslatedTitle
--fDirector
--fYear
--fCountry
--fActors
--fDescription
--fProducer
--fOriginalTitle
--fMedia
--fURL
assing value to according field (for ex. --fOriginalTitle="The Movie")
I've done first step, which will probably encourage you to add this feature in next version of AMC
Here is the code, which supports command line:
(I've used getopt component)
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;
(I am not specialist in a coding, so, I've just chosen the easiest code... there is no good handling of errors etc. But it works.)
The following parameters in command line are supported:
-a add new item in the list (there is no sense to use command line w/o this parameter really - data will be written in frame, which doesn't belong to any movie)
-s save catalog
-x exit AMC
--moviefile file from which media info should be imported (long values and values with spaces should be passed in brackets, for ex. --moviefile="C:\Program Files\my movie.avi")
--fTranslatedTitle
--fDirector
--fYear
--fCountry
--fActors
--fDescription
--fProducer
--fOriginalTitle
--fMedia
--fURL
assing value to according field (for ex. --fOriginalTitle="The Movie")
hehe
looks like you are talking about me - I was asking a few days ago about compiling of your project
do you have a lot of users trying to compile your project?
but really this is just one .pas file...
off top: why there is google ad:
[quote]Got a movie collection? - AMC is good but we have a better
alternative named All My Movies. www.bolidesoft.com[/quote]
looks strange...
looks like you are talking about me - I was asking a few days ago about compiling of your project
do you have a lot of users trying to compile your project?
but really this is just one .pas file...
off top: why there is google ad:
[quote]Got a movie collection? - AMC is good but we have a better
alternative named All My Movies. www.bolidesoft.com[/quote]
looks strange...
hi, [b]antp[/b]!
were you able to test my code?
I've noticed one strange thing - when I compile the project (either with my code or without it) [u]some[/u] my scripts stop to work - I am getting err msgs like 'connection refused' or 'bad request', but when I use your compiled version, the same scripts work fine. Any idea what can be the reason? Have I installed Delphi or some components incorrectly?
If you have time, could you please compile the project on your machine with my code and place result exe on some rapidshare.com site for my verification? Thank you
were you able to test my code?
I've noticed one strange thing - when I compile the project (either with my code or without it) [u]some[/u] my scripts stop to work - I am getting err msgs like 'connection refused' or 'bad request', but when I use your compiled version, the same scripts work fine. Any idea what can be the reason? Have I installed Delphi or some components incorrectly?
If you have time, could you please compile the project on your machine with my code and place result exe on some rapidshare.com site for my verification? Thank you
Another usefull command-line option
Hello antp,
Another great command-line option would be to run an export command.
Something like amc.exe -e \\webserver\webroot\dvd-php\autoimp\dvd.sql -t sql
where -e filename would be export to filename & -t sql the type of export.
That would allow AMC users to run a scheduled task to daily/weekly export their database.
Thanks for considering it...
Another great command-line option would be to run an export command.
Something like amc.exe -e \\webserver\webroot\dvd-php\autoimp\dvd.sql -t sql
where -e filename would be export to filename & -t sql the type of export.
That would allow AMC users to run a scheduled task to daily/weekly export their database.
Thanks for considering it...