Note that this Wiki is a work in progress, items may not be updated or may disappear entirely as the pages are updated.
PAL: Marking items in category as overlay=yes
From SpacialAudio
Question:
I need to tag content as overlay=yes for 1-to-1 targeting. Doing this manually is too much work. How can I automate this process?
Answer:
The PAL script below will look for all the files in a particular category and then adjust their settings directly with a database SQL query. The script will run once an hour (at 7 minutes past the hour).
Thus, all you need to do is drag all the content you need tagged into this category and every hour their settings will be adjusted.
//==============================================================================
// Custom settings - Please change these as required
//==============================================================================
const categoryName = 'TargetFiller';
// IMPORTANT: You must manually create the above category under the "Tracks" category
// Then you must drag all items you wish to use as targeting filler into this
// category.
//==============================================================================
var categoryID : Integer = 0;
var Q : TDataSet;
var changed : Integer = 0;
//Retrieve categoryID of the named category
Q := Query('SELECT ID FROM category WHERE name = :name',[categoryName], true);
if Q.BOF and Q.EOF then
begin
WriteLn('Category not found: '+categoryName);
WriteLn('Please make sure you create this category');
end
else
begin
Q.First;
categoryID := Q['ID'];
WriteLn('Category ID found: '+ IntToStr(categoryID));
WriteLn('Updating all items in category...');
end;
Q.Free;
//Update all files in category
if (categoryID>0) then
begin
changed :=
ExecSQL('UPDATE songlist SET xfade=:xfade, overlay=:overlay '+
' WHERE ID IN (SELECT songID FROM categorylist WHERE categoryID = :categoryID)',['&c=1&ge=0','yes',categoryID]);
WriteLn(IntToStr(changed)+' Items updated');
end;
//Run this process once an hour, at 7min after the hour
PAL.WaitForTime('XX:07:00');
PAL.Loop := true;
Instructions:
- Open up SAM Broadcaster
- In the Category tree under Playlist, create a new category called TargetFiller.
- Now copy & paste the PAL script below into a text file called OverlayCategory.pal and load it into SAM Broadcaster as a PAL script.
- Make sure to set it to auto-start when SAM loads so you do not have to manually start it every time.
- Drag any tracks you need tagged to the TargetFiller category.
- Run the PAL script.
- Once it has completed one run, it will wait an hour before running again. (You can of course adjust this if needed)
- All content in the TargetFiller category will now have their overlay setting set to yes.
Tip: Use this PAL script in combination with the General Overlay rotation PAL script.
