Script: Radio-DJ [MM3]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

ollifant
Posts: 27
Joined: Tue Jan 15, 2008 4:28 pm
Location: Germany

Post by ollifant »

Hi Uwe,

It saves the settings, until i choose the "RadioDJ-Playlist" at the AutoDJ-Options.

When i change the playlist back to "all accessible Tracks", it will save the settings again.

That's really strange.


Olli
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

ollifant wrote:It saves the settings, until i choose the "RadioDJ-Playlist" at the AutoDJ-Options.
Hm, does this happen, when you play muic?

I only could reproduce s.th. like this, when the music was playing using RadioDJ.



CIAo, uwe..
ollifant
Posts: 27
Joined: Tue Jan 15, 2008 4:28 pm
Location: Germany

Post by ollifant »

Hi,
Hm, does this happen, when you play muic?
Yes, normally i change the settings, while playing music.

But i've had it tested now without playing. The RadioDJ Playlist was selected. I quit the MM and started it new. RDJ Playlist was still selected.
I initialised the script to get the settings dialogue and changed something and hit ok. Back to the settings, the changes were not saved. All without playing music.

Now i selected "the whole archive" for AutoDJ and hit ok. After that I can change the settings and they're gonna be saved.

Then I choose the Radio Playlist for AutoDJ again and everything is ok.

This works also while playing music!

At the RDJ-Options my selected playlist is "Accessible Tracks", because i want to use my whole library with the script. Don't know, if that could be a issue?

Olli
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

It looks like this has to to with the fact, that MM starts the script more than once. I made a quick test: in just 2 minutes the script got started 12 times!!

When concurrent processes are accessing the same data such problems as you describe can happen. Since in the documentation of MM it states somewhere that a script is only loaded once and then held in memory, I have not foreseen any remedies against this situation.

I have to think about it...
Having to deal with concurrent processes can make things very complicated. You have to deal with semaphores and stuff like that, and I doubt that MM offers anything like this. And last but not least: I want to keep the script as simple as possible.


CIAo, uwe..
RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX »

uwuerfel wrote:I have to think about it...
Having to deal with concurrent processes can make things very complicated. You have to deal with semaphores and stuff like that, and I doubt that MM offers anything like this. And last but not least: I want to keep the script as simple as possible.

CIAo, uwe..
In a simple language like vbs it's mostly enough to just use the old method

Code: Select all

Sub somesub()
if insub = true then
  exit sub
end if
insub = true

do something

insub = false
exit sub
i don't even think that vbs officially has semaphores implemented o.O

Somethings are really called just once at the same time like initsheet or savesheet since you only have one option window. But if you have Fillleaf and and auto dj call the same function it could happen that they are called at the same time. Or what happens when a user double clicks your node while it is still filling up with data?

But as said the simple method above should be enough.

Hope it helps,
Red
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

Hi Red,

Thanks for your help.

Can this work even if the script is started from scratch?

I think every script instance would have its own variable
"insub" with its own value and they wouldn't know about
each other...

I'm not realy a VBS expert and I don't know how MM handles
VBS sripts internaly. But if my script would be a normal
program just running in the context of the operating system
the multiple instances wouldn't know about each other.

It's not that my script itself uses concurrent threads.
It gets started multiple times...


CIAo, uwe..
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

I have uploaded

V0.4.3
Changed the code when and where options are saved to and loaded from file.

Changed logging to use random filenames for each script instance.
Logging still is disabled by default.

----

This should make the issue with saving the options better.
At least I were not able to reproduce it anymore.

Nevertheless, I can't say if it completely solves it :-(


CIAo, uwe..
ollifant
Posts: 27
Joined: Tue Jan 15, 2008 4:28 pm
Location: Germany

Post by ollifant »

Hi Uwe,

thanks for the update. For me the saving works now as it should.

Olli
lemo
Posts: 14
Joined: Sat Mar 31, 2007 5:22 am

Post by lemo »

Hi Uwe,

Wonderful script. Thanks for contirbuting it.

I know you say it's not an auto script because you consider it as beta software but I would really like to have this (because I use it for Auto DJ) and forget to turn it on half the time.

Happy to be a guinea pig for auto script if you want one...
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

lemo wrote: Wonderful script. Thanks for contirbuting it.
Thanks.
I'm glad to hear this :D

lemo wrote:I know you say it's not an auto script because you consider it as beta software but I would really like to have this (because I use it for Auto DJ) and forget to turn it on half the time.
If you just want to use the Auto-DJ functionality, you don't need to initialize it via "Tools / Scripts / RadioDJ". This is only needed for the GUI elements (Options dialog, tree node).
Once you have setup your weightings, the plain Auto-DJ functionality works without initializing.

But anyway, if the current release (V0.4.3) turns out to be stable, the next release will probably include auto-script functionality.
lemo wrote:Happy to be a guinea pig for auto script if you want one...
I'm happy about every feedback I can get.
I realy thougt I had tested the script. But as you can see, there were plenty of errors in it...
Just wait for the next release and tell me about it.

