Commit Graph

129 Commits

Author SHA1 Message Date
Laurent Monin
4f2da821d3 Add tests for util.linear_combination_of_weights 2014-04-28 16:22:18 +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
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
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
14c09a8d1e Add a test for util.tags.display_tag_name() 2014-04-22 10:31:19 +02:00
Sophist
dd03540f15 Add eq_all, ne_any as requested by Freso 2014-04-18 15:44:11 +01:00
Sophist
9291fcbb46 Add tests 2014-04-18 15:43:13 +01:00
Sophist
e406a554bc Address various comments by Philipp Wolfer ...
... based on actual knowledge of how characters are used in practice.

low quotation mark -> normal quotation mark rather than comma
oi should be gha -> gh rather than oi
ideographic punctuation, multiplication / division and middle dot are not punctuation
2014-04-14 11:57:35 +01:00
Sophist
110441f91e Address comments by 96187 ...
... whose local knowledge of how characters are actually used identified
more appropriate characters to map to.

soft hyphen -> nothing (since it is invisible)
multiplication -> x rather than * (visually closer)
remove duplicate oe
2014-04-14 11:57:34 +01:00
Sophist
323d12892c Improve unicode to ascii ...
for punctuation, normalization (merging similar looking characters into
the most common one), accents, and full conversion to ascii.

Functions and tests moved into separate files.

Although more comprehensive, the code should run faster because it
eliminates several loops (inc. a loop with two unicodedata references).

This is intended to form the basis of future PRs to:
a. Clean up (simplify) the file naming code
b. Provide script function(s) for cleaning individual tags / file name
parts
c. Add support for translation / transliteration plugins (which I think
make more sense than being included in Picard itself).
d. Support for converting Tags to ISO-8859-1 rather than ascii (since
that is what is supported by ID3 at least)
e. Possible additional options for allowing / preventing normalization,
possible reorganisation of options to centralise all encoding settings
onto one page rather than metadata, tags and file naming pages at
present (to be discussed).
2014-04-14 11:57:31 +01:00
Laurent Monin
a2a84ac8e6 Convert release_type_scores option to ListOption
We had a space-separated list of name,value tuples ("Album 0.5 Other 0.4"),
and two helper functions to load and save data in the correct format
(`load_release_type_scores` and `save_release_type_scores`).

Since option is converted to recently-introduced ListOption, data is now saved
as a list of tuples, eventually converted to dict when needed.
It simplifies code, and also prevents an issue if it comes we have a release group type
with a space in its name.

An upgrade hook was added to handle this change on Picard upgrade.
2014-04-10 10:21:30 +02:00
Wieland Hoffmann
5a2eee3484 Merge branch 'image-class-2'
Conflicts:
	picard/ui/infodialog.py
2014-04-08 13:13:22 +02:00
Sophist
b3d92437be Fix broken test_mbxml
broken by commit 6922848545
2014-04-03 14:22:41 +01:00
Laurent Monin
e97f404fff Update test_formats: defaultdict -> LockableDefaultDict 2014-03-31 21:33:32 +02:00
Sophist
b80091b56e Use Universal Newline Support instead. 2014-03-24 20:11:14 +00:00
Sophist
78d2ebf9a3 Strip CR as well as LF to avoid errors on Windows 2014-03-24 07:42:40 +00:00
Michael Wiencek
e620375872 Fix tests that broke after 099146a 2014-03-12 02:00:06 -05:00
Wieland Hoffmann
58f44f479a Delete cover files after running TestCoverArt 2014-03-06 23:43:02 +01:00
Wieland Hoffmann
01cefae96e Use the same Image objects for all tracks of an album 2014-03-06 23:41:43 +01:00
Wieland Hoffmann
3b8b0e7df7 Use a separate class for dealing with images
This new class stores the image data in a tempfile.TemporaryFile so we
don't keep the data for all images that are used somewhere in memory
anymore.

It also deals with saving images onto disk when the corresponding tracks
are saved (this was previously done by the File class). This removes the
ability to use tagger script in the cover file name (cf. the first line
of File._make_image_filename).
2014-03-06 23:41:38 +01:00
Wieland Hoffmann
0fe492492e Revert "Merge branch 'image-class'"
This reverts commit 6c72905c51, reversing
changes made to 005e591d80.
2014-03-06 23:38:51 +01:00
Wieland Hoffmann
6c72905c51 Merge branch 'image-class'
Conflicts:
	.gitignore
	NEWS.txt
	picard/ui/options/cover.py
	picard/ui/options/releases.py
	picard/webservice.py
	po/countries/et.po
	po/countries/pt_BR.po
	po/countries/zh_CN.po
	setup.py
