Page 1 of 2

GenrePicker Addon - Documentation

Posted: Wed Mar 18, 2020 4:00 pm
by sterlingm
Hello,

I was able to rewrite the script for QuickMoods and created a GenrePicker extension. It shows 25 Genres as default and allows for multiple selections, just like QuickMoods.

This addon, like QuickMoods, is meant to be used while listening to music. If you find you don't have a genre for something, or notice the genre is not exactly right for the song you can easily pick a genre. I found this useful when listening to an album. Not all songs on an album have to be the same genre - right? Sometimes an artist experiments or over time their style changes. Anywho....

I'm creating this post in the hopes that people will benefit from the research into this addon.

In short genres are a mess.

There are 191 id3 v1 official genres.
https://eyed3.readthedocs.io/en/latest/ ... ml#example

I found this very interesting blog post from 2009:
https://tippopotamus.blogspot.com/2009/ ... is-it.html
Had to use the way back machine to get the original 25 genres referenced at the end of the post.

It's a good start. I'm beginning to think the fewer genres the better.

With that in mind I used tippopotamus's list and made some personal adjustments and incorporated them into this addon.

This addon was updated from the QuickMoods addon by molina. I simply modified it for genres and added the resorting feature. Would like to expand on it in the future but if others have ideas please chime in.

CURRENT FUNCTIONALITY
Displays a panel inside the MediaMonkey window showing genres. (Original functionality by molina for QuickMoods.)
Has a configuration window that allows the user to add/remove genres. (Original functionality by molina for QuickMoods.)
If a genre is tagged in a song and it matches a genre in the list, that genre checkbox will be checked. (Original functionality by molina for QuickMoods.)
The genre list will resort itself alphabetically when adding/removing genres. (New by SM)


THINGS TO FIX..... IF YOU CAN HELP PLEASE DO.
While the addon works there are a couple things I was hoping to fix, with some guidance.
[FIXED IN v1.2] --The list of genres in the panel do not show the ampersand unless I double "&&" them in the vbs script. Then you'll get the correct view. But when selecting them you get R&&B instead of R&B in your genre list. I don't know how to fix this. I thought of creating a function that checks and search/replaces but I'm not that big a vbs coder and it quickly got "messy" and I didn't want to break what was already working.

So if anyone knows how to have the display show correctly and also insert correcting in the mp3 tags that'd be great.

I'll think on it but no promises. For now the display panel just doesn't show them. "RB" or "Alternative _Punk" for example.
[FIXED IN v1.2]
--Need to have all non-alphanumeric characters stripped from the genre name other than the ampersand upon genre creation via the Genre Configuration form.

-- I don't think the uninstall is working correctly. At the moment the genre list stays as it original was. A complete restart of the computer is needed to flush the genrelist between script updates of coding and sometimes that doesn't even work.

--Auto sort the genre mp3 tags so they are listed in alphabetical order when saving them out. Currently the system simply appends the newly selected genre to the end of the genre list for the song. It would be nice so that they are in alphabetical order. (Even though there is no logical reason the alphabet is ordered this way, it's just something we've all agreed on. 8^)

THINGS THAT WOULD BE COOL TO HAVE IN THIS ADDON
[FIXED IN v1.2] --Fix the ampersand issue.
--Allow users to save out their genre lists when they add more genres to the default list. This way a user could simply re-import the list when deleting/updating the script.
--Allow for sub-genres. Will look into using a [+] sign after a genre. If that is shown then there are sub-genres for that "root" genre. Clicking it will simply expand the list to show the sub-genres. Sounds easy enough, right? 8^)
--Have a "Remove All Genres" checkbox in the panel. This will remove all current genres from the playing song.

Well that's it. Be well.
-Sterling

Re: GenrePicker Addon - Documentation

Posted: Wed Mar 18, 2020 4:13 pm
by sterlingm
The default 25 genres: Modified in version 1.2 to the below list.

Alternative
Books & Spoken
Blues
Children’s Music
Classical
Country
Dance
Easy Listening
Electronica
Folk
Gospel & Religious
Hip Hop/Rap
Holiday
Industrial
Jazz
Latin
Metal
New Age
Pop
Punk
Reggae
R&B
Rock
Soundtrack
World

Re: GenrePicker Addon - Documentation

