128 Commits

Author SHA1 Message Date
Sophist
6344ca2806 Move album_artist_from_path to utils
and add test.
2014-05-12 22:24:31 +01:00
Sophist
adab289bdb Fix and add tests for windows drive 2014-05-11 10:24:35 +01:00
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
14c09a8d1e Add a test for util.tags.display_tag_name() 2014-04-22 10:31:19 +02: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
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
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
Laurent Monin
60ed243470 Deprecated failUnlessRaises() -> assertRaises()
http://docs.python.org/2/library/unittest.html#deprecated-aliases
2013-07-01 13:33:42 +02:00
Laurent Monin
6062fe404e Deprecated failIfEqual() -> assertNotEqual()
http://docs.python.org/2/library/unittest.html#deprecated-aliases
2013-07-01 13:31:41 +02:00
Laurent Monin
403bafbbaa Deprecated failUnlessEqual() -> assertEqual()
http://docs.python.org/2/library/unittest.html#deprecated-aliases
2013-07-01 13:29:57 +02:00
Ionuț Ciocîrlan
fe8f6c2176 Characters counted in UTF-16 code points where appropriate.
NFD handled under OS X.
Windows bugfix when the relative directory path is short enough.
2013-06-17 21:42:10 +03:00
Ionuț Ciocîrlan
1b695eea63 small fixes and some comments 2013-06-14 21:18:25 +03:00
Ionuț Ciocîrlan
c2874ed671 tests and subsequent fixes 2013-06-11 18:19:15 +03:00
Wieland Hoffmann
51d2f2e670 fix test_utils 2012-01-16 16:30:15 +01:00
Philipp Wolfer
1567d802c3 Added UI to set preferred release types. 2011-05-13 00:15:39 +02:00
Philipp Wolfer
7d1dd3573c Fixed unittests for replace_win32_incompat, which changed in rev 809. 2010-04-11 23:10:28 +02:00
Philipp Wolfer
49df1fea16 Merged final fix for time rounding and added unit tests. 2010-04-11 23:05:26 +02:00
fatih
3214585efe Correction to the time rounding fix. 2010-04-09 14:53:29 +02:00
Lukáš Lalinský
aa7891eb21 Strip white-space from directory names. (#2558) 2007-03-25 14:08:59 +02:00
Lukáš Lalinský
0cee3ce295 Replace Æ with AE in file/directory names. (#2512) 2007-03-15 08:23:05 +01:00
Lukáš Lalinský
fa06e1aae0 Move translate_artist from mbxml to utils -- fixes TranslateArtistTest. 2007-02-24 15:23:11 +01:00
Lukáš Lalinský
1debfeb822 Translate foreign artist names. 2006-10-15 13:46:31 +02:00
Lukáš Lalinský
1ddde29916 File renaming. 2006-09-25 13:16:47 +02:00
Lukáš Lalinský
4f40955c85 * Fixed bug in similarity calculation.
* Utilities to unaccenting, removing non-ASCII characters, ...
 * Tests
2006-09-18 12:30:00 +02:00