If you have questions about my code or site....

Free VB and Excel utilities & scripts for my fellow webcasters and for general use.

If you have questions about my code or site....

Postby George on Thu Jan 29, 2009 10:24 pm

Please post your questions in this forum instead of sending me a private message.

Q & A that occurs in private is not helpful to others, so I won't answer questions that are asked privately. Sorry.

If you recently sent me a question via private message and you're still hoping for a response, please re-ask your question here in the public section of the forum.

Thanks.
Image
User avatar
George
Site Admin
 
Posts: 128
Joined: Mon Jul 31, 2006 9:00 pm
Location: SF Bay Area, California, USA

Re: If you have questions about my code or site....

Postby skychick on Sat Jan 31, 2009 2:09 pm

Hi George,

Thanks for posting your current song rotation script. It is great! I have loaded it and am running some tests with it and I have a few questions. I would like to use multiple copies of this script. Some of the copies would replace each other (meaning one would stop via an IF statement in the code waiting for a particular date and time and another kick off via the event scheduler) but others would need to run at the same time for example in the case where you might want to add a song of a specific genre at certain times of the day.

I know it would probably be more practical just to add code to the original script to choose different playlist selection rules when it is time to add the specific genre track however it might convolute the code a bit and also make it harder to remove if you wanted to disable it after a while.

My question is will there be any issues with performance if I have a few copies of the script running and will there be any contingency problems with the queue datasets (for songs in the queue and requests in the queue) that the script writes out if I have multiple scripts writing those?

Also, how did you come up with your combinations of Artist, Album, Title, and Track last Played values? Did you use any sort of statistical formula or logic?

And is there any way to keep a count of the number of times the script is 'Unable to Load a Song' so that you know if your rules are too strict? I tried adding a failure counter but it gets re-set each time the PAL loops even if I put it first in the script. It would be nice to be able to let the script run for a few weeks and then see if certain criteria are never being met. I have run queries on the database and have determined we have enough artists to go well over 2 weeks without a repeat but still, it would be nice to know if the script needs tweaking.

Thanks
Skychick :-D
skychick
Settling In
 
Posts: 4
Joined: Sun Jan 25, 2009 6:08 pm

Re: If you have questions about my code or site....

Postby George on Sat Jan 31, 2009 3:29 pm

Skychick,

Thanks for the kind words, I am glad that you've found my script useful. :) Regarding your questions....

skychick wrote:My question is will there be any issues with performance if I have a few copies of the script running and will there be any contingency problems with the queue datasets (for songs in the queue and requests in the queue) that the script writes out if I have multiple scripts writing those?

I've never had more than a single instance of the PAL running at the same time, so I could only offer a guess. I don't think that multiple instances would cause problems with the song selections, but it might tax your PC's resources with all of those extra queries running. The only way to find out is to try it. :)

skychick wrote:Also, how did you come up with your combinations of Artist, Album, Title, and Track last Played values? Did you use any sort of statistical formula or logic?


I didn't use any formula or logic. I just did some estimating at first, and then a lot of tweaking.

skychick wrote:And is there any way to keep a count of the number of times the script is 'Unable to Load a Song' so that you know if your rules are too strict? I tried adding a failure counter but it gets re-set each time the PAL loops even if I put it first in the script. It would be nice to be able to let the script run for a few weeks and then see if certain criteria are never being met. I have run queries on the database and have determined we have enough artists to go well over 2 weeks without a repeat but still, it would be nice to know if the script needs tweaking.


The only way to do this would be to write the counter out to a text file, or to the database, so that the value will not be reset each time the script makes another pass-through. This can be done with PAL, but I haven't had a reason to do it so I haven't experimented with it.

I don't mind it when the script frequently results in 'Unable to Load a Song' because that tells me that I am reaching back to try to find stuff that hasn't played in a while. Some of those attempts will fail, but some will succeed. If the script never results in 'Unable to Load a Song' then the rules are too low. I don't want 'Unable to Load a Song' to occur for long periods of time, but if it takes a minute or 2 for the PAL to grab an acceptable song that's OK with me.
Image
User avatar
George
Site Admin
 
Posts: 128
Joined: Mon Jul 31, 2006 9:00 pm
Location: SF Bay Area, California, USA

Re: If you have questions about my code or site....

Postby maxvolume on Sat Feb 14, 2009 12:04 pm

Hi George

I am trying to get my playlist.php page sorted bt band name like yours is, instead of listing by band name and showing every song all in one list.

I am looking to have it sorted by Artist like yours, then, when clicked on, have all the songs from that artist listed. Or a 2nd column with their Cd titles listed and once a Cd title is clicked, a 3rd column lists the songs from that cd. maybe using iframes or something.

Since I have a very large playlist (30,000-40,000 tracks), my listeners are requesting a simplified way to scan the list, and sorting by Artist would be much nicer and less congested.

Could you help me with my issue? Thank-you for your time and help.
maxvolume
Familiar Face
 
Posts: 14
Joined: Tue Jan 13, 2009 8:57 am

Re: If you have questions about my code or site....

Postby skychick on Sat Feb 14, 2009 12:54 pm

Hi George,

