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

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: January 4th, 2019, 12:21 pm 
Offline
New User
New User

Joined: December 31st, 2018, 3:33 pm
Posts: 3
Hi Folks,

We use Clockwheel scripts to get SAM to queue up songs. For example, here is one such Clockwheel that we are using that has just one simple line:

Code:
//SamsJams10.cwf
// added 04Jan2019

Cat['Music (All)'].QueueBottom(smRandom, EnforceRules);


We are looking for a way to add an ‘extra rule’ here where the clock wheel would only select songs that are 5 minutes of less in length. Is there a way to modify the above clockwheel to achieve this?

I have read this thread:
http://support.spacialaudio.com/forums/viewtopic.php?f=23&t=54708&p=220120&hilit=clockwheel#p220120

Which shows this code:

Code:
var theSongChooser : TDataSet;

PAL.Loop := true;
//
// Choose a song less than 5 mintues (3000000 msec)
//

 theSongChooser := Query('SELECT artist, title, filename, duration, id ' +
                                    'FROM songlist ' +
                                     'WHERE songtype = ''S'' ' +
                                     'AND duration < ''300000'' ' +
                                     'ORDER BY RAND() LIMIT 1', [], true);

//
// Add it to Queue
//
Queue.AddFile(theSongChooser['filename'], ipBottom);

WriteLn('Added: ' + QuotedStr(theSongChooser['artist']) + ' --- ' + QuotedStr(theSongChooser['title']));
WriteLN ( 'Duration: ' + IntToStr(theSongChooser['duration']) + ' milliseconds or ' + (FloatToStr(theSongChooser['duration']/60000)) + ' Minutes');

PAL.WaitForPlayCount(1);


It looks promising, but I am not sure how to modify our clockwheel script to adopt this behaviour. Where do I put our category 'Music (All)’, how can I specify QueueBottom and the smRandom?

I apologize in advance that we are not coders. Any advice is much appreciated. If someone can help us with the code, we would appreciate it greatly.

Thank you

-Eric in Stella, Ontario Canada (Amherst Island Radio 92.1 FM)


Top
 Profile  
Reply with quote  
PostPosted: January 5th, 2019, 8:11 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7878
Location: Aachen (Germany)
erict1000 wrote:
Where do I put our category 'Music (All)’

Music (All) is no category. It's just a fancy label for all Type S tracks in your library. That's already covered by the script.

If you ever want to pick from an actual category, you'd have to heavily modify the SQL query in that script to limit the search results to those IDs that match songIDs in the categorylist table and limit those to the categoryID that matches the ID in the categories table that matches your category name. (I told you it's complicated)

erict1000 wrote:
, how can I specify QueueBottom

That's already taken care of over here (ipBottom => insert position Bottom):
erict1000 wrote:
Queue.AddFile(theSongChooser['filename'], ipBottom);


erict1000 wrote:
and the smRandom?

That's part of the Query (the results of the SQL query are orderd by a random number and the result count is limited to only ever list 1 track):
erict1000 wrote:
ORDER BY RAND() LIMIT 1

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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