Page 1 of 1

Scripting

Posted: Sat Feb 22, 2014 1:17 pm
by viply1
Hi,

Just need a small help in scripting

When i load the cover from an album the description says 'album cover' in description of the artwork

I however want it to be blank. any solution how i can go about changing it?

Re: Scripting

Posted: Sat Feb 22, 2014 1:52 pm
by jtclipper
There is a default script '#load_coverex.sct' that displays how more complex tasks can be accomplished.
The following is a modification that loads 'folder.jpg' but does not add any description for the added picture:

Code: Select all

Program PictureFromFileEX2;
var
  i: integer;
  sCoverFile: string;
  ms: TmemoryStream;
begin
  if not tg_init then exit;
  i := 1;
  ms := TMemoryStream.Create;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );
  repeat
    tg_loadFile;
    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );
    sCoverFile := ExtractFilePath( gTag.Filename ) + 'folder.jpg' ;
    if FileExists( sCoverFile ) then begin
       ms.Clear;
       ms.LoadFromFile( sCoverFile )
       gTag.ClearPictures; // remove any existing !!
       gTag.AddPicture( ms, '', 'jpg', 3 );
       gTag.SaveToFile( 0, false, false );
       tg_RefreshRow;
       tg_setResult( 'OK' );
    end;
    i := i + 1;
  until not tg_skip;
  ms.Free;
end.
The Paramaters for gTag.AddPicture
1=memory stream containing the actual data
2=Descriprion
3=mime type
4=Cover type
Cover type Constants:

Code: Select all

0  Other
1  32x32 pixels file icon (PNG only)
2  Other file icon
3  Cover (front)
4  Cover (back)
5  Leaflet page
6  Media (e.g. lable side of CD)
7  Lead artist/lead performer/soloist
8  Artist/performer
9  Conductor
10 Band/Orchestra
11 Composer
12 Lyricist/text writer
13 Recording Location
14 During recording
15 During performance
16 Movie/video screen capture
17 A bright coloured fish
18 Illustration
19 Band/artist logotype
20 Publisher/Studio logotype

Re: Scripting

Posted: Sun Feb 23, 2014 11:56 am
by viply1
Im sorry :( But im not that great a coder and i dont know much on gtag. Could you please let me know how to add a parameter for the 'Description' in the above code

EDIT - Ok No problem. Got it working. Thank you ! :)

Re: Scripting

Posted: Wed Oct 01, 2014 8:47 am
by aron123
Thanks for share...