Is There a Way to Clear Main Track Window?

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

Moderators: Peke, Gurus

lvstephanie

Is There a Way to Clear Main Track Window?

Post by lvstephanie »

I'm trying to make an addon / program that will select songs based on a "nested" value that I have in my custom fields ("nested" meaning that I might have a value like Hot100(17) which means that the song ranked #17 in Billboard's Hot100 chart). I've been able to add the songs using the MainTracksWindow.AddTracksFromQuery method, but noticed that it does indeed just add the songs to the list, keeping all of the previous songs in the list intact. What I am wanting, however, is to first clear the list of songs before displaying the results from that method call. Currently, I am looping through the AllVisibleSongList selecting each song one at a time, and then using the MainTracksWindow.RemoveSelectedTracks method to clear that window. However since my collection has upwards of 50K songs, this process is taking quite a while to perform (a few minutes at least). So I was wondering if there is a faster way to clear this list, like some MainTracksWindow.RemoveAllTracks method? Or if not a simple method to clear the list, if there is a better way to select all of the tracks in the list at once instead of selecting them one at a time.
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Is There a Way to Clear Main Track Window?

Post by MMFrLife »

I'm not sure if this is what you are talking about, but you can filter out songs in the main window (file list) by creating a collection (Gold) using specified criteria like
Property = specify custom field or any field you want; Condition = equals; Value = Hot100(17).

The "clearing" business isn't necessary with collections, as it will show only what you specify in criteria.

You could also try just searching a term like "Hot100(17)". Or, to specify in search field: |field name:Hot100(17)|, without vertical bars.
Last edited by MMFrLife on Sat Mar 05, 2016 6:07 am, edited 5 times in total.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
Guest

Re: Is There a Way to Clear Main Track Window?

Post by Guest »

lvstephanie wrote:addon / program that will select songs based on a "nested" value that I have in my custom fields
That is already possible with Magic Nodes and RegExp Find & Replace.
lvstephanie

Re: Is There a Way to Clear Main Track Window?

Post by lvstephanie »

Ultimately, I'd like to be able to use the search field to search for a range in the nested criteria. For example, putting into the search field "ChartRank: Hot100(1..40)" will search for songs that have Hot100(n) in the ChartRank (ie Custom1 renamed in my DB) where n is between 1 and 40; in other words, that search will yield songs that ranked in the top 40. But as this my first time working "under the scenes" with MM, I decided to first start using VB.Net (I'm much more proficient with the full fledged language than with the scripting version), hence why I wanted to start with a external program hoping to merge this program with the search field later on. So although searching "Hot100(17)" will indeed give me what I want with my original example, it won't be as useful once I start parsing how it handles ranges.

How do the magic nodes and RegEx solution work? Does this also provide a way to search for ranges within the nested field values? I'll try playing around with these to see if this will work for what I ultimately hope to do...
Guest

Re: Is There a Way to Clear Main Track Window?

Post by Guest »

Code: Select all

String enclosed with parentheses\<Custom 1|Exclusive right of:(|Right until:)|Top:40|Unknown:No>
Ultimately, the Filter qualifier could be added to specify a range. You cannot use the Search toolbar with the add-ons / external programs since it is not exposed in MM API.
lvstephanie

Re: Is There a Way to Clear Main Track Window?

Post by lvstephanie »

I'm starting to use Magic Nodes in order to do my search (as previous replies had mentioned)... The mask "String enclosed with parentheses" seemed to work well except that sorting seems to go by order of a string and not by a number. Thus the mask shown will pull up all songs ranked 1-39 plus any songs ranked 100; when sorting the rank by string, it will place Hot100(100) ahead of Hot100(20) since the string "100" comes before "20" alphabetically even though the opposite would be true when sorting by number. To get around this issue, I also had to add the filter to exclude the string "Hot(100)" before taking the Top 40. Even though that is a good work-around for the one mask, I was wondering if there is a better way to construct the mask so that I don't need to use that filter. Right now if I wanted to change the mask to find the top 5 songs, I'd not only have to change Top:40 to Top:5, but I'd also have to change the filter to also exclude "Hot100(10)" as this too would get sorted incorrectly; were I able to convert that string part in the parentheses to a number, then I could ignore the filter, and just change the Top:n to whatever rank I want to look for.

Another question I had related to the suggestion to use the Filter to specify a range... Although Top:40 will show the songs up to rank 40, it does not allow me to specify the lower limit -- I couldn't, for example, look for songs ranked 11-40 (eg popular songs that didn't make the Top 10). I'm assuming that this is what that suggestion was attempting to answer...
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is There a Way to Clear Main Track Window?

Post by ZvezdanD »

Filter:

Code: Select all

Cast(SubStr(<Custom 1>, InStr(<Custom 1>, '(') + 1) As Integer) Between 11 And 40
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.1  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.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply