Page 1 of 1

set current movie in script

Posted: 2014-02-18 18:05:33
by J
hi,

is there a way to set the current movie with/from a variable in a script?

I want to script-import a lot of pictures from disk as an extra to the corresponding movies in the catalog. The picture name format is "movienumber_picnumber.jpg" (e.g. 635_1.jpg).

how can I add this example picture as an extra to movie with number 635?
Func ImportExtraPicture() imports to current movie, which is always first movie.

What I need is either set the current movie to "movienumber" or a function to import to a specific movienumber.

thanks
J.

[solved]

Posted: 2014-02-19 19:44:24
by J
OK,

made two solutions just in case someone might have usage for this too.
All pictures are in one directory with naming convention text_movienumber_picturenumber.jpg (e.g. Filme_635_1.jpg)

1: New function "SetActualMovie(movienumber);" to set current movie needed:

Code: Select all

program picture_helper;

uses
  StringUtils1;
  
var
  DirList: TStringList;
  counter, index: integer;
  picture, movienumber: string;
  
begin
  DirList := TStringList.Create;
  DirList.Text := ListDirectory('D:\MPtest\', '*.*');

  for counter := 2 to DirList.Count - 1 do
    begin
	  picture := TextBefore(DirList.GetString(counter), #09, '');
	  movienumber := TextBetween(picture, '_', '_');
	  SetActualMovie(movienumber);  // needed function !
	  index := AddExtra;
	  ImportExtraPicture(index, 'd:\mptest\' + picture);
	  SetExtraField(index, eCategory, 'Stills');
	end;

  DirList.Free;
end.
2: Nothing needed, just works

Code: Select all

program picture_helper_2;

uses
  StringUtils1;
  
var
  DirList: TStringListEx;
  index: integer;
  picture, movienumber: string;
  
begin
  if GetIteration = 0 then 
    begin
		DirList := TStringListEx.Create;
		DirList.Text := ListDirectory('D:\MP\', '*.*');
		DirList.Delete(0);
		DirList.Delete(0);
		DirList.NaturalSort;
	end;
  
  movienumber := TextBetween(DirList.GetString(0), '_', '_');

  while GetField(fNumber) = movienumber do
    begin
		picture := TextBefore(DirList.GetString(0), #09, '');
		index := AddExtra;
		ImportExtraPicture(index, 'D:\MP\' + picture);
		SetExtraField(index, eCategory, 'Stills');
		DirList.Delete(0);
		movienumber := TextBetween(DirList.GetString(0), '_', '_');
	end;

  if GetIteration = GetIterationCount-1 then DirList.Free;
end.
have fun.

EDIT:
Fixed a little sorting thing.

Posted: 2018-02-18 10:16:00
by fulvio53s03
Please, where can i find function SetActualMovie ? :??:
Thanks.
:??: