Replace String 1.0

Get help for different MediaMonkey 5 Addons.

Moderators: jiri, drakinite, Addon Administrators

frank1969a
Posts: 31
Joined: Sun Feb 28, 2021 6:57 am

Replace String 1.0

Post by frank1969a »

Can someone tell me HOW the Replace String 1.0 plugin works
OR if it really doesn't work with 5.0.2 (I see, only 5.0.0 and 5.0.1 is listed, but for 5.0.2 is a minor update, so I guessed, it would work).

I give the "existing" String (eg. Tiësto) and the "new" string (eg. Tiesto) - it says, it replaces 123 files - but nothing happens...?
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

Hi,
Frank contacted me privately and this is what he found:

Installed the 5.0.1.2433 in English language.
After that, the add-on worked fine!

Then he re-installed the most recent beta 5.0.2.2519 - and it works fine too.
What I noticed: Within the installation of 5.0.2.2519 it asked me to install a new language plugin for German. So maybe THIS was the reason?

Fact is: The issue is caused by language and NOT by 5.0.2 obviously!

So now it runs fine for me and I love Your tool already.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
pip_pill
Posts: 101
Joined: Sun Feb 26, 2017 3:55 pm

replace string

Post by pip_pill »

using replace string...

The addon only replaces the first instance of a string, it does not do all the instances in the string

ie "Destination Field:" Artist - replacing , with ;

1) untouched
NEIKED, Mae Muller, POLO G
2) first run
NEIKED; Mae Muller, POLO G
3) second run
NEIKED; Mae Muller; POLO G
Therefor it does not replace , with ; .......
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Replace String 1.0

Post by Erwin Hanzl »

@MPG
corrected code: successfully tested several times replaceAll
Last edited by Erwin Hanzl on Thu Dec 09, 2021 5:00 am, edited 1 time in total.
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

Thank you for the suggestion. I'll make the change and post an update!
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

New version has been uploaded which now does a replacement of all instances of the search string.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Replace String 1.0

Post by Erwin Hanzl »

@MPG
Thanks for your effort.
However, the update is not yet available.
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

Likely needs to be reviewed and approved by the MM developers before being available.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
Peke
Posts: 17457
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Replace String 1.0

Post by Peke »

Hi,
all addons approved.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Replace String 1.0

Post by Erwin Hanzl »

@MPG
Sorry, but version Replacestring 1.1. does not work.
(Yes, I changed the language to "English" beforehand)
NO ENTRY: context menu
NO ENTRY: Tools menu> Edit tags

I have rewritten the code in the version Replacestring1.0. in file: dlgReplaceString.js
OLD: str.replace
NEW: str.replaceAll


AND IT WORKS IN MM5.0.2.2524 AND 2526

P.S .: You should also rework the window.
thanks

Image
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

I have posted a new version, 1.1.1 that will fix the context menu issue and will allow users to resize the form in case the drop down is cut off. It'll be available once approved by the MM5 add-on team.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Replace String 1.0

Post by drakinite »

Approved.

I would still recommend the following change to fix the UI glitch:
Change the dropdown's parent's class from "noWrap" to "flex row" (like the others below it), remove the dropdown's style and replace it with the "fill" class. It will then change size according to the window size.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Replace String 1.0

Post by Erwin Hanzl »

@MPG

Please change the following code in Version "Replace String 1.1.1"
OLD: str.replace(edtSearchStr, edtReplaceStr);
NEW: str.replaceAll(edtSearchStr, edtReplaceStr);

Otherwise ONLY the first character in the string is changed.
Thank you.

Code: Select all

	switch(ddDestination){
		case "All":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.title;
				itmRec.title = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.artist;
				itmRec.artist = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.album;
				itmRec.album = str.replaceAll(edtSearchStr, edtReplaceStr);

				str = itmRec.albumArtist;
				itmRec.albumArtist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Title":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.title;
				itmRec.title = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Artist":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.artist;
				itmRec.artist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Album":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.album;
				itmRec.album = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
		case "Album Artist":
			objTrackList.forEach(function (itmRec) {
				let str = itmRec.albumArtist;
				itmRec.albumArtist = str.replaceAll(edtSearchStr, edtReplaceStr);
			});
			break;
	}

Thanks for the corrected window.

Image
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Posts: 418
Joined: Tue May 13, 2008 11:22 pm

Re: Replace String 1.0

Post by MPG »

Okay, not sure what happened, but the replaceAll was missed on some of the updates. That is now fixed. Also changed the window style again to be a bit more flexible on the dropdown. Be sure to download version 1.1.2 for the latest updates. Thank again everyone for your suggestions. Glad to see that you are finding it useful.
TIA
MPG
Triumph - Hold On: Music holds the secret, to know it can make you whole.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Replace String 1.0

Post by drakinite »

Thank you for developing addons for MM5 and sharing them! :slight_smile:
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply