getmusicbee.com

Support => Questions => Topic started by: whoozwah on December 04, 2019, 04:31:43 AM

Title: Favorite artists query
Post by: whoozwah on December 04, 2019, 04:31:43 AM
I'm looking for a way to generate a list of favorite artists and I haven't been able to do it thus far. What I want is a list of album artists wherein the # of tracks I have rated as Loved by them exceeds 5. I couldn't find a way to do this with auto playlists and I don't understand how the library reporting tools work to know if I could achieve it via that method. Can anyone help?

EDIT: I was thinking about this more and I think I have an idea what will do it but I don't know how to actually do it.

1. create a custom tag "AA Love Count"
2. Run an auto library report that grabs the total tracks that I've loved by an Album artist and write that number to the tag. (can you apply this tag to all tracks across your whole library? I really need some sort of super ELI5 tutorial about how the library reports work)
3. create an auto playlist that uses my Loved tracks playlist as the source that says "match all tracks where AA Love Count exceeds 5"

If someone can walk me through the actual process for doing that I'd be grateful.
Title: Re: Favorite artists query
Post by: boroda on December 05, 2019, 08:36:25 AM
create virtual tag, which displays 0 for not loved tracks and 1 for loved ones.
add 'album artist' or 'artist' grouping field to alr command, then add 'sum(your virtual tag)' aggregated function to alr.
save preset and assign virtual tag function id to this preset.
create another virtual tag with content: $ALR(<URL>,your function id)
create auto-playlist as you already suggested or just add 2nd virtual tag to main view and sort track list by this tag.
Title: Re: Favorite artists query
Post by: whoozwah on December 06, 2019, 04:21:11 AM
That got it. For some reason the $ALR virtual tag I used to create the playlist didn't allow me to use greater than or less than symbols to run the search. I had to search around for regex on the internet to match any number greater than 5. That was difficult as I don't understand regex.

Also, How do you add a leading zero to the $ALR(<URL>,my function id)
Title: Re: Favorite artists query
Post by: boroda on December 06, 2019, 05:43:01 AM
Also, How do you add a leading zero to the $ALR(<URL>,my function id)
why do you need leading zeros? this virtual tag is not for decoration, it's for sorting.
Title: Re: Favorite artists query
Post by: whoozwah on December 06, 2019, 06:21:12 AM
The leading zeroes are not for decoration. They are for sorting. The values in the final tag I'm using are in the triple digits and the numbering is wrong. Leading zeroes should ensure that natural numbering is restored.

As it is now, it sorts 100s, 10s, 20s, 30s etc instead of coming after 90s. I hope that clarifies my problem.
Title: Re: Favorite artists query
Post by: boroda on December 06, 2019, 06:34:55 AM
it's possible to add leading zeros, but there is a better way to solve the sorting issue: go to edit> edit preferences> tags(2)> 'configure fields...' button, assign type to your virtual tag as 'number'.
Title: Re: Favorite artists query
Post by: whoozwah on December 06, 2019, 03:59:36 PM
Right on. I'll give that a try when I get home from work. I appreciate your help. I've never used the virtual tags or library reports before so I'm learning a lot more about the more powerful features of musicbee. It's neat.  :)
Title: Re: Favorite artists query
Post by: whoozwah on December 09, 2019, 07:26:46 PM
Just wanted to say thanks, @boroda. defining the field type as number worked. I appreciate the help :)
Title: Re: Favorite artists query
Post by: ninjaman81 on November 16, 2023, 04:10:40 AM
I came across this post as I'm looking to do the exact same thing. Been using MusicBee for a few weeks now. LOVE IT!

I can't seem to figure out how to do step 1 of what @boroda calls out.

I created a virtual tag and put the following in the formula: $If(<Love>="Loved",0,1)

It returns the value 1 regardless if the song is loved or not. Something is just not working. I replaced "1" with <love> so that I can see what it's outputting, it outputs correctly. It shows "Loved" on songs I loved and "Not Loved" on songs that are not loved. So why does this formula ($If(<Love>="Loved",0,1)) not work. I have tried without quotes, I have tried comparing <love> to binary values. Nothing is working as I would except.

Can someone please tell me what's wrong with my formula. Thanks!
Title: Re: Favorite artists query
Post by: Mayibongwe on November 16, 2023, 05:02:57 AM
It returns the value 1 regardless if the song is loved or not.
I haven't gone through the whole thread, but try $If(<Love>="L",0,1)
Title: Re: Favorite artists query
Post by: ninjaman81 on November 16, 2023, 06:16:57 AM
Okay, by pure luck, I realized that the value stored in that tag was "L" when tracks were loved.

So the correct syntax is: $If(<Love>="L",1,0)

Kind of crazy, since when I use the <love> tag in the true or false outputs, it displays "Loved" or "Not Loved", yet the value in the tag was "L". I don't get it, but it's working now.

