Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create re-convert_guillemets.py #240

Open
wants to merge 4 commits into
base: 2.0
Choose a base branch
from
Open

Conversation

Nero-A
Copy link

@Nero-A Nero-A commented Sep 20, 2019

[re-]change metadata: change "<<" and ">>" to '«' and '»' (guillemets).
Workaround for my problem with replaced guillemets, see Issue #238

[re-]change metadata: change "<<" and ">>" to '«' and '»' (guillemets).
Workaround for my problem with replaced guillemets, see Issue metabrainz#238
# along with this program. If not, see <https://www.gnu.org/licenses/>.


PLUGIN_NAME = "re-convert"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This title is too generic. It needs to be called something like "Convert guillemots" in order to explain to users what it does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to limit it to guillemots only. Maybe there will be more characters in future.
But maybe it's not worth to publish it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better for it to do something simple - and be well named.

@Nero-A Nero-A changed the title Create re-convert.py Create re-convert_guillemets.py Sep 21, 2019
@phw
Copy link
Member

phw commented Sep 23, 2019

Code-wise this looks fine for me. But I wonder if we need another simple conversion plugin like this which operates on a limited set of fields for a very specific replacement. This basically can be done by a simple script like:

$set(album,$replace(%album%,<<,«))
$set(album,$replace(%album%,>>,»))
$set(title,$replace(%title%,<<,«))
$set(title,$replace(%title%,>>,»))

Now I get it, this is a lot of repetitive code, and once you want to do a lot of replacements on a lot of tags this gets pretty cumbersome.

But I feel having a single plugin for every possible conversion does also not scale well. We already have some plugins that IMHO are too specific, as they do some not too complex conversion for only a specific set of hard coded tags.

This plugin is totally fine as a plugin that solves your specific problem, I have myself created occasionally plugins I never shared because they are too specific and solved a specific thing I was interested in, sometimes only for tagging a few files. This is really part of the power of Picard to allow users to solve their issues. Maybe this would be better suited as an example on https://community.metabrainz.org/ for others to see how to solve issues like this?

What I would find interesting is a plugin where the user can define custom replacements and the tags they are applied to in a small UI.

@Sophist-UK
Copy link
Contributor

Code-wise this looks fine for me. But I wonder if we need another simple conversion plugin like this which operates on a limited set of fields for a very specific replacement. This basically can be done by a simple script like:
...
What I would find interesting is a plugin where the user can define custom replacements and the tags they are applied to in a small UI.

Now that Philipp has raised this I tend to agree with him - this functionality can be done by a script and a more general Replace plugin with an Options / Plugins / Replace UI page where users can defined the From / To strings and the fields to operate on would be very useful.

@phw
Copy link
Member

phw commented Dec 26, 2021

@zas Any opinion on this? My opinion is that a plugins with a hard coded set of replacements that does this replacement for a hard coded set of tags is useful for a specific use case. But we can fill up the plugin list with an endless amount of such plugins.

We already have replace_forbidden_symbols, non_ascii_equivalents and mayve others with a very similar functionality.

In many cases I think it would be more useful to have a script function doing these changes, instead of applying them to a hard coded list of tags. Or a plugin like this, but where you can configure the replacements and the tags on which they should be performed.

@zas
Copy link
Collaborator

zas commented Dec 26, 2021

In many cases I think it would be more useful to have a script function doing these changes, instead of applying them to a hard coded list of tags. Or a plugin like this, but where you can configure the replacements and the tags on which they should be performed.

Yes, something more generic would be better, I'd prefer a script function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants