Save tags

Hello,
The current script line: currentItem := CurrentPlaylist.GetItem(i).SaveTags;

ensures this error: (48:47): Unknown identifier ‘SAVETAGS’

How to fix?
Thanks,
Joris

Joris, you need to break this into two lines:

currentItem := CurrentPlaylist.GetItem(i);
currentItem.SaveTags;

Hope that helps!

BFN
Cad

Also, instead of currentItem.SaveTags, use the following syntax in v4.x:

IFilePlaylistItem(currentItem).GetFileTypeHandler.WriteTags;

Hello,

Thanks for the help but is still get an error… Yet another idea?
This is the whole script:

// CreateHookContainer - Script to automate the creation of Hook Container based on 

a playlist.
// Written by Alexis
// Some parts of this script based on IVP-MarkEndings.
// Written by Cad Delworth, Leith FM, Edinburgh, Scotland
// http://www.leithfm.co.uk
// And also Add advertisements and news
// by Vincent Volmer and Cad Delworth

const
// Name of script, used as a prefix to all SystemLog messages
// If you change this, keep a colon and space as the last two characters.
  SCRIPTNAME = 'CreateHookContainer: ';

// Minimum effective duration of a song (default: 900 million, =90 seconds)
  SONG_MIN_LENGTH = 900000000;

// Variables
var
  i, iItemCount, iMax: integer;
  i64Duration: int64;
  sArtist : string;
  sMessage, sPlaylist, sTitle: string;
  currentItem, ItemHook, ItemHook2: IPlaylistItem;
  ads: IContainerPlaylistItem;
  adsPlaylist, newPlaylist: IPlaylist;
  adsContainerAsPlaylistItem, piNews: IPlaylistItem;
  sFileName: string;
i64HookIn, i64HookFade, i64HookOut: int64;


procedure MarkupCurrentPlaylist;
begin

// Reset counters etc.
  iMax := iItemCount - 1;

// Display our start up message
  SystemLog(SCRIPTNAME
    + 'Checking the playlist, looking for songs with Hooks.');

// Step through each item in the current (selected) Playlist
  for i := 0 to iMax do
  begin

    
// Create a local reference to the current item
// This makes all subsequent code easier to read and slightly faster to process
    currentItem := CurrentPlaylist.GetItem(i);
    currentItem.SaveTags;

// Store the current item's Artist, Title, and Effective Duration
    sArtist := currentItem.GetArtistsString;
    sTitle := currentItem.GetArtistsString;
    i64Duration := currentItem.GetEffectivePlaybackDuration;

// Is this a song?
    if i64Duration >= SONG_MIN_LENGTH then
    begin
      

// Add the song to the container and set it to a hook.


ItemHook := IPlaylistItem(currentItem).Clone;

ads.GetPlaylist.Add(ItemHook);

i64HookIn := ItemHook.GetCuePosition(ptHookIn).GetValue
i64HookFade := ItemHook.GetCuePosition(ptHookFade).GetValue
i64HookOut := ItemHook.GetCuePosition(ptHookOut).GetValue

ItemHook.GetCuePosition(ptCueIn).SetValue(i64HookIn);
ItemHook.GetCuePosition(ptStartNext).SetValue(i64HookFade);
ItemHook.GetCuePosition(ptCueOut).SetValue(i64HookOut);



SystemLog(SCRIPTNAME + 'Item '
        + IntToStr(i + 1)
        + ' ('
        + Trim(currentItem.GetArtistsString)
        + ' / '
        + Trim(currentItem.GetArtistsString)
        + ') '
        + '.');

    end;
      

  end;  // of for... loop

// All Playlist items processed, inform user

  SystemLog(SCRIPTNAME + 'Checking done.');

end;


// MAIN CODE STARTS NOW
begin

// Store the current Playlist number as a string, for SystemLog messages
  sPlaylist := IntToStr(CurrentPlaybackControl.GetIndex + 1);
 iItemCount := CurrentPlaylist.GetCount;

// Create a new Container Item
  ads := Factory.CreateContainerPlaylistItem;
// create a copy of the reference as an IPlaylistItem interface
   adsContainerAsPlaylistItem := IPlaylistItem(ads);

// Launch the script
    MarkupCurrentPlaylist;

// Add Container and change his title
    adsContainerAsPlaylistItem.SetTitle('Hook Container');
    // Add Container PlaylistItem to current Playlist
    CurrentPlaylist.Add(adsContainerAsPlaylistItem);

end.

Joris

I think the script was written for an old version of mAirList and needs a couple of changes for v4.

In particular, time units are no longer int64 but float now (seconds with decimal fraction). And cue positions can be retrieved using a plain call GetCuePosition(ptCueIn) instead of GetCuePosition(ptCueIn).GetValue, and modified with SetCuePosition(ptCueIn, newvalue).