Page 1 of 2

MegaDJ v1.0 beta

Posted: Wed Jul 16, 2008 3:08 am
by twinbee
Welcome to MegaDJ

Image

MegaDJ is a (near) replacement for the standard AutoPlaylist feature in MediaMonkey. As well as the flexibility of brackets to more powerfully filter your library, MegaDJ comes with an ace random track playlist feature. Features include:

* Very fast searching and displaying of tracks (100,000+ should be fine!)
* Logic complete query system (brackets, OR, AND, NOT...)
* Easy selection of fields to be added to query.
* Random mode for DJ-style playlists
* Versatile Math Filter to weight picks according to any criteria
* Expandable tree like node structure
* A quick "All Tracks" node which is more of a side extra
* Sorting of tracks by any and all criteria (or combination thereof)

Those of you who are familiar with Winamp may have seen its custom query language added fairly recently. The intent of MegaDJ is to improve over Winamp's version in many ways, by making it more flexible and unified (for example, with the addition of an 'AnyField' tag, and also the 'random' mode where one can specify criteria to bias and weight the list to suit a mood or occasion).

For a quick demo of how MegaDJ works, (and to download the thing), please visit here.

This program only accesses the database, and does not write to it, so your data should be safe!

It has been tested with MediaMonkey v3.0.2.1134 and higher. I'm not sure if the script will work properly with earlier versions of MediaMonkey.

Please can any bug reports and posts of code be restricted to this thread.

MegaDJ has taken many weeks of coding. For a short while, this program will be free (as a reward for early adopters ;) ). In the short future, I hope to charge a nominal fee (say 4 dollars), a quarter of which will go to the maker behind the brilliant Function parser - a C++ library which help made the cool Math Filter possible. For those who can't or don't want to pay at that point, ask me nicely and I'll see what I can do :)

Finally, I'd like to thank all the forum regulars here who have helped out myself and others, and of course the MediaMonkey team for producing such a complete API in the first place - without which, none of this would have been possible. I'm actually fairly new here, but the whole place seems really friendly and helpful :)

Download MegaDJ from here.

Re: MegaDJ v1.0 beta

Posted: Wed Jul 16, 2008 6:18 am
by stan9980
Wow, I've only had a brief look at this but I'm very impressed! Great work :D

Re: MegaDJ v1.0 beta

Posted: Wed Jul 16, 2008 8:27 am
by trixmoto
Looks very powerful indeed! :D

Re: MegaDJ v1.0 beta

Posted: Wed Jul 16, 2008 1:49 pm
by callmetom
Nice thing !

Can you give us some more examples for the Expressions which are possible ?

Thanx
Tom

Re: MegaDJ v1.0 beta

Posted: Thu Jul 17, 2008 12:08 am
by twinbee
Can you give us some more examples for the Expressions which are possible ?
Lol okay... :D
I'll split this into two sections:

STANDARD QUERIES WITHOUT USING MATH FILTER

All tracks
Query Filter: #
Filter Type: All

Random selection of n tracks
Query Filter: #
Filter Type: Random
Num Tunes: As many as you want (refresh tracklist with F4 key at any time).

Played in last month (30 means days)
Query Filter: lastplayedage<30

Played in last hour
Query Filter: lastplayedage<1.0/24

(also experiment with dateaddedage and filemodifiedage)

Almagamate music genres together, along with other conditions:
Example 1:
Query Filter: (Genre='Spacesynth' | Genre~'Electro' | Genre~'Techno') & rating>=3

Example 2:
Query Filter: (Genre~'Swing' | Genre~'Ragtime' | Genre~'Bebop' | Genre~'Jazz') & Year>20000208

(The year (date) format is YYYYMMDD by the way)

Any hidden remixes? Here the Artist is different to the original artist, and original artist isn't blank:

Example 1:
OrigArtist!=Artist & OrigArtist!=''
(Those quotes are 2 single apostrophes, not a 'double' quotation mark)

Example 2 (extension of above to find even more remixes):
(OrigArtist!=Artist & OrigArtist!='') | (Artist!=Author & Author!='')

Find various blank fields, but only if they've been added within the past month
(rating<0 | Album='' | Artist='' | SongTitle='') & dateaddedage<30

Select tunes which have been played more than once every 20 days on average
PlayCounter/dateaddedage > 1.0/20

Select tunes which have been played less than once every 100 days on average and is rated higher than 3 star
PlayCounter/dateaddedage < 1.0/100 & rating>3