Posted: Thu Mar 19, 2020 12:31 pm
by Peke
sterlingm wrote: Wed Mar 18, 2020 4:00 pm THINGS TO FIX..... IF YOU CAN HELP PLEASE DO.
While the addon works there are a couple things I was hoping to fix, with some guidance.
The list of genres in the panel do not show the ampersand unless I double "&&" them in the vbs script. Then you'll get the correct view. But when selecting them you get R&&B instead of R&B in your genre list. I don't know how to fix this. I thought of creating a function that checks and search/replaces but I'm not that big a vbs coder and it quickly got "messy" and I didn't want to break what was already working.
before you write Genre back just call

Code: Select all

FullGenre = Replace(FullGenre,"&&","&")"
and then write that to Genre.

Here is Example where if you break point to watch value of d at line "d = d" then you will see that && is corrected in whole string.

Code: Select all

d = "Pavle && with && testing &&"
d = Replace(d,"&&","&")

d = d

Re: GenrePicker Addon - Documentation

Posted: Sat Mar 21, 2020 9:47 am
by sterlingm
Thank you for this reply.

That was what I needed. I thought perhaps this was just a display issue in the panel, but unfortunately the panel itself is using the genre (with the double ampersands) so I had to make three location adjustments. Now, if the panel had a displayed name that was completely independent of the passed value this would definitely be easier. Again, I'm new to vbs so after some thinking.

My approach is:
All genres are saved by default into the genrelist with double-ampersands.
Any added genres by the user are converted to double-ampersands. This is done in the addgenre sub rather than the initgenrelist sub (where the resort happens) otherwise you'll end up with &&, &&&&, &&&&&&&, etc. when adding genres. Ugh.

When saving (with multiple or single checkboxes) double-ampersands are converted back to single for the mp3 tags.

Using the above logic I hope to have this done soon.

Thanks again for the assistance.
-Sterling

Re: GenrePicker Addon - Documentation

Posted: Sat Mar 21, 2020 8:30 pm
by Peke
Hi,
Sure when you are done let us know here, so that I can test and approve on addons page.

Re: GenrePicker Addon - Documentation

Posted: Sun Mar 22, 2020 7:46 pm
by sterlingm
Version 1.2

After consideration I decided to attack this from the building of the checkboxes.
In this version each genre loaded into the checkbox subroutine is examined for a single ampersand and replaced with a double ampersand. This allows the checkbox labels to be displayed correctly and nothing needs to be done for user added genres either. Unfortunately there is no way that I could find to have a checkbox have a label as one thing and a value as another. Apparently a checkbox's label is its value. Ugh. What if you want a human readable label and a barcode number as its value? I'm sure I'm missing something.
Next, when a checkbox is clicked the ChBClick sub is fired and inside there is where all the conversions are reversed.

Using this approach prevented the need to rewrite all the other subroutines throughout the script. This seemed like a cleaner method.

I'd like to add sub-checkboxes using an plus/minus click. If anyone has code samples I can look at please let me know.

I've been having a very difficult time finding vbs scripting examples. You'd think it wouldn't be difficult but most websites are focusing on excel or HTML examples. This is not helpful.

I hope the new version works ok and I didn't miss something.
Thanks.
-Sterling

Re: GenrePicker Addon - Documentation

Posted: Mon Mar 23, 2020 9:30 pm
by Peke
Hi,
Approved, good work.

Re: GenrePicker Addon - Documentation

Posted: Tue Mar 24, 2020 2:44 pm
by eloquintet
I tried using this and when I selected a genre it said error executing script event catastrophic failure

Re: GenrePicker Addon - Documentation

Posted: Wed Mar 25, 2020 1:05 pm
by sterlingm
Hello,

Sorry to hear that. Not entirely sure what could be the issue. I only experienced those issues during scripting. The version I have now, and uploaded does not throw any errors on my system. If others are getting this also please let me know.

Note, a song must be playing in order for the script to work. It does not work just for selecting a song or even multiple songs. Only the currently playing song can be assigned a genre.

What genre are you adding? Is it using the default list or is it a genre you added?

Thanks.
-Sterling

Re: GenrePicker Addon - Documentation

Posted: Thu Mar 26, 2020 10:03 pm
by eloquintet
Do you have a readme or something that describes how I am supposed to use this addon? I did not have a song playing when I got error but now I have a song playing and select a genre in the dialog box on right and the genre does not get updated in the song that is playing no matter what I do so how am I supposed to use this?

Re: GenrePicker Addon - Documentation

Posted: Fri Mar 27, 2020 6:35 am
by sterlingm
GenrePicker:

This addon allows the user to quickly select from a list of genres, in a panel displayed in MediaMonkey, and have the selected genre saved to the mp3 tags of the currently playing song.

Once installed, there are now two new additions to the menu items:

EDIT:
Under Edit there is now a GenrePicker Configuration.
When selected it pops up a form window showing the current list of genres. This also allows the user to add (plus sign) or remove (minus sign) genres from the list.
Selecting a genre from this window puts it in the text field that is on the same line as the add/minus buttons. Clicking the minus sign will remove the genre from the list.
Typing a genre that is not already in the list, and clicking the add button, will add that genre to the list. This also updates the genre list in the MediaMonkey panel.
Clicking the "default" button will overwrite all genres currently in the form list with the default list of genres programmed into the system. Any custom genres added previously will be gone. Don't click the default button unless you want to start over.

It is highly recommended not to use any special characters other than the ampersand '&' in custom genre labels. Special characters may break the program. See the default list for examples of proper genre labels using ampersand.

VIEW:
Under View there is a GenrePicker entry. Clicking the GenrePicker label under Views, so that a check appears next to its label, will display the genre panel inside MediaMonkey. Clicking it again will hide the panel.

The panel that displays can be expanded using standard window sizing methods. Simply click an the bottom or left side edge and drag it.

Assigning a genre to a song.
A song must be playing in order to assign a genre using the GenrePicker panel.
When a song is playing click the checkbox next to the genre in the list panel and it will add that genre to the song.
Unchecking the checkbox of the genre in the list panel will remove the genre from the currently playing song.

If there are existing genres in the song mp3 tags GenrePicker will append the selected genre to the end of the genre list in the mp3 tags. It does not overwrite existing genres. This addition currently adds to the end of the genre list and does not auto-sort them alphabetically. If you have a lot of genres for a song and click a checkbox look at the end of the list in the genre column of Media Monkey. (You do have the genre column displayed in MediaMonkey, yes?)

If there are existing genres that are not in the current list panel there will be no checkbox available. The system does not read existing genres in a song and add them to the list. If a user wants that specific genre they can use the GenrePicker Configuration and add it. Once it is added and it exactly matches a genre in a playing song the checkbox next to the custom added genre will be selected.

When a song is playing its genres are examined and if a genre assigned to it in its mp3 tags is found in the GenrePicker list that genre's checkbox will automatically be selected. If the user unchecks the checkbox it will remove the genre from the song.


This addon is currently running/written on a windows 10 machine. The VBS is standard code, as far as I know, and does not include any unusual programming requirements like extensions or dlls, etc. MediaMonkey moderators have approved this addon. I'm assuming because it also worked on their systems.

Let me know if there are any questions or if the above README is confusing in any section. I'll do what I can to clarify.
Thank you,
-Sterling

Re: GenrePicker Addon - Documentation

Posted: Fri Jun 26, 2020 6:58 am
by phit42
I would love to see this with any selected file, not just the playlist, and maybe sth fancy like light-grey check in the box for genres that are on some files not all.

I would also like to see sth similar as a dialog box within the properties. Modifying inconsistent genres on files, albums, large numbers of selected files is a pain.

Just wishes... :wink:

Re: GenrePicker Addon - Documentation

Posted: Thu Aug 20, 2020 4:12 pm
by cscscs
Hey hope you can help me:

After I tick some checkboxes, the MM crashes with message 'Error executing script event. Not enough working space SDB.NewSongList'

I tried with another system, the same issue. It seem to happen randomly, but the more and faster I tick the boxes it crashes immediately.

Windows 10, MM 4.1.15

Re: GenrePicker Addon - Documentation

Posted: Sat Aug 22, 2020 7:38 pm
by Peke
Hi,
Please update to latest version from http://www.mediamonkey.com/forum/viewto ... 54426&sd=d

Re: GenrePicker Addon - Documentation

Posted: Sun Oct 11, 2020 5:55 am
by DJMODIFY
Unfortunately it doesnt work for me. Fails with Line 186 column 4 and wont work at all.