Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Uinta
Posts: 4
Joined: Tue Aug 07, 2018 2:15 pm

Re: Magic Node Help - Sorting Into Alphabetical Groups

Post by Uinta » Thu Aug 16, 2018 3:23 pm

ZvezdanD wrote:
Wed Aug 15, 2018 2:46 pm
Uinta wrote:
Mon Aug 13, 2018 1:34 pm
If I add <title> to the end of the mask ...<Artist|Trim:1>\<Artist>\<Album> like <Artist|Trim:1>\<Artist>\<Album>\<Title> it lists the tracks in the album which is what I want, however they are listed alphabetically rather than by track number. I cant seem to get this corrected. I have tried some different "sort" functions but none of them seem to work. Is there a way to do this?
What do you mean by "it lists the tracks in the album"? Are you talking about tracks displayed by their Title in the Media Tree or files displayed in the filelist? How about you post the mask that you tried with the "sort" function which didn't work as you wanted?

By the way, the Sort by qualifier in the freely available version of the add-on is used only for sorting of nodes in the Media Tree. Maybe you could try to save sorting order of files in the filelist using options of the program itself.

The enhanced donation version of the add-on has added sort of files in the filelist using Sort by qualifier applied to the global MN node, e.g. Test|Sort by:Album, Track Number\<Artist>.
I got this figured out. Thanks!

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Wed Aug 29, 2018 7:57 pm

