Magic Nodes 1.3b (IS OUTDATED SEE NOTE IN FIRST POST)

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Magic Nodes 1.3b (IS OUTDATED SEE NOTE IN FIRST POST)

Post by Pablo » Tue Jan 25, 2005 5:19 pm

22.07.2009 EDITED BY PEKE:
----
NOTE: As Pablo stopped developing this version long ago ZvezdanD has been rewritten almost whole Magic Node Script and make it working under both MediaMonkey 2.x, 3.x and above. All questions should be redirected to new Topic thread set by ZvezdanD HERE.

Thank you all for understanding and thanks ZvezdanD for continuing work on this project.
----

An incremental release has been released on April 14. It doesn't add a whole lot of new functionality, but it implements some requests and it is the first new release in a long time.

This is a very early and untested release so I'm sure there are lots of bugs. Please report them here.

The web site for the script (including download) is http://magicnodes.110mb.com.

See what's new here: http://magicnodes.110mb.com/whatsnew.htm.

If you're new to the script, you're strongly encouraged to look at the tutorial and examples in the website. There's also a new downloadable help file.

In a nutshell, the new version incorporates some requested fields (sample rate, original year, album and year), ignores the leading "The" in artist fields (including album and artist) and shows the MagicNodes node in the tree only if it contains subnodes. It also fixes some bugs.

Some of the new features were contributed by onkel_enno and bex.

Enjoy!

----------------------------------

For people new to the script, here are some examples to give you an idea of what the script can do:

Code: Select all

Album Artist|shortcut:Ctrl+F8|child of:artist\<Album Artist>\<Album|Sort by:max(year)>
This places the node right after the Artist node, and makes it accesable by pressing Ctrl+F8 (similar to Artist which is accesed by F8). Moreover, clicking on an Album Artist name shows all tracks by that artist.

Code: Select all

Album Artist (just favorites)|shortcut:Ctrl+8|filter:Rating>=4\<Album Artist>\<Album|Sort by:max(year)>
Similar to the above, but it only considers tracks with a rating of 4 stars or above. Since no "child of" qualifier is specified, the node will be put under the "Magic Nodes" root.

Code: Select all

 Artists in Quarantine|SQL filter:Songs.SongPath LIKE '%quarantine%'\<Artist>\<Album|Sort by:max(year)>
It shows only tracks whose path contains the word "quarantine". If you have a folder with this name where you put doubtful tracks, this is an easy way to access them in an organized way.

Code: Select all

Albums by Genre|icon:bottom level\<genre>\<album>
This magic node will borrow the icon from the last field in the mask, i.e. album

Code: Select all

Simple artist|icon:top level\<artist|trim:1>\<artist>\<album>
A bare-bones artist node. It takes the icon from the first field, i.e. artist.

Code: Select all

Tracks by encoding\<format>\<bitrate>\<VBR>
This node lets you browse your files according to thir encoding characteristics (the new thing in this version is the VBR field).

Code: Select all

Artist by last time played\<artist>\<time since last played>
Organizes tracks according to the last time they were played.

Here are some older examples:

Code: Select all

Most played albums\<album|sort by:sum(played)|sort order:desc|unknown:no|top:5 percent>
(Shows the top 5% played albums)

Code: Select all

Most played in avg albums\<album|sort by:avg(played)|sort order:desc|unknown:no|top:5 percent|min tracks:8>
(Shows the top 5% albums according to the average times its tracks have been played. It ignores albums with less than 8 tracks. I found that my top played artist ranks about 50th in played by average!)

Code: Select all

Top rated artists\<artist|sort by:avg(rating)|sort order:desc|unknown:no|top:10|min tracks:12>
Shows the 10 artists whose average rating is highest. The rating has to be defined for ALL tracks of the artist, otherwise the average is not computed.

Code: Select all

