Hook Script

I know that in the German section of this forum there is a thread about a hook script; This script plays 3 Hooks from songs coming up in the next playlist, at the end of former playlist or at the beginning of actual playlist.

Soon I will have holidays and will have time to set Hooks. At least, that what I understand: Hooks must be set in order to use this songs. My knowledge of the German language lacks so I don’t understand the rest at all :-[.

Is there a forum member able and willing to tell more about this script and how it works in mAirList 4.2.1 ?

Well, I haven’t got the very latest release, but I do know about Hooks!

Like Ramps, you have to manually set Hooks, using the Tag Editor or any of the other parts of mAirList which allow you to set cue points. Where do you set them? Well, that’s completely up to you! Pick a part of the song that ‘sums it up’ and which your listeners will recognise immediately.

You do need to set a HookIn and HookOut point, and a HookFade point is recommended if you inted to crossfade between them, perhaps with a SFX or sting in between.

Sorry, but I don’t know the script you mean; however, once you have set the Hooks up, I guess it should ‘just work?’

Hope that’s some help.

BFN
Cad

Cad, thanks but I know how setting hooks works.

The question is how to use the script and more info please about the script, which is discussed in the German part of this forum. As far as I understand, this script picks 3 hooks of songs, coming up in the next hour / playlist and places them in a container. Really like this thought.

Können Sie mir helfen, bitte, Deutsche leuten :wink: ?

OK adriaan, my apologies!

I’m somewhat busy for the next week or two so maybe someone else can help.

BFN
Cad

I’m using this script in mAirlist 4.3

Run it after loading the playlist for the next hour, it will look for the Top of the hour dummy object, and after that will search for 3 songs with hooks and create the container with a opener, middle and closer and then put the the container after top of the hour dummy.

[code]var
i, iItemCount, iMax, iVol, iToth: integer;
i64Duration: TTimeValue;
sArtist : string;
sMessage, sPlaylist, sTitle : string;
currentItem, ItemHook, ItemHook2: IPlaylistItem;
ads: IContainerPlaylistItem;
adsPlaylist, newPlaylist: IPlaylist;
adsContainerAsPlaylistItem, piNews: IPlaylistItem;
sFileName, sOpener, sCloser, sMiddle: string;
i64HookIn, i64HookFade, i64HookOut: TTimeValue;

const SONG_MIN_LENGTH = 900000000;

procedure startMarkup;
begin

for i := 0 to Playlist(0).GetCount -1 do
begin

if Playlist(0).GetItem(i).GetTitle = ‘Top of the hour’ then begin
iToth := i;
SystemLog(Playlist(0).GetItem(i).GetTitle);
break;
end;
end;

end;

procedure MarkupCurrentPlaylist;
begin

// Set values (REPLACE THESE WITH YOUR OWN)
sOpener := ‘Opener.mp3’;
sMiddle := ‘Middle.mp3’;
sCloser := ‘Closer.mp3’;

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

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

ads.GetPlaylist.InsertFile(0, sOpener, [fitMMD, fitTags, fitNativeTags, fitDuration, fitTilde, fitAutoCue, fitDatabaseLookup]);

// Step through each item in the current (selected) Playlist
for i := iToth + 2 to Playlist(0).GetCount -1 do
begin

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

// Store the current item’s Artist, Title, and Effective Duration
sArtist := currentItem.GetArtist;
sTitle := currentItem.GetTitle;
i64Duration := currentItem.GetDuration;

// Is this a song?
if 0 >= 0 then
begin

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

ItemHook := iPlaylistItem(currentItem.Clone);

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

if (i64HookIn > 0) then
begin
// SystemLog(‘Added’);
ads.GetPlaylist.Add(ItemHook);
if (iVol < 2) then
begin
ads.GetPlaylist.InsertFile(ads.GetPlaylist.GetCount, sMiddle, [fitMMD, fitTags, fitNativeTags, fitDuration, fitTilde, fitAutoCue, fitDatabaseLookup]);
end;
ItemHook.SetCuePosition(ptCueIn, i64HookIn);
ItemHook.SetCuePosition(ptFadeOut, i64HookFade);
ItemHook.SetCuePosition(ptStartNext, i64HookFade);
ItemHook.SetCuePosition(ptCueOut, i64HookOut);
ItemHook.SetArtist('Coming up: '+ currentItem.GetArtist);
iVol := iVol + 1
end;

if (iVol = 3) then
begin
break;
end;

SystemLog('Hook: ’ + ‘Item ’
+ IntToStr(i + 1)
+ ’ (’
+ Trim(currentItem.GetTitle)
+ ’ / ’
+ Trim(currentItem.GetArtist)
+ ') ’
+ ‘.’);

end

end; // of for… loop

// All Playlist items processed, inform user

 if (ivol < 3) then
 begin
 ads.GetPlaylist.Delete(ads.GetPlaylist.GetCount -1);
 end;

ads.GetPlaylist.InsertFile(ads.GetPlaylist.GetCount, sCloser, [fitMMD, fitTags, fitNativeTags, fitDuration, fitTilde, fitAutoCue, fitDatabaseLookup]);

SystemLog('Hook: ’ + ‘Checking done.’);

end;

begin

// Create a new Container Item
ads := Factory.CreateContainerPlaylistItem;

// create a copy of the reference as an IPlaylistItem interface

adsContainerAsPlaylistItem := IPlaylistItem(ads);
startMarkup;
MarkupCurrentPlaylist;

adsContainerAsPlaylistItem.SetTitle(‘Coming Up Next’);

Playlist(0).Insert(iToth + 1, adsContainerAsPlaylistItem);

end.[/code]

wiele, thanks! This is exactly what I was looking for!

I’m going to implement this script. I use mAirList Home Studio version 4.2.1 build 1674.

Some more questions, if you don’t mind (I have not used a script before):

[ol][li]Where and how do I install the script? Can the script run like a event?[/li]
[li]I want the container to be created at the end of a playlist, at a fixed time. Not TOTH. Is this possible?[/li][/ol]

Thanks in advance,
Adriaan

So…holidays…last couple of days, i have set > 1000 hooks on my songs in the database. And…the script works like a charm ;D !

When firing this script, the songs in the container are displayed on my “now playing” >:(. Is there a way to exclute this songs from Now Playing Info?.

The played hooks can also be found in the history of the song btw, would also be nice if that could be avoided somehow.

hi,

sry for bad english.
is it possible that send the ID3tags to stop? and if yes, then please: how?

is it possible that send the ID3tags to stop? and if yes, then please: how?

No, not possible yet.

I’m trying to get this script work. Tried a few things, but nnow I’m getting the message that the item is not cueable (runtime error 72.1) or an acces violation in module mairlist.exe
What I’m doing wrong?