Replace String 1.0

Get help for different MediaMonkey v5 / v2024 Addons.

Modérateurs : jiri, drakinite, Addon Administrators

frank1969a
Messages : 33
Inscription : dim. févr. 28, 2021 6:57 am

Replace String 1.0

Message par 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
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 104
Inscription : dim. févr. 26, 2017 3:55 pm

replace string

Message par 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
Messages : 1190
Inscription : mar. juin 13, 2017 8:47 am

Re: Replace String 1.0

Message par Erwin Hanzl »

@MPG
corrected code: successfully tested several times replaceAll
Dernière modification par Erwin Hanzl le jeu. déc. 09, 2021 5:00 am, modifié 1 fois.
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 1190
Inscription : mar. juin 13, 2017 8:47 am

Re: Replace String 1.0

Message par Erwin Hanzl »

@MPG
Thanks for your effort.
However, the update is not yet available.
MMW 4.1.31.1919 Gold-Standardinstallation
MPG
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 18381
Inscription : mar. juin 10, 2003 7:21 pm

Re: Replace String 1.0

Message par 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
Messages : 1190
Inscription : mar. juin 13, 2017 8:47 am

Re: Replace String 1.0

Message par 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
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 988
Inscription : mar. mai 12, 2020 10:06 am

Re: Replace String 1.0

Message par 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
Data scientist, 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
Messages : 1190
Inscription : mar. juin 13, 2017 8:47 am

Re: Replace String 1.0

Message par 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 : Tout sélectionner

	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
Messages : 445
Inscription : mar. mai 13, 2008 11:22 pm

Re: Replace String 1.0

Message par 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
Messages : 988
Inscription : mar. mai 12, 2020 10:06 am

Re: Replace String 1.0

Message par drakinite »

Thank you for developing addons for MM5 and sharing them! :slight_smile:
Image
Data scientist, 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.
Répondre