Commit Graph

2960 Commits

Author SHA1 Message Date
Laurent Monin
3b9d29f91b Update pot file 2014-05-04 11:47:16 +02:00
Laurent Monin
da274639ae Typo fix, add missing dot in translatable string. 2014-05-04 11:46:19 +02:00
Laurent Monin
cab9bacf69 Update pot file 2014-05-03 17:28:26 +02:00
Laurent Monin
5a047603f2 Merge pull request #309 from zas/PICARD-597
PICARD-597: use named place holders in translatable strings
2014-05-03 17:25:38 +02:00
Laurent Monin
d5c053ea7a Remove unneeded toBool() forgotten in commit 6ff1f5350
Traceback (most recent call last):
  File "./picard/acoustid.py", line 219, in _on_fpcalc_error
    finished = process.property('picard_finished').toBool()
AttributeError: 'bool' object has no attribute 'toBool'
2014-05-03 17:20:21 +02:00
Laurent Monin
751f2b64f7 PICARD-597: use named place holders in translatable strings
- 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
2014-05-03 17:09:50 +02:00
Laurent Monin
6e7cdc5737 Merge pull request #311 from zas/input_dirs_babel_0.9.6_workaround
Workaround: setup.py regen_pot_file didn't work with babel < 1.0
2014-05-03 16:02:29 +02:00
Laurent Monin
e4be26e1ce Merge pull request #310 from Sophist-UK/sophist_fix_plugin_file_selections
PICARD-600: Fix dist directory structure for plugins
2014-05-03 16:01:44 +02:00
Laurent Monin
70facb53d4 Merge pull request #312 from Sophist-UK/sophist_tweak_standardise_performers
Tweak Standardise Performers
2014-05-03 15:58:52 +02:00
Sophist
10f55d5df3 Tweak Standardise Performers
Since we have a try/except block so that this will run on previous
versions, tweak the API_VERSIONS so that it will load on these versions
of Picard.
2014-05-03 07:08:24 +01:00
Laurent Monin
7c90c3cb6e Workaround: setup.py regen_pot_file didn't work with babel < 1.0
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.
2014-05-02 17:00:06 +02:00
Laurent Monin
32b666ad14 Merge pull request #308 from Sophist-UK/sophist_improve_plugin_load_consistency_and_messages
Make plugins load in consistent order ...
2014-05-02 15:48:29 +02:00
Sophist
72b21c69c2 Add back deleted blank line 2014-05-02 08:30:04 +01:00
Sophist
63aa7b5086 Improve code and add top-level sort 2014-05-02 08:29:19 +01:00
Sophist
4165e356a4 Fix bug picked up by Travis 2014-05-02 08:06:07 +01:00
Sophist
25505c9216 Fix dist directory structure for plugins
Resolves PICARD-600
2014-05-02 07:56:35 +01:00
Sophist
4f063f7831 Make plugins load in consistent order.
See http://forums.musicbrainz.org/viewtopic.php?id=4939.
2014-05-01 14:56:33 +01:00
Sophist
aa933f2967 Make warnings show if not debugging 2014-05-01 13:53:04 +01:00
Laurent Monin
6177c1060d Merge pull request #307 from zas/fix_probability
Fix probability calculation, release similarities
2014-04-28 16:35:46 +02:00
Laurent Monin
4f2da821d3 Add tests for util.linear_combination_of_weights 2014-04-28 16:22:18 +02:00
Laurent Monin
38762d55d6 Fix release similarity calculation
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()
2014-04-28 13:53:30 +02:00
Laurent Monin
ab9fbd70ed Add 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.
2014-04-28 13:08:16 +02:00
Laurent Monin
c850e64b26 Merge pull request #306 from zas/fix_text
Fix missing _() in some cases.
2014-04-26 14:35:58 +02:00
Laurent Monin
8a5a2d8514 Fix missing _() in some cases.
======================================================================
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
2014-04-26 14:32:13 +02:00
Laurent Monin
73021c7c29 Merge pull request #304 from zas/plugin_api_versions
Improve parsing of plugin api versions and error handling
2014-04-26 12:16:17 +02:00
Laurent Monin
5389ed920f Merge pull request #298 from Sophist-UK/sophist_add_standardize_performers_plugin
Add a Standardize Performers plugin ...
2014-04-26 12:15:40 +02:00
Laurent Monin
a3b0e21290 Improve API versions list test
- 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)
2014-04-26 12:08:02 +02:00
Laurent Monin
645aa64c15 log.warning() will take care of format parameters, '%' -> ',' 2014-04-25 19:11:35 +02:00
Laurent Monin
26dca738f1 Add a note about optional priority parameter in NEWS.txt 2014-04-25 15:07:41 +02:00
Laurent Monin
48b9a5b32b Use constants instead of hard-coded string and number.
"picard.plugins." -> _PLUGIN_MODULE_PREFIX

