Page 1 of 1
Command line support
Posted: 2003-06-05 09:10:27
by Willspo
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?
Posted: 2003-06-05 09:18:43
by antp
I planned to add that, but I reported it to later.
If somebody wants to make a program that exports the amc file, I can give the file needed for that : it is simple two .PAS file (Delphi 6) that gives you TMovie and TMovieList classes allowing to browse the amc file.
Posted: 2003-06-05 10:12:13
by Willspo
Can you mail the two files to me?
Posted: 2003-06-05 11:28:52
by antp
Sure.
I'll do that this evening
Posted: 2007-11-04 19:03:17
by LA
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
Posted: 2007-11-04 19:20:25
by antp
There are so many things in my to-do list that I could do in 1 or 2 hours
That one does not have an especially high priority. Couldn't it be made with some automation tool?
Posted: 2007-11-06 19:50:35
by LA
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)
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")
Posted: 2007-11-06 21:47:05
by antp
Thanks, I'll check that. I am not sure that adding again one more component is a very good idea (users already complain that there are too many
)
Posted: 2007-11-07 05:00:57
by LA
otherwise you'll have to write your own function to parse command line.. there is no sense to do it since it is already exists. moreover, getopt one of the best (at least, I was told so
)
and, does it really matter for USERS how many components you used?
Posted: 2007-11-07 14:34:55
by antp
For those that want to recompile the code, I mean.
And I do not like much having lots of dependencies.
Though that if it is just a .pas file to include and not a VCL to register it is not a problem.
Posted: 2007-11-07 17:18:09
by LA
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...
Posted: 2007-11-07 18:26:00
by antp
You were not the first one to ask help for compiling it
About the ad, indeed it may look strange, but in a way the fact that their ad show here means that they give me money for that (as when users click, Google gives me a part of what the software company has to pay to Google)
Posted: 2007-11-17 11:30:18
by LA
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
Posted: 2007-11-17 18:18:37
by antp
Sorry I did not had time yet.
This error that you have is interesting: it may be caused by a different version of the Indy library (I do not really see what else
). Which version do you have?
Another usefull command-line option
Posted: 2008-07-04 14:40:08
by Tyrell66
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...
Posted: 2008-07-04 14:59:07
by antp
command-line export is still on my to-do list (I know, I already said few years ago that it was planned...
)
Posted: 2010-04-02 15:26:04
by LA
Hi!
hope, you've implemented command line support
checking my backups now and wanted to delete the source code of my version of AMC with command line support
Posted: 2010-04-02 17:18:06
by antp
Hi
... still on the to do list.
I haven't really worked on AMC since then.
I doubt that in the next months/year I'll have time to work on that. I already do not know when I'll make the most urgent feature: good compatibility with Vista/7...