Thanks for your reply. I ran SAM with two copies of your script for 2 weeks and it appeared to do fine with no contention issues. One copy was selecting the general playlist and the other copy would select a classic rock track to stick at the top of the queue once an hour so it was basically in a wait state most of the time but I was just worried about having an issue with two scripts creating temporary tables with the same name. It didn't appear to happen, or if it did, it didn't crash at least.

Speaking of crashing, what does the memory leak warning statement do? Is that a check for a storage violation and if so, when it is set to true, how does it warn you? Is this to keep it from crashing if there is a leak?

I know I can use the event scheduler to start another copy of your script but is there a way that I can have one copy of your script start a second copy right before ending without having to involve the scheduler? This way I could have the gereral music script run until 10am, then have it start off the second copy of the script that has different rules and playlists to choose from and then after 2 hours, re-start the general version of the script. This would be optimum. Is there a command to do that?

The other issue I am still having is repetition of artists. I have tweaked the rules trying to prevent this but left 1/3 of the rules set to 2 days between same artist. Problem is, about half of the artists have played 3 or 4 songs and the other half of the artists have not played anything after a 2 week test. I hate to set the artist re-play factor to a week or more because then you will never hear your favorite artist but once a week or more but I also hate to see SAM never hit that part of the database and the same artists chosen over and over. I even added some other sort methods to try and improve the chances of other artists being chosen without much effect. With a small database this probably would not be noticed but we have enough different artists to go over 2 weeks without a repeat so to hear the same artist routinely every 2 days is obvious.

Can you think of any other way to get the selection choices a little more random? Not that the script isn't already doing that. Perhaps I just need to further tweak the rule choices...

Also, is there a way thru PAL to re-set the number of songs for SAM to keep in the queue to something other than zero so that once I stop your script, SAM will start using the clock rules to fill the queue? I assume this would be the only way to switch back and forth between populating the queue from a script to having SAM populate the queue.

Thanks,
Skychick
skychick
Settling In
 
Posts: 4
Joined: Sun Jan 25, 2009 6:08 pm

Re: If you have questions about my code or site....

Postby George on Sat Feb 28, 2009 8:35 am

maxvolume wrote:Hi George

I am trying to get my playlist.php page sorted bt band name like yours is, instead of listing by band name and showing every song all in one list.

I am looking to have it sorted by Artist like yours, then, when clicked on, have all the songs from that artist listed. Or a 2nd column with their Cd titles listed and once a Cd title is clicked, a 3rd column lists the songs from that cd. maybe using iframes or something.

Since I have a very large playlist (30,000-40,000 tracks), my listeners are requesting a simplified way to scan the list, and sorting by Artist would be much nicer and less congested.

Could you help me with my issue? Thank-you for your time and help.

My system has a lot of customizations and tweaks, so it would be difficult for anybody else to implement. You'd probably have fewer headaches if you try this method...

http://support.spacialaudio.com/forums/viewtopic.php?f=22&t=26963&start=0&st=0&sk=t&sd=a
Image
User avatar
George
Site Admin
 
Posts: 128
Joined: Mon Jul 31, 2006 9:00 pm
Location: SF Bay Area, California, USA

Re: If you have questions about my code or site....

Postby George on Sat Feb 28, 2009 8:48 am

skychick wrote:Speaking of crashing, what does the memory leak warning statement do? Is that a check for a storage violation and if so, when it is set to true, how does it warn you? Is this to keep it from crashing if there is a leak?


The PAL documentation can answer that more clearly than I can....

If MemoryLeakWarning is set to True it will warn you about possible memory leaks.

PAL scripts do automatic garbage collection when the end of the script is reached. (Even if Loop is set to True)

Garabage collection refers to the process of automatically freeing all objects and memory allocated during the execution of the PAL script.

If you have a script that allocated a lot of objects without freeing those objects, you might run into resource problems an cause SAM Broadcaster to crash.

Turning MemoryLeakWarning on might help you find obejcts that are not properly getting freed during the cource of the script.


By having it set to True, you are telling the PAL to let you know if the script has flaws that are hogging memory.

skychick wrote:I know I can use the event scheduler to start another copy of your script but is there a way that I can have one copy of your script start a second copy right before ending without having to involve the scheduler? This way I could have the gereral music script run until 10am, then have it start off the second copy of the script that has different rules and playlists to choose from and then after 2 hours, re-start the general version of the script. This would be optimum. Is there a command to do that?


As far as I know, a PAL is incapable of starting another PAL. I've never had a need to do that kind of thing, so I have never investigated it. I think you'd have to use the Event Scheduler to start each PAL and have code within each PAL that tells that PAL when to stop running. If there is a better way, I don't know of it.

skychick wrote:The other issue I am still having is repetition of artists. I have tweaked the rules trying to prevent this but left 1/3 of the rules set to 2 days between same artist. Problem is, about half of the artists have played 3 or 4 songs and the other half of the artists have not played anything after a 2 week test. I hate to set the artist re-play factor to a week or more because then you will never hear your favorite artist but once a week or more but I also hate to see SAM never hit that part of the database and the same artists chosen over and over. I even added some other sort methods to try and improve the chances of other artists being chosen without much effect. With a small database this probably would not be noticed but we have enough different artists to go over 2 weeks without a repeat so to hear the same artist routinely every 2 days is obvious.