It also fixes a potential issue forgotten in 5c25d56b7 preventive fix.
2014-04-25 12:50:35 +02:00
Sophist
f272a7c442 Merge pull request #4 from zas/PluginPriority
Improvements to plugin priority handling by @zas.
2014-04-25 11:40:09 +01:00
Laurent Monin
2c72bbab1c Log when a plugin conflicts with a previously loaded one.
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
```
2014-04-25 12:33:18 +02:00
Laurent Monin
12bf7d7b75 Log number of plugin names found in each directory 2014-04-25 12:28:20 +02:00
Laurent Monin
6c27d39f44 Use path returned by imp.find_module() instead of module.__file__
It will display the source file path (.py) instead of the compiled file path (.pyc)
2014-04-25 12:06:30 +02:00
Laurent Monin
3b5fe5f6d0 No need to traceback on VersionError, just display an error
Traceback isn't useful in this case anyway.
2014-04-25 12:01:47 +02:00
Laurent Monin
8afce2a1d4 Use version_from_string() and sets intersection to check API vs plugin versions
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).
2014-04-25 12:01:47 +02:00
Laurent Monin
9f63a24cf8 Reformat api_versions list, one per line, and note about order
Order is important since we have now a test case to prevent a lower version to be added.
2014-04-25 12:01:47 +02:00
Laurent Monin
d7ba54dc51 Make version_to_string() and version_from_string() more tolerant
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)
```
2014-04-25 12:01:47 +02:00
Laurent Monin
23ef8465f9 Try to run on previous Picard versions at normal priority.
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.
2014-04-25 11:21:29 +02:00
Laurent Monin
8deddf772d Use PluginPriority.HIGH and rename weight to priority 2014-04-24 21:45:11 +02:00
Laurent Monin
b7468b82f0 Use PluginFunctions and PluginPriority to reduce code redundancy.
weight was renamed priority
Execution loops were replaced by PluginFunctions.run() call
2014-04-24 21:45:11 +02:00
Laurent Monin
2fc6da074b Add PluginPriority and PluginFunctions classes
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.
2014-04-24 21:45:11 +02:00
Sophist
4724e73015 Set default weights to 100...
and plugin weight to 200.
2014-04-24 09:55:54 +01:00
Sophist
1a4d2b5ce7 Set default weights to 50 ...
... so we can have plugins with lower than default priority.
2014-04-24 09:55:53 +01:00
Laurent Monin
60fc6e4499 Add weight parameter to metadata_processors
Processors having more weight will be run first, default weight is 0.
2014-04-24 09:55:52 +01:00
Sophist
52e4766ec7 Add NEWS 2014-04-24 09:55:51 +01:00
Sophist
f1d3e2b46e Add Standardise Performers plugin 2014-04-24 09:55:02 +01:00
Sophist
fd72f10d59 Add track metadata plugin priority processing
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.
2014-04-24 09:55:01 +01:00
Laurent Monin
fb7e730932 Merge pull request #296 from Sophist-UK/sophist_switch_albumartist_website_to_xmlnode
Switch albumartist_website to XmlNode
2014-04-24 10:30:20 +02:00
Laurent Monin
a54645f0ec Merge pull request #302 from Sophist-UK/sophist_enhance_#285
Use multi-value %_performance_attributes% ...
2014-04-24 10:09:44 +02:00