Trying to create a way to group by the parent work of classical works (e.g., Beethoven's 9th symphony) and then randomly order by the parent work, but deduped by album so if I have two versions of the same work they don't end up next to each other.

As a start, I got this query to work (the parent work in this case is in Custom3). However, it doesn't do any sorting.

Songs.Custom3 || Album || AlbumArtist IN (SELECT Custom3 || Album || AlbumArtist AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical')

Using the sort feature built into Magic Nodes I was able to sort by album, then by custom 3, then by track number to get close to what I'm looking for, but I'd prefer a native way to sort the results randomly by the concatenation of custom 3 and album ID or other unique album identifiers, then by track number. How would I implement this in the query itself?

Thanks in advance!

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Thu Aug 30, 2018 2:02 am

mhendu wrote:
Wed Aug 29, 2018 7:57 pm
How would I implement this in the query itself?
From your post it seems that you know SQL very well. However, as it is the case with the previous poster, I need to ask what do you mean by "sort the result". Are you talking about nodes in the Media Tree or files displayed in the filelist? How about you post the complete mask that you tried which "doesn't do any sorting"?

The enhanced version of the add-on has an ability to sort files in the filelist using Sort by qualifier applied to the global MN node, e.g. Test|Sort by:Album, Track Number\<Artist>. It has also Random as a quasi-sorting order when sorting files, e.g. Sort by: Genre Random, Artist, Album Random, Track Number.

The Sort by qualifier applied to the local nodes (<Artist> or <Album> or whatever) is only for sorting of nodes in the Media Tree.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Thu Aug 30, 2018 8:06 pm

ZvezdanD wrote:
Thu Aug 30, 2018 2:02 am
How about you post the complete mask that you tried which "doesn't do any sorting"?
I'd describe my SQL knowledge as basic at best - I can mimic fairly well but I'm not really sure about the syntax, but thanks anyway. :)

Without sorting, here's the mask:

Code: Select all

>4 star Classical works|Child of:Playlists|Position:Child|Filter:Songs.Custom3 || IDAlbum IN (SELECT Custom3 || IDAlbum AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical')
I'll eventually make this an auto-playlist (I have paid for the enhanced version of Magic Nodes) but for now this is a regular playlist since regular playlists are a little easier to work with (I find the auto-playlists continuously update, which is nice in theory but makes the UI difficult to use in practice). I am trying to get the filtered results (Classical parent works / accompanying tracks with an average rating above 80) to appear in a playlist and order randomly by the concatenation of parent work ID (Custom 3 field) and either IDAlbum or both album / album artist. This would allow box sets with multiple works to have those works spread out throughout my playlist rather than grouped together by album, which is what I get when I use this node:

Code: Select all

>4 star Classical works|Child of:Playlists|Position:Child|Filter:Songs.Custom3 || IDAlbum IN (SELECT Custom3 || IDAlbum AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical')|Sort by:Custom 3 Random, Album, Track number

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Fri Aug 31, 2018 1:23 am

mhendu wrote:
Thu Aug 30, 2018 8:06 pm
This would allow box sets with multiple works to have those works spread out throughout my playlist rather than grouped together by album
I see that you have only a global node in these masks, so you don't want to sort nodes but files. Although, it seems that your masks are not correctly copy/pasted since they have the ">" character on the beginning of the caption, which is not allowed (unless you have that node inside some group, but in that case your masks are missing that group part).

Anyway, I still don't understand what you are getting with that mask and what you exactly want to accomplish. It would be helpful if you post a screenshot of the filelist with the files sorted using your second mask and you should write several files from the screenshot in the order that you want to get. I am not too much versed with the classical music, so I would like to see Album, Custom3 and Path of these files and maybe Artist or Album Artist.

Have you tried Sort by:Custom 3, Album Random, Track number, or maybe Sort by:Album Random, Custom 3 Random, Track number? How about to add Artist or Album Artist as the first or second field in the Sort by list (with or without Random)?

By the way, the Sort by qualifier doesn't support IDAlbum, but maybe you could try to use Album, Album Artist instead.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Fri Aug 31, 2018 12:19 pm

ZvezdanD wrote:
Fri Aug 31, 2018 1:23 am
It would be helpful if you post a screenshot of the filelist with the files sorted using your second mask and you should write several files from the screenshot in the order that you want to get. I am not too much versed with the classical music, so I would like to see Album, Custom3 and Path of these files and maybe Artist or Album Artist.
Here's a screenshot so you can get a better sense of the issue:

https://ibb.co/hu6S5K

Current sorting is by Custom3 (random), then by Album, then by Track Number. As you can see in the image, I have two copies of Vivaldi's The Four Seasons. What happens with the sorting is that the two copies of The Four Seasons sort together and then by album, so these will show up next to each other in the file list if I sort by Custom3. If I sort by Album then by Custom3 then all the works in an album will show up next to each other every time - this is a better solution but still not ideal since if I have a box set with tons of tracks I'll always get those tracks more or less together (even if my second sorting criterion is Custom3 random this will distribute the parent works throughout the album but not throughout the file list). My preferred solution would be to concatenate Custom3 and Album / Album Artist or IDAlbum to randomly sort by that concatenation. This way two copies of the same work would rarely show up next to each other, and box sets would typically get their works distributed throughout the file list. Still not exactly clear to me if this is possible using Magic Nodes or if I have to settle for one approach or the other (the last alternative I can think of would be to use a custom field to concatenate parent work ID and other identifying fields and sort by that field, but that's definitely not my preferred solution).

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Fri Aug 31, 2018 2:12 pm

mhendu wrote:
Fri Aug 31, 2018 12:19 pm
If I sort by Album then by Custom3 then all the works in an album will show up next to each other every time - this is a better solution but still not ideal since if I have a box set with tons of tracks I'll always get those tracks more or less together (even if my second sorting criterion is Custom3 random this will distribute the parent works throughout the album but not throughout the file list). My preferred solution would be to concatenate Custom3 and Album / Album Artist or IDAlbum to randomly sort by that concatenation. This way two copies of the same work would rarely show up next to each other, and box sets would typically get their works distributed throughout the file list.
Unfortunately, Magic Nodes doesn't support concatenation of two or more fields, nor any other form of string manipulation, within the Sort by qualifier.

However, I still don't understand what you want to say with those "tons of tracks". I suppose it is expected that you get all tracks from the same album one after another, right? That is why you are using Track Number as the last argument of Sort by. If you sort by Album name randomly first, wouldn't that be what you want to get?

Have you actually tried my suggestion with Album Random as the first argument? I think it could do what you want as long as you have albums from the same box set with different album names. Otherwise, maybe you could add Artist or Album Artist or Composer or Conductor as the first argument, again with Random.

I cannot see from your screenshot, but I suppose that all your albums from the same box set have the same Custom3 field, right?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Fri Aug 31, 2018 4:29 pm

ZvezdanD wrote:
Fri Aug 31, 2018 2:12 pm
I cannot see from your screenshot, but I suppose that all your albums from the same box set have the same Custom3 field, right?
Thanks, but not correct. Take, for example, the album Songs from Our Ancestors (from which one work appears in my file list in the screenshot). Here's the Musicbrainz link for that album:

https://musicbrainz.org/release/7588a67 ... 257cb7b32a

You can see from there that the album has multiple works in it, from different composers, from different eras, performed by the same performer. If I sort first by album (and assuming I include all tracks from the album in my query) then all 22 tracks from the album will appear together in some order, depending on my additional sort selections. I'd prefer to, for instance, have my playlist skip around from my complete collection of classical music based on the parent works. As another example (somewhat extreme) there's this Martha Argerich box set:

https://musicbrainz.org/release/67172a6 ... 2784317850

Hundreds of tracks across 48 discs so a playlist could get tied up on Martha Argerich's piano music for hours.

I suppose, if there's not a great solution otherwise, I could write a script to concatenate Custom3 and IDAlbum and overwrite another custom field like Comments to use for sorting.

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Sat Sep 01, 2018 1:31 am

mhendu wrote:
Fri Aug 31, 2018 4:29 pm
I suppose, if there's not a great solution otherwise, I could write a script to concatenate Custom3 and IDAlbum and overwrite another custom field like Comments to use for sorting.
How often do you need to generate the mentioned playlist? If it is just once or twice, maybe you could use the next workaround:
- open Magic Nodes Options dialog box;
- turn on the Allow editing of SQL queries and when select a field node options;
- confirm with Ok;
- remove Sort by qualifier from your mask in Mask Settings dialog box;
- click on Update;
- when you get the new Magic Nodes SQL Editor dialog box, edit the SQL query appropriately.

For example, if your Filter is:

Code: Select all

Songs.Custom3 || IDAlbum IN (SELECT Custom3 || IDAlbum AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical')
and if you want to sort by the concatenated Custom3 and IDAlbum randomly, then Track Number, you should write:

Code: Select all

INNER JOIN (SELECT Custom3 || IDAlbum AS SortField1, Random() AS RandomField1 FROM Songs GROUP BY SortField1) ON Custom3 || IDAlbum = SortField1 WHERE Songs.Custom3 || IDAlbum IN (SELECT Custom3 || IDAlbum AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical') ORDER BY RandomField1, Songs.TrackNumber COLLATE NUMERICSTRING
You could turn on the Don't show this dialog anymore before confirmation.

As you could see, your filter is the WHERE part of the new query, with the ORDER BY part appended to the end and the necessary INNER JOIN part on the beginning.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Sun Sep 02, 2018 12:56 pm

ZvezdanD wrote:
Sat Sep 01, 2018 1:31 am

Code: Select all

INNER JOIN (SELECT Custom3 || IDAlbum AS SortField1, Random() AS RandomField1 FROM Songs GROUP BY SortField1) ON Custom3 || IDAlbum = SortField1 WHERE Songs.Custom3 || IDAlbum IN (SELECT Custom3 || IDAlbum AS CLASSWORK FROM Songs GROUP BY CLASSWORK HAVING Avg(Rating) > 80 AND Custom3 <> '' AND GroupDesc = 'Classical') ORDER BY RandomField1, Songs.TrackNumber COLLATE NUMERICSTRING
I changed the settings in Magic Nodes and tried to use the above query but this doesn't work for some reason (it produces an error). Maybe I need to change CLASSWORK to SortField1? That doesn't work either. Not sure. Any thoughts?

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Sun Sep 02, 2018 1:30 pm

mhendu wrote:
Sun Sep 02, 2018 12:56 pm
I changed the settings in Magic Nodes and tried to use the above query but this doesn't work for some reason (it produces an error).
Where did you try to use the above query, was it in the mentioned Magic Nodes SQL Editor dialog? Did you replace the string that is already displayed in the text box with the posted one?

Anyway, you discovered a bug. I don't get the error, but the SQL Editor dialog box is opening only for Magic nodes that are outside of Playlists branch, e.g. for nodes inside the Magic Nodes branch. I will try to fix that as soon as possible.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Mon Sep 03, 2018 6:58 pm

ZvezdanD wrote:
Sun Sep 02, 2018 1:30 pm
mhendu wrote:
Sun Sep 02, 2018 12:56 pm
I changed the settings in Magic Nodes and tried to use the above query but this doesn't work for some reason (it produces an error).
Where did you try to use the above query, was it in the mentioned Magic Nodes SQL Editor dialog? Did you replace the string that is already displayed in the text box with the posted one?
Yes, on both counts.

I do get that confirmation dialog box if I place the node under Magic Nodes instead of playlists but the query still results in an error, unfortunately.

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Tue Sep 04, 2018 2:13 am

mhendu wrote:
Mon Sep 03, 2018 6:58 pm
I do get that confirmation dialog box if I place the node under Magic Nodes instead of playlists but the query still results in an error, unfortunately.
It works fine for me. Tried several times, no errors. Check if you copied/pasted the correct string and confirm editing of SQL query with the OK button. Then post the screenshot of the error message box if it says anything different than "The mask defining this Magic Node produced an error."

By the way, if you manage to get the wanted filelist with the node inside of the Magic Nodes branch, you could transfer the content of that node to the Playlists branch using the "Create Playlists for Child Nodes" menu option of the Export/Create Playlists add-on.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

mhendu
Posts: 98
Joined: Thu Jan 12, 2006 11:18 am

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by mhendu » Tue Sep 04, 2018 10:38 pm

ZvezdanD wrote:
Tue Sep 04, 2018 2:13 am
It works fine for me. Tried several times, no errors. Check if you copied/pasted the correct string and confirm editing of SQL query with the OK button. Then post the screenshot of the error message box if it says anything different than "The mask defining this Magic Node produced an error."
Here's a screenshot of the settings - have tried a few times in different ways with no success:

https://ibb.co/btjA2z

The error I'm receiving is "The mask defining this Magic Node produced an error."

ZvezdanD
Posts: 3094
Joined: Thu Jun 08, 2006 7:40 pm

Re: Magic Nodes 4.2 w/ 380 masks & real GUI (2011-07-01)[MM2+]

Post by ZvezdanD » Wed Sep 05, 2018 12:56 am

mhendu wrote:
Tue Sep 04, 2018 10:38 pm
Here's a screenshot of the settings
I told you, you should get opened the new Magic Nodes SQL Editor dialog box, not Edit Magic Node.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Post Reply