Involved people\<involved people|trim:1>\<involved people>
(Simple mask to see all of your "involved people" information. Doesn't show the "all" node)

Code: Select all

Comments\<comment|trim:25> 


(shows first 25 characters of the comment field. You'd be surprised of how many tracks have comments you weren't aware of!)

Code: Select all

Album Artist\<album artist|trim:1>\<album artist>\<album|sort by:first(year)> 
(similar to Octopod's Artist by year node. Thanks to Dipinto and Octopod for coming up with the idea. Shows the all node at all but the first level).

Code: Select all

Playlist by artist\<artist>\<playlist> 


(for each artist, shows the playlists which contain tracks from that artist. Only works for regular playlists).

Code: Select all

Country\<country>\<album artist>\<album|sort by:max(year)> 
(assumes that one of your custom fields have been renamed to "country")

Code: Select all

Small mistake\<comment|tri:25> 
(Oops... trim has been misspelled. An error message will appear and the user will be presented with the mask again for editing)

Code: Select all

Artists by rating\<artist>\<rating> 
(If you want to play only highly rated tracks from a given artist)

Find more examples in the web page: http://students.washington.edu/~shmerki ... amples.htm.
Last edited by Pablo on Fri Jan 19, 2007 11:06 am, edited 13 times in total.

pah68
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 » Tue Jan 25, 2005 5:32 pm

Your site seems to be down :(

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo » Tue Jan 25, 2005 6:42 pm

There was a point at the end of the URL... fixed :wink:

pah68
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 » Wed Jan 26, 2005 1:30 am

Ha....bloody decimal points have made a goose out of me before. :oops:

Octopod
Posts: 461
Joined: Tue Jun 10, 2003 9:09 am

Post by Octopod » Wed Jan 26, 2005 7:15 am

Pablo,

Here is a last cosmetic point i recommend (when you have time), using MM look&feel instead of the standard Windows dialog. Try this (callbacks are not provided):

Code: Select all

  If 1 Then

	' Create the window to be shown
	Set Form2 = SDB.UI.NewForm
	Form2.Common.SetRect 100, 100, 220, 140
	Form2.BorderStyle  = 3   ' Not resizable
	Form2.FormPosition = 4   ' Screen Center
	Form2.SavePositionName = "Test new form"
	Form2.Caption = "Test new form"
	Form2.StayOnTop = True
     
	' Create a button that closes the window
	Set Label = UI.NewLabel(Form2)
	Label.Caption = "Enter the mask to create a new node :"
	Label.Common.SetRect 5, 5, 200, 15
  
	Set Edt = UI.NewEdit(Form2)
	Edt.Common.SetRect 5, 30, 200, 20
	Edt.Text = "Artist\<Artist>\<Genre>"
	Edt.Common.ControlName = "Edit1"
    
	' Create a button that closes the window
	Set Btn = UI.NewButton(Form2)
	Btn.Caption = "&OK"
	Btn.Common.SetRect Form2.Common.Width -150, 80, 65, 24
	Btn.Common.Hint = "OK"
	Btn.Common.Anchors = 4+8   ' Right+Bottom
	Btn.UseScript = Script.ScriptPath
	Btn.OnClickFunc = "OnValidate"

	Set Btn = UI.NewButton(Form2)
	Btn.Caption = "&Cancel"
	Btn.Common.SetRect Form2.Common.Width -80, 80, 65, 24
	Btn.Common.Hint = "Cancel"
	Btn.Common.Anchors = 4+8   ' Right+Bottom
	Btn.UseScript = Script.ScriptPath
	Btn.OnClickFunc = "OnClose"

	Form2.Common.Visible = True
	SDB.Objects("Test new form") = Form2
  End If
Octopod
Image

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo » Wed Jan 26, 2005 12:46 pm

Thanks a lot Octopod, I was too lazy to do this myself :oops:
I won't have much time in the next few days, but this will definitely be incorporated into the next version.

sadao
Posts: 191
Joined: Tue Nov 09, 2004 7:44 pm
Location: Arlington, VA

Post by sadao » Wed Jan 26, 2005 3:26 pm

Keep up the good work. I'll give it a crack tonight. Can't wait to have my album artist node.

I noticed that one of the changes you made was to make all custom nodes children to the custom nodes node. Would you be interested in maintaining the optionality for a node to be the child of the Library node? This would definitely be nice for the Album Artist node. At any rate, not a big deal. If i really want it i'll hack your code (though I'd rather not since i'll branch myself out of your wondeful development trunk ). 8)

sadao
Posts: 191
Joined: Tue Nov 09, 2004 7:44 pm
Location: Arlington, VA

Post by sadao » Wed Jan 26, 2005 3:38 pm

Just tried, awesome.

One wish (I guess this is what happens when you write something cool :D), is there anyway that clicking on a parent in a custom node tree would be equivalent to clicking on the 'all' entry amongst the children (i.e., is it possible to have the same implentation as the 'artist' node rather than the location node)?

Not a big deal at all, but should you feel like implementing it will make me really happy. A seamless album artist node...

EDIT: Well, if I only read your nice opening post I would have noticed that I can get rid of the 'all'.

EDIT 2: ...Apparently my point remains since getting rid of the 'all' entry doesn't cause clicking on the parent to load all children into the tracklist. Good work though. I remember thinking a while back I'd have to figure out this whole scripting thing so that I could make my own nodes, and then you came along with this. Thanks again!

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo » Thu Jan 27, 2005 1:19 am

Hi Sadao, glad you like it :D
Both suggestions will be implemented in the next update 8)

sadao
Posts: 191
Joined: Tue Nov 09, 2004 7:44 pm
Location: Arlington, VA

Post by sadao » Thu Jan 27, 2005 9:20 am

Pablo wrote:Hi Sadao, glad you like it :D
Both suggestions will be implemented in the next update 8)
Now that's what I like to hear! :D

pah68
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 » Sat Jan 29, 2005 2:07 am

I can no longer create custom nodes for my Custom fields with Custom Node script v1.0 :cry:

It all started when I installed v1.0. They worked in 0.1 & 0.9
My custom fields are labelled
  • Album Rating
    Archived
    Description
and my masks are
  • Album Rating\<Album Rating>\<Album Artist>\<Album>
    Archived\<Archived>\<Album Artist>\<Album>
    Description\<Description>\<Album Artist>
I'm able to create them without errors (tried this several times, including removing the entire Custom Nodes section from the media monkey ini file.

I get the following errors (3 dialogs each) when I try to expand the newly created nodes.


Album Rating
There was a problem querying the database
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
Followed by
Error #-2147418113 - SongsDB.DBIterator
Field 'Count_Unknown' not found
File: "C:\Program Files\MediaMonkey\Scripts\Auto\CustomNode.1.0.vbs",Line: 627, Column: 24
Followed by
Error happened during script execution:
Field "Count_Unknown' not found

Archived
There was a problem querying the database
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
Followed by
Error #-2147418113 - SongsDB.DBDatabase
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
File: "C:\Program Files\MediaMonkey\Scripts\Auto\CustomNode.1.0.vbs",Line: 625, Column: 4
Followed by
Error happened during script execution:
Field "Count_Unknown' not found

Description
There was a problem querying the database
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
Followed by
Error #-2147418113 - SongsDB.DBDatabase
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
File: "C:\Program Files\MediaMonkey\Scripts\Auto\CustomNode.1.0.vbs",Line: 625, Column: 4
Followed by
Error happened during script execution:
07002:[Microsoft][ODBC Microsoft Access Driver] Too few paramaters. Expected 1.
All the example masks from the initial post in this thread work, but mine don't anymore. Any ideas? :-?

pah68
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 » Sat Jan 29, 2005 2:10 am

My system is a reasonably fresh install of XP Pro and Office XP

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo » Sat Jan 29, 2005 3:56 am

Thanks for the report, those masks don't work in my system either :-? , I'll take a look.

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo » Sat Jan 29, 2005 4:14 am

The problem is with the part of the SQL query that tests whether the custom field is known. The query works fine in Access but not when querying the database from outside. If you want a quick fix, replace

Code: Select all

.Add CF(1), ktKnownIfNonEmpty
.Add CF(2), ktKnownIfNonEmpty
.Add CF(3), ktKnownIfNonEmpty
with

Code: Select all

.Add CF(1), ktAlwaysKnown
.Add CF(2), ktAlwaysKnown
.Add CF(3), ktAlwaysKnown
(this is located at line 158 in the script file). You'll lose the unknown node, but otherwise it should work. I'll try to find a more definitive solution for the next update.

pah68
Posts: 1484
Joined: Wed Apr 07, 2004 5:26 pm
Location: Sydney, Australia

Post by pah68 » Sat Jan 29, 2005 4:23 am

BINGO!
Thanks for that :D

Locked