Skip to Content
It is currently October 17th, 2019, 6:49 pm

All times are UTC - 6 hours [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
PostPosted: September 19th, 2018, 12:20 pm 
Offline
Senior User
Senior User

Joined: June 1st, 2005, 11:46 pm
Posts: 113
Location: Cosmopolis, Washington
So, guess I better make a new post for this. Had some help with a PAL script that I was working on (thanks Mastacheata) but now I need the query for the song to also consider the rotation rules as it picks a random song based on date added.
Code:
// Declare variables
var newSongFinder : TDataSet;
PAL.Loop := False;
PAL.LockExecution;

// Choose song added in last two weeks
newSongFinder := Query('SELECT artist, title, filename, id, date_added ' +
   'FROM songlist ' +
   'WHERE DATEDIFF(CURRENT_DATE(), date_added) < :interval ' +
   'AND songtype = :songtype ' +
   'AND genre != :genre1 ' +
   'AND genre != :genre2 ' +
   ' order by rand() limit 1',[14, 'S', 'Christmas', 'Instrumental'], True);

newSongFinder.First;

IF newSongFinder['artist'] = ''
THEN begin
Cat['D2S IDs'].QueueTop(smLRP, EnforceRules);
Cat['Advertisements (All)'].QueueTop(smLRP, EnforceRules);
Cat['Tracks - Metal'].QueueTop(smLRPA, EnforceRules);
WriteLn('No new music ');
end

ELSE begin
Cat['D2S IDs'].QueueTop(smLRP, EnforceRules);
Cat['Advertisements (All)'].QueueTop(smLRP, EnforceRules);
Queue.AddFile(newSongFinder['filename'],ipTop);
Cat['New Music Announcement'].QueueTop(smRandom, EnforceRules);
WriteLn('Artist: ' +newSongFinder['artist']);
WriteLn('Title: ' +newSongFinder['title']);
end;

newSongFinder.Free;
PAL.UnlockExecution;

_________________
https://deadtoselfradio.com
https://fuelradio.net


Top
 Profile  
 
PostPosted: September 19th, 2018, 12:48 pm 
Offline
Senior User
Senior User

Joined: June 1st, 2005, 11:46 pm
Posts: 113
Location: Cosmopolis, Washington
please disregard this... fixed. thanks again Mastacheata

_________________
https://deadtoselfradio.com
https://fuelradio.net


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group