Can you think of any other way to get the selection choices a little more random? Not that the script isn't already doing that. Perhaps I just need to further tweak the rule choices...


There's no perfect way to do that, you'll have to experiment with rule choices. You could configure the script to always sort by date_played in order to always grab the least recently played song from among the songs returned by the database query. I engage in a lot of trial and error and frequent tweaking.

skychick wrote:Also, is there a way thru PAL to re-set the number of songs for SAM to keep in the queue to something other than zero so that once I stop your script, SAM will start using the clock rules to fill the queue? I assume this would be the only way to switch back and forth between populating the queue from a script to having SAM populate the queue.


This command will clear the queue:

Queue.Clear;

Is that what you're looking for?
Image
User avatar
George
Site Admin
 
Posts: 128
Joined: Mon Jul 31, 2006 9:00 pm
Location: SF Bay Area, California, USA

Re: If you have questions about my code or site....

Postby skychick on Sun Apr 26, 2009 12:49 am

Hi George,

Well we have been using your script for months and it is working out great. We are hearing a much wider range of music now with the randomness that the script is providing which is what we had hoped for.

We have only had one minor glitch where the script failed :shock: and that was actually due to one of our scripts. We have scripts that load talk programs into the queue and one day we didn't receive a particular program, so the folder where the show was to be stored was empty. The script that loads the show does a clear queue, loads the program and then does a fade to next. Well since there was nothing to fade to and since no song "ended" and the queue was empty, the script just waited. :o

I wasn't sure why we had our script clear the queue before loading a program, other than the fact that you don't have to load things up in reverse order. In any event, adding something like an ID to be loaded before the program would probably prevent a situation where nothing gets queued.

Our solution was to turn auto dj mode on so that in the case where nothing is in the queue, it will play something. Once that plays, the script takes over again and fills the queue.

The question I asked at the end of my last message wasn't about how to clear the queue, I wanted to know how to get SAM to start using my clock rules once I end the PAL script. In order to use your script, I changed my clock rule settings to say keep 0 in the queue. This way, my clock rules aren't trying to load songs at the same time that the PAL script is loading songs. Once I end the script though, I wanted a way re-invoke my SAM clock rules again.

One idea we thought of however was to change the clock rules number to keep in the queue to be a few less than we set the PAL script to keep in queue . That way, the PAL will always keep populating the queue and once it stops and the queue falls below the SAM keep in queue figure, the SAM clock rules will take effect. It sounds logical but I haven't tested this yet. :-?

There are a couple other thing that I would like to do that I am not sure of how to do. One is to have a script load an entire album up to play one night a week. I would like it to pick the album at random from a playlist. Each album has it's own folder so perhaps I need to store a list of all the folders somewhere to pick from?

The other thing is I would like to be able to tell SAM to play an entire playlist in order, like a pre-planned playlist that a dj has created and saved. I know there is a way to do this but I am not sure how. Any ideas would be appreciated.

Thanks, :-D
Sharon
skychick
Settling In
 
Posts: 4
Joined: Sun Jan 25, 2009 6:08 pm

Re: If you have questions about my code or site....

Postby johnnyo on Sun Oct 11, 2009 2:43 pm

I am intersted in posting my now playing on my myspace page could you please tell me how you did it?

Thanks,
John
johnnyo
Settling In
 
Posts: 1
Joined: Sun Oct 11, 2009 1:55 pm
Location: Kentucky U.S.A.

Re: If you have questions about my code or site....

Postby George on Fri Nov 06, 2009 5:19 pm

For myspace, I display my "Now Playing" info by writing it on a .png image file every time there is a song change. Since myspace doesn't allow us to display PHP content from our own domains, I figured I'd dynamically write to an image and then have myspace simply display the image. It is the same technique that shows the current song on the image below, in my signature.
Image
User avatar
George
Site Admin
 
Posts: 128
Joined: Mon Jul 31, 2006 9:00 pm
Location: SF Bay Area, California, USA

Re: If you have questions about my code or site....

Postby skychick on Sat Feb 27, 2010 5:31 pm

George,
We are planning to have a web site development company design a new web site for our broadcast station. We use SAM as our automation system when no djs are in-house. I would like to show a "Just Played" box on our web site to list the last 5 songs to play. I assume I can take the PAL that you posted in your Twitter example to get sam to write that info to an HTML file and then kick off a PHP on web server that is hosting our web site to grab it, is that correct?

I was wondering if you had any code examples of how to do that. Also, do you know if it is possible to access the live request feature of SAM thru a web server that SAM is not running on? If we could add a request box to our web site, that would be very popular but I am not sure how the web site would get to the SAM db to allow the user to search for their song and perform the request.

Looks like you have done both of these things before so any help is much appreciated.
Thanks
skychick
Settling In
 
Posts: 4
Joined: Sun Jan 25, 2009 6:08 pm


Return to Code, Scripts, Utilities



Who is online

Users browsing this forum: No registered users and 1 guest

cron