Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Find and remove list of strings from all fields
xonic
Newbie
Posts: 4
Permalink
Post Find and remove list of strings from all fields
on: April 11, 2020, 09:36
Quote

Hello,

I've been reading the manuals and forum but am still not sure how to best create an action that does the following things:

  • Loop through a list of unrelated MP3 files
  • For each file loop through all fields
  • For each field check if it contains any string from a list (preferably an external file)
  • Replace "string" with ""

Any hints would be very much appreciated!
Thanks

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 10:08
Quote

Glad to help. A couple of questions.

Do you want to load the files into Yate (you can easily load single files by setting the Open Mode to Playlist) or do you want to supply a list of files? It makes a difference as to how the action works. If you supply a list it must have full paths to the files.

There are a lot of fields. I can let you select which fields you want to modify. Also does this include UDTIs (items on the UD Text editing panel) or only single item fields such as Artist, Album, etc. ???

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 10:13
Quote

Oops forgot one. While you can certainly use an external text file for the items to be removed you can easily create a Replacement set in Preferences-Replacements which contains all your items. A Replacement set will be more efficient as one line in an action can remove all the items. Up to you.

xonic
Newbie
Posts: 4
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 12:57
Quote

Thanks for your quick response.
- loading the files into Yate is fine
- selecting fields would be great (maybe including 'select all' toggle?) and I don't think UDTIs are necessary to include
- I checked out the preferences-replacement and it's a good suggestion. I'll use that.

Is this something that already works or do you need to implement it?

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 13:27
Quote

It's not difficult. I'll write and post the action later today.

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 17:49
Quote

Download the file at:

https://2manyrobots.com/actions/ApplyReplacementSet.zip

Unzip the file and import the unzipped plist file via Yate>Import Preferences. You will now have an action named Apply Replacement Set.

Before you run the action you'll have to create a replacement set with the text you want replaced. While you asked to remove text, whatever is in the replacement set's to field will be inserted. If a to field is empty, nothing will be inserted.

The first time you run the action you will be prompted to choose a replacement set and whatever fields you want to potentially modify. You are only asked to configure once. If you want to change the configuration, start the action while holding down the Shift key.

Note that modified files are not automatically saved. You'll have to manually do a Save.

I've only done limited testing but it seems fine to me.

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 11, 2020, 17:50
Quote

When configuring the fields, the field table has context menu items to select all or none.

2MR2
Administrator
Posts: 1300
Permalink
Post Re: Find and remove list of strings from all fields
on: April 12, 2020, 09:31
Quote
    I noticed one thing I didn't know about: the artwork seems to have another description field which isn't being checked. Is there a way to add it to the fields?

I had a few minutes and it was easy so I made the changes. Delete the old action. Download the action at the same link as before and install it. This version allows you to select Artwork. When selected the description field of the first artwork item in any file will be modified.

One more thing I'm wondering about: is there a way to check if an artwork image matches a reference image and if yes, remove it as well?

This depends on a lot of factors. If the reference artwork in the file system was the original source for the artwork ... and the artwork item has not been modified ... then it should be possible. Yate allows you to import artwork from the file system and it will not import duplicates. So if an attempt to import artwork is made and it is not imported, then it is a duplicate and the artwork in the file can be deleted. This is tricky as being visually the same means nothing. Yate determines images to be duplicates if they are byte by byte identical. If the artwork in the audio file was not initially set from the copy in the file system, the chances of them being identical is slim. If you want to try this, I'll need some way of identifying the artwork in the filesystem. ie. same folder?, deterministic name?, etc.

Done for the day. Have a good one 🙂

xonic
Newbie
Posts: 4
Permalink
Post Re: Find and remove list of strings from all fields
on: April 14, 2020, 03:18
Quote

Thank you! Amazing job.
Let's forget about the image. It's not that important 🙂

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.067 seconds.