USING THE MATH FILTER

This is where the real power of MegaDJ shows. You can have anything in the Query field along with the Math filter for further filtering. For the tests below, the query is set to "#" (all tracks), and the Filter Type is (usually) set to "Random" (with say 100 tunes).

Random selection of 100 random tracks with bias towards your old tunes
Query Filter: #
Math Filter: filemodifiedage
Filter Type: Random
Num Tunes: 100

Strength of bias is proportional to filemodifiedage value (time elapsed since timestamp). Use "1/filemodifiedage" for bias towards your new tunes instead.

Random selection of 100 random tracks with bias towards your high rated tunes
Query Filter: #
Math Filter: rating
Filter Type: Random
Num Tunes: 100

Strength of bias is proportional to rating value. Use Math Filter: "2^rating", to slope the bias even further towards the higher rated tunes. In Filter Type=Random mode, the math filter is a *weighting* relative to the rest of the scores (so if we put rating/50000, they would still all have equal weight and therefore, there would be no real difference in the actual results of the playlist!).

The nice thing is that if you only have a say a few 5 star tunes, the 'weighted roulette wheel' system will automatically be less likely to pick them (despite the high rating), on account of how rare they are.


Random selection of 100 random tracks with bias towards your most frequently played tunes
Query Filter: #
Math Filter: PlayCounter/dateaddedage
Filter Type: Random
Num Tunes: 100

PlayCounter/dateaddedage was one we had in the Query Filter. Now it's in the PlayCounter/dateaddedage, it means we can select random tracks with bias towards more frequently played tunes (rather than a hard cut-off point as was set before).

The 3 above queries used PlayCounter, dateaddedage, filemodifiedage and rating. Also experiment with Date, BPM, Length, PlayCount and others for more possibilities.


Scan through all tracks. 5 star tracks have 100% chance of being added, 4 star - 80%, 3 star - 60%, 2 star - 40%, 1 star - 20%, 0 star/bomb - 0%
Query Filter: #
Math Filter: rating/5
Filter Type: All

The Math Filter works slightly differently now that the Filter Type is set to All. This time, the "rating/5" bit will calculate the *probability* that each tune will be added to the list (rather than it being a weight as before).


Mix of unheard/unrated tracks along with good ones
Query Filter: #
Math Filter: if(rating<0, 8, 2^rating)
Filter Type: Random

The Math Filter supports most math functions, and also allows the use of an If/Else statement. Here, the filter is saying, query all tracks, but randomly pick 200 with certain biases...
The "rating<0" bit means 'unrated' basically, so it receives a weighting of 8. Otherwise (i.e. if rating >=0), calculate 2^rating, and that will be the weighting instead (2,4,8,16,32 depending on whether it's 1,2,3,4 or 5 star).
This allows a nice selection between highly rated tracks, and also those you haven't rated or heard much.

You can use 3^rating or rating^2 or whatever else you think is best.

Random selection where tracks published closer to the year 2000 get priority
Query Filter: #
Math Filter: 1 / 1.2^(abs(Year-20000000)/10000)
Filter Type: Random

You can go crazy with all the math symbols if you know what you're doing. We have to divide by 10000, because MM stores the Year 2000 as 20000000 (YYYYMMDD)

Latest version of MegaDJ (version 1.0 beta 2) is available with some bug fixes. I don't expect too many bugs, but we'll see (famous last words).

Re: MegaDJ v1.0 beta

Posted: Thu Jul 17, 2008 10:46 am
by holterpolter
This seems to be a very usefull extension for the MediaMonkey. Thanks for developing it.

Now its time to find more usefull example queries.
By the way is it possible to show the last 200 Tracks added to the library?

Re: MegaDJ v1.0 beta

Posted: Fri Jul 18, 2008 5:29 am
by stan9980
@holterpolter, I think you'd be better off using an AutoPlaylist for that, sort by 'added' and limit it to 200 tracks.

Here's a fun one:

90's Rock that I haven't heard in 30 days with a bias to highly rated or unrated tracks

Query Filter: (Genre = 'Rock' | Genre = 'Hard Rock') & Year ~ '199'
Math Filter: if(lastplayedage<30, 0, if(rating<0, 12, 2^rating))

:D yay a nested if, I haven't used one of those for ages!

stan9980

Re: MegaDJ v1.0 beta

Posted: Fri Jul 18, 2008 7:57 am
by twinbee
By the way is it possible to show the last 200 Tracks added to the library?
Now it is ;) There's a third option I've just added on top of All and Random called "Sort". This nicely ties in with the rest, and you can have sorted columns based on criteria you can't usually get in MM such as most frequently played (PlayCounter/dateaddedage).

Download the new beta 3 from here as usual.

Simply enter # into the Query Filter, and select sort mode with 200 tracks. Then enter "-dateaddedage" into the Math Filter (with the minus in front. Without the minus sorts the other way).

stan9980: nice one! Although actually you can take the lastplayedage<30 bit I think, and put it in the normal Query Filter section (change it to "& lastplayedage>=30").

Re: MegaDJ v1.0 beta

Posted: Mon Jul 21, 2008 4:48 pm
by stan9980
twinbee wrote:stan9980: nice one! Although actually you can take the lastplayedage<30 bit I think, and put it in the normal Query Filter section (change it to "& lastplayedage>=30").
Oh yes, so you can! Thanks. It was Friday and I wasn't really with it! I thought there must have been a easier way of doing what I wanted :D

I think I've found one small buglet twinbee. :-? When I've got a MegaDJ playlist ready to go, if I click on play now or play next MM tells me "Tracks from the following locations are currently unavailable. Music 0-M Please reconnect, etc. I think it's because when MegaDJ is showing the path as...

[Music 0-M]\C\Clapton, Eric etc.

instead of...

M:\C\Clapton, Eric etc.

If I click on retry in the dialogue box that pops up it will play the track and the path will show as M:\C\Clapton, Eric etc. I'm using beta 3. Any idea why?

Cheers,

stan9980

Re: MegaDJ v1.0 beta

Posted: Tue Jul 22, 2008 1:45 am
by twinbee
Hmm... have you tried refreshing (F4) ? This could be tricky. There's just the SDB.Database.Path code I have in there which should always work. How about if you double click on the tracks to play them manually?

If you give me a step by step report of how I can replicate the error, I'll see what I can do.

Re: MegaDJ v1.0 beta

Posted: Tue Jul 22, 2008 4:51 am
by stan9980
Ok I've checked on both quick QuickSearch and Filters and this happens all the time for me. Refreshing doesn't help. Double clicking cause the error message I described before to pop up.

When the error message pops up I get three options, cancel, retry, ingnore.

If I click on cancel, nothing plays (obviously!) but the path does change from [Music 0-M]\etc. to M:\etc.

If I click on retry, the track(s) will play, again the path will now show as M:\etc.

If I click on ignore, the track(s) will play, again the path will now show as M:\etc.

Let me know if you want more.

Cheers,

stan9980

Re: MegaDJ v1.0 beta

Posted: Thu Jul 24, 2008 1:25 am
by twinbee
I'm a bit stumped on this, seeing as I've never had this problem myself. A few long shots include restarting MediaMonkey to see if the problem still occurs. By the way, the F4 refresh button I mentioned is not the same as the F5 refresh that MM usually has, but you probably already knew that.

I take it the error also happens when you try to double click on a tune directly in the playlist?

If that fails, the only other thing I can think of is to start with a blank library (back up your old one), add tunes to it, detail all other steps you take, and see if I can replicate the error this end.

Re: MegaDJ v1.0 beta

Posted: Thu Jul 24, 2008 7:44 am
by stan9980
Ok, I've solved the problem, not sure I understand why I was having the trouble though.

I tested MegaDJ on my laptop, and saw similar behaviour to before, ie the path showing as [Music]/etc but as soon as I did any form of playing it would change to C:\etc. There was no error message like I saw on my desktop.

I tried again on my desktop and still got the error message, I clicked retry and as in my previous post the path would change to M:\etc. I restarted MM and the path stayed as M:\etc, so I I did a QuickSearch with # to show all tracks, played all the tracks, hit retry when the error message appeared, so that all the path field would change. Goodbye error message :D, I just don't understand why my desktop was having the problem in the first place!

I'll go back to playing with it now :)

Re: MegaDJ v1.0 beta

Posted: Fri Jul 25, 2008 2:41 am
by twinbee
Yay good stuff! I hope the prob stays away, and that it was a one off though... :-?

Re: MegaDJ v1.0 beta

Posted: Fri Jul 25, 2008 5:43 pm
by stan9980
Unfortunately the problem cropped back up after a reboot. :( It's not the end of the world though. I can't think of anything else to try at the moment or any reason it should happen. Grr technology!