However, now I'm stuck with the subsequent steps. I couldn't understand the steps clearly, but the below screenshots show how I configured it. I think I followed the directions. But the Virtual2 tag has no values when I add to the main view on track view.

(https://ibb.co/t4k0WNf)

(https://ibb.co/tZP4b3G)

Title: Re: Favorite artists query
Post by: ninjaman81 on November 16, 2023, 06:19:13 AM
Thank you Mayibongwe. I was just posting that.

My screenshots didn't post. Let me try posting them again here:

(https://i.imgur.com/rYfrgqV.png)

(https://i.imgur.com/ZKzRelW.png)
Title: Re: Favorite artists query
Post by: ninjaman81 on November 16, 2023, 06:25:08 AM
Also, I don't know if it's related, but when I click on the "Preview" button when I have the above preset selected, it scans the library and then pops up with the below error message. After I close the error pop up, MusicBee crashes/closes.

MusicBee v3.5.8447.35843Store (Win10.0), 15 Nov 2023 22:23:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at MusicBeePlugin.LibraryReportsCommand.applyPresetResults(String[] queriedFiles, Boolean interactive, Boolean saveResultsToTags, String functionId, Int32 sequenceNumberGrouping, Nullable`1 filterResults)
   at MusicBeePlugin.LibraryReportsCommand.executePreset(String[] queriedFiles, Boolean interactive, Boolean saveResultsToTags, String functionId, Nullable`1 filterResults)
   at MusicBeePlugin.LibraryReportsCommand.previewTrackList()
   at MusicBeePlugin.PluginWindowTemplate.serializedOperation()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Title: Re: Favorite artists query
Post by: Bee-liever on November 16, 2023, 07:34:32 AM
@ninjaman81
with the new library reports the 2nd virtual tag should now be:
$LR(<URL>,121)
Title: Re: Favorite artists query
Post by: ninjaman81 on November 16, 2023, 08:38:45 AM
Thanks Bee-liever. Well, now it shows ??? in that field when I display it. It shows ??? for all tracks for that virtual2 field.

I still think there is some issue with how the library report is configured. I have never configured anything with this Library report before, so I have no idea what I'm doing.

From what you see in the screen shot is that correct? Do I need to do something to have it run that report? When I click the preview button, it looks like it's scanning my entire library and then it crashes (which is what I included above).
Title: Re: Favorite artists query
Post by: Bee-liever on November 16, 2023, 09:07:13 AM
@ninjaman81
That report also crashes for me. :(

I know boroda is making some changes to the Library Reports as I was also having some errors.

Posting the error report in the Additional Tagging & Reporting Tools plugin thread would probably help boroda fix any problems
Title: Re: Favorite artists query
Post by: tjinc on November 17, 2023, 01:37:49 PM
Possible alternative method (if required):

   VirtualX: $If(<Love>="L",1,0)
   VirtualY: $Sum(<VirtualX>,<Album Artist>)


And then configure an auto-playlist with criterion:
   <VirtualY> 'is greater than' 5

Edit 07/01/24:
Typo corrected (<Love> was <Loved>)
In order to enable the arithmetic comparators in the auto-playlist ('is greater than', 'is less than' etc), you may need to set the 'type' of <VirtualY> to 'Number' (Preferences > Tags (2) > Configure Fields)
Title: Re: Favorite artists query
Post by: ninjaman81 on November 19, 2023, 12:48:28 AM
Amazing! Thank you @tjinc. That is a much more elegant way to accomplish this and I don't even need the plugin.

This worked perfectly. Thank you so much!
Title: Re: Favorite artists query
Post by: boroda on November 24, 2023, 04:19:23 AM
i haven't coded for some time. Now, i'm going to fix various issues with the plugin. be patient and follow the plugin topic. i'll post an updated version in a few days.
Title: Re: Favorite artists query
Post by: ninjaman81 on January 07, 2024, 02:46:00 AM
I got this to work by doing the following (the recommended code above used Loved instead of Love, which is the correct variable):


Virtual1: $If(<Love>="L",1,0)
Virtual2: $Sum(<Virtual1>,<Album Artist>)

And then configure an auto-playlist with this criterion:
   <Virtual2> match RegEx   [5-9]\d*|\d{2,}

I had to use RegEx because the dropdown in Musicbee didn't give me the option to use "Greater than". Which seems kind of stupid, so I was forced to use the RegEx and ChatGPT to help me with that nonsense (it looks like Greek to me, but that code says anything greater than 4). So now I have it working. If I heart/love more than 4 songs of an Album Artist, it will appear in my auto playlist. Awesome!
Title: Re: Favorite artists query
Post by: tjinc on January 07, 2024, 06:57:15 PM
This worked perfectly. Thank you so much!
Not so perfectly it seems!

Thanks for pointing this out - I have edited my previous post to correct my typo and added a note on how to enable the arithmetic comparators for the auto-playlist.