- modify set_statusbar_message(): drop hacky %s replacement, it shouldn't be needed anyway
- add named arguments echo and translate to it, to cover all needs
- rewrite translatable strings to use named place holders
- fix up some messages, add plural forms if needed
http://tickets.musicbrainz.org/browse/PICARD-597
A babel bug prevents `input_dirs` to be parsed correctly with babel pre-1.0 versions.
Using regen_pot_file with babel 0.9.6 leads to an empty pot file (but header).
The fix appears in babel 1.0 Changelog:
- fix ‘input_dirs’ option for setuptools integration (ticket #232, initial patch by Étienne Bersac)
The workaround just splits `input_dirs` as it should when old babel versions are used.
Total didn't include all weights (ie. weights["format"] wasn't added), leading
to incorrect result, eventually > 1.0
The fix consists mostly to get rid of separated calculation of the total, using
previously introduced linear_combination_of_weights().
- partly rewrite compare_to_track() and compare_to_release()
- move parts building to new compare_to_release_parts() and drop return_parts parameter
- drop calculation of totals since this is handled in linear_combination_of_weights()
It is a safer alternative to reduce(lambda x, y: x + y[0] * y[1] / total, parts, 0.0) expression
which was requiring a separated calculation of total, prone to errors.
======================================================================
ERROR: test_display_tag_name (test.test_utils.TagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/musicbrainz/picard/test/test_utils.py", line 89, in test_display_tag_name
self.assertEqual(dtn('tag'), 'tag')
File "/home/travis/build/musicbrainz/picard/picard/util/tags.py", line 106, in display_tag_name
return _(name)
NameError: global name '_' is not defined
- fix typo in method name
- make comment more explicit
- test the case where only one element is in the list
- ignore 0 element case (should test skip(), but 2.6 lacks it)
Old one was silently replaced, this debug information will help to know
which one was replaced by which one.
Here is an example of log:
```
D: 12:29:36 Looking for plugins in directory '/home/zas/.config/MusicBrainz/Picard/plugins', 1 names found
D: 12:29:36 Module 'addrelease' conflict: unregistering previously loaded u'Add Cluster As Release' version 0.5 from '/home/zas/src/picard_zas/contrib/plugins/addrelease.py'
D: 12:29:36 Loading plugin u'Add Cluster As Release' version 0.5, compatible with API: 1.0
```
Logging was improved, showing plugin version and compatible API versions in debug mode.
When a plugin cannot be loaded due to incompatible API version log as a warning (was info).
With those changes they can be used to parse plugin API versions too.
Test cases were modified accordingly.
Main changes:
```python
>>> version_from_string("1.0")
(1, 0, 0, 'final', 0)
>>> version_from_string("1.0.1")
(1, 0, 1, 'final', 0)
```
Since there is no PluginPriority on previous Picard versions, this plugin will
raise an exception, better catch it and emit a warning.
Sophist said:
"It will work in most cases at normal priority, but any other plugins that run before it will get the old performers rather than the standardized performers.
PluginPriority defines few common values for plugin execution priority.
PluginFunctions wraps ExtensionPoint and use defaultdict() to handle priorities.
It also provide a register() and a run() methods.
All track metadata processors are equal but some are more equal than
others.
This commit allows a track metadata plugin to register with high
priority, and to run before plugins which are not high priority. This is
needed for the Standardize Performers plugin.