2014-03-06 23:33:01 +01:00
Sophist
6742d8f841 Add support to read / write composer sort 2014-03-02 20:36:55 +00:00
Michael Wiencek
32b522617b Fix invalid syntax from af3e4d62 2014-02-22 23:01:06 -06:00
Sophist
af3e4d6288 Add Work Tag ...
See http://forums.musicbrainz.org/viewtopic.php?pid=24929 for
requirements discussion.
2014-02-11 18:18:44 +00:00
Wieland Hoffmann
aff7b1f045 Delete cover files after running TestCoverArt 2014-01-30 17:26:49 +01:00
Wieland Hoffmann
030fb9b00b Use the same Image objects for all tracks of an album 2014-01-22 23:28:54 +01:00
Wieland Hoffmann
b3593896a8 Use a separate class for dealing with images
This new class stores the image data in a tempfile.TemporaryFile so we
don't keep the data for all images that are used somewhere in memory
anymore.

It also deals with saving images onto disk when the corresponding tracks
are saved (this was previously done by the File class). This removes the
ability to use tagger script in the cover file name (cf. the first line
of File._make_image_filename).
2014-01-22 23:28:54 +01:00
Michael Wiencek
fbbadc8f9d Merge branch 'master' into artists-tag
Conflicts:
	NEWS.txt
2014-01-09 14:21:04 -06:00
Ionuț Ciocîrlan
156aeda8a0 updated tests for filename shortening (which now returns relative paths) 2014-01-07 17:59:50 +02:00
Laurent Monin
08ce08caa2 Merge pull request #187 from zas/picard528
PICARD-528: ignore file paths if hidden or excluded by regex
2014-01-06 16:34:06 -08:00
Laurent Monin
c2d53a4d4d version_from_string(): match end of the string instead full string 2014-01-02 17:32:34 +01:00
Laurent Monin
6e889ca0a0 Use exceptions in place of assertions -> VersionError 2014-01-02 17:28:41 +01:00
Laurent Monin
81ec25afcd Make version_from_string() more tolerant 2014-01-02 11:50:51 +01:00
Laurent Monin
4554898e42 version_to_string(): be smarter and accept list with strings 2013-12-31 15:31:12 +01:00
Laurent Monin
7c6d3e9c3b decimal(): fix missing parameter prec and update tests 2013-12-28 00:17:42 +01:00
Laurent Monin
a0598bdc6f Ignore hidden files and directories based on show_hidden_files option.
http://tickets.musicbrainz.org/browse/PICARD-528
2013-12-27 11:09:23 +01:00
Michael Wiencek
f144dde30d Support the Jaikoz 'artists' tag, with help from @night199uk and @zas 2013-12-07 18:12:51 -06:00
Laurent Monin
e9bd756144 Add more info to release name in other releases list if needed.
Context menu listing other releases is using main information from release,
often it is enough, but sometimes two or more items in the list are exactly
the same, user have to select each one to determine which is matching for him.

This patch is improving a bit the situation by adding packaging, barcode, or even
disambiguation comment if needed.
As an example, it often happens when a CD is released in jewel case and digipak,
with same label, date, country, barcode, etc..

Use more explicit '[no barcode]' instead of '[none]'.

A test case was added for this feature.
2013-12-06 08:43:23 +01:00
Ionuț Ciocîrlan
f1e8257d5a Merge remote-tracking branch 'upstream/master'
Conflicts:
	picard/file.py
2013-10-20 18:34:51 +03:00
Calvin Walton
769748c276 Fix the track test to include track mbid, change internal recording id name 2013-09-22 14:24:24 -04:00
Laurent Monin
ff0bd54153 Add a real life test for track number case extraction 2013-08-06 14:48:49 +02:00
Laurent Monin
2ec0631217 Use a smarter method to extract track number from filename.
When file has no metadata field indicating the track number, Picard
is trying to guess it from filename, but the simple regex wasn't very efficient.

tracknum_from_filename() does a much better job.
A test case was added.
2013-08-05 00:40:11 +02:00
Ionuț Ciocîrlan
aaab0dae48 moved filenaming stuff to its own module 2013-07-06 11:38:12 +03:00
Ionuț Ciocîrlan
b07e7f3e4d Merge remote-tracking branch 'upstream/master'
Conflicts:
	picard/util/__init__.py
	test/test_utils.py
2013-07-06 10:21:00 +03:00
Laurent Monin
7dd311697f tests: PEP8 fixes 2013-07-03 03:37:24 +02:00
Michael Wiencek
b3fcb04f9c Merge pull request #131 from zas/update_config_2
Handle configuration file versions
2013-07-02 15:06:58 -07:00
Laurent Monin
97f00b2d29 Handle configuration file versions.
version_info was renamed PICARD_VERSION
version_string was renamed PICARD_VERSION_STR
short version string is stored in PICARD_VERSION_STR_SHORT (for display)

Hooks can be created to handle upgrades (ie. options renaming), see config.register_upgrade_hook() and config.run_upgrade_hooks()
2013-07-02 01:45:25 +02:00
Laurent Monin
329ed8cedb Deprecated failUnlessAlmostEqual() -> assertAlmostEqual()
http://docs.python.org/2/library/unittest.html#deprecated-aliases
2013-07-01 13:34:53 +02:00
Laurent Monin
60ed243470 Deprecated failUnlessRaises() -> assertRaises()
http://docs.python.org/2/library/unittest.html#deprecated-aliases
2013-07-01 13:33:42 +02:00