CIAo, uwe..
ollifant
Posts: 27
Joined: Tue Jan 15, 2008 4:28 pm
Location: Germany

Post by ollifant »

Hi Uwe,
Reagarding the repetition of a single song, there is not only the weighting important, but also the amount of songs per rating.
Unfortunately, the way mm handles random is the most important factor :(

In every rating some songs were played very often, although many others have a playcount of 0.

Let me show you an example:

This morning a 3-Star-rated song played. I have 195 of them. Only 8 Songs later it played again. Same happened yesterday with another song.

Also in case of the 5-star-rated songs: I set them to repeat very often. Some songs were played 3 or 4 times a day and that's ok. But some weren't played since 2 or 3 days, although i have only about 20 of them.

I know, this has nothing to do with your script, but with the mm Auto-DJ.

It's a pity, but i doubt, you can do something about it!?

For your great script, shuffle instead of random would be perfect, but i guess this isn't possible, is it?

Olli
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

Hi Olli,
ollifant wrote:Unfortunately, the way mm handles random is the most important factor
It's not MM that handles the randomizer. The randomizer is part of VBS and therefore MS has implemented it.

I just made some experiments with the randomizer. It behaves as normal as a randomizer can.

ollifant wrote:In every rating some songs were played very often, although many others have a playcount of 0.
[...]
It's a pity, but i doubt, you can do something about it!?

For your great script, shuffle instead of random would be perfect, but i guess this isn't possible, is it?
I understand your point and I have to say, that I experienced similar situations. (Well that's random...)

You are right, I have little chances to influence the way how the randomizer works. There are a few parameters, that I can set, but they wouldn't make things any better :-(

Maybe shuffle can be a solution. I have not yet thought thoroughly about it. For the moment there too much questions that arise, when I think about shuffle:


Shuffle means remembering which songs have been played.

1)
When should this memory end?
- Maybe when the script stops, but when is this? (I still don't know when the script gets startet and when it gets terminated)
- When MM stops?
- At the end of the day?
- At some sort of user-reset?
- For ever?
- <s.th. else>?

2)
How should I deal with changes in the Library?
Lets say, we startet Auto-DJ with my script using shuffle.
You hear music for 5 hours. Now you add some new songs to your library.
When should these songs be incorporated into the shuffle mechanism?
And how?

I would like to hear the opinion about this from everybody, who is interestead in shuffle instead of random.


CIAo, uwe..
uwuerfel
Posts: 76
Joined: Tue Jan 08, 2008 3:29 pm
Location: Germany

Post by uwuerfel »

I have uploaded V0.5.0.

I cleaned up the code a bit and it is now an auto-script.

Therefore now you only need one section in scripts.ini:

[RadioDJasAutoDJ]
FileName=auto\RadioDJ.vbs
DisplayName=RadioDJ as AutoDJ Plug-in
Language=VBScript
ScriptType=4

Here is the script:

[Link removed]

Please tell me if it works.
If it does, I will call it V1.0 and put it on the first posting.


CIAo, uwe..
Last edited by uwuerfel on Tue Jan 29, 2008 5:23 pm, edited 1 time in total.
ollifant
Posts: 27
Joined: Tue Jan 15, 2008 4:28 pm
Location: Germany

Post by ollifant »

Hi Uwe,

thanks for your reply. Perhaps i can test the new version tomorrow.

I had exactly the same thoughts about shuffle. The hardest thing is to tell the script, how to keep the played songs in mind until all are played, and this for every rating-playlist.

I had a similar plugin for winamp, that did this, but without weighting. Perhaps this could give you a hint?

The Name was Amp Randomizer (http://ampr.ophenix.org/)

Olli

P.S.: Don't worry if i'm writing crap, cause i have absolutely no idea 'bout coding :oops:
Last edited by ollifant on Fri Jan 25, 2008 3:04 am, edited 1 time in total.
RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX »

uwuerfel wrote: 1)
When should this memory end?
- Maybe when the script stops, but when is this? (I still don't know when the script gets startet and when it gets terminated)
- When MM stops?
- At the end of the day?
- At some sort of user-reset?
- For ever?
- <s.th. else>?

2)
How should I deal with changes in the Library?
Lets say, we startet Auto-DJ with my script using shuffle.
You hear music for 5 hours. Now you add some new songs to your library.
When should these songs be incorporated into the shuffle mechanism?
And how?

I would like to hear the opinion about this from everybody, who is interestead in shuffle instead of random.


CIAo, uwe..
You could do what most people do, use the Now Playing list as your buffer to check for already played songs. If he wants more "uniquness" all he has to do is leave more songs in the now playing list.
As to when incorporet I'd say when it's added, or as soon as it can ;-)

Just my 2 cents,
Red
Post Reply