Commit Graph

150 Commits

Author SHA1 Message Date
Philipp Wolfer
c6446626aa Better fix for script functions with zero arguments. 2014-06-25 22:08:10 +02:00
Wieland Hoffmann
d95a7221b1 Merge branch 'sophist_fix_default_naming_script' of https://github.com/Sophist-UK/picard 2014-06-20 10:31:49 +02:00
Laurent Monin
9a6ca46341 Fix regression, save only ONE front image when "save_only_front_images_to_tags" is set
This regression was introduced during code rewrite, option name is misleading.

See https://github.com/musicbrainz/picard/pull/116
See PICARD-350 (which wasn't closed)
2014-05-26 15:17:27 +02:00
Laurent Monin
c0de7d95c9 PEP8 fixes 2014-05-21 16:04:35 +02:00
Laurent Monin
9e2a91d203 Re-add dummy load to ensure test images are > 64kb
As said in comment, size was increased to catch a bug in mutagen, so better
to keep it.
2014-05-21 16:04:34 +02:00
Laurent Monin
83e45ec77d Minor change in test. 2014-05-16 23:06:42 +02:00
Laurent Monin
a5827926ac Improve tests for cover art types
- add tests according to save_only_front_images_to_tags
- some formats cannot save more than one image
- some formats have no type
2014-05-16 20:40:50 +02:00
Laurent Monin
dc6e150d45 imageinfo: differentiate each failure case
Add exceptions (subclassing IdentificationError):
- NotEnoughData
- UnrecognizedFormat

Add corresponding test code.
2014-05-16 15:47:24 +02:00
Laurent Monin
fe62ec7c1e imageinfo.IdentifyError -> imageinfo.IdentificationError 2014-05-16 15:40:23 +02:00
Laurent Monin
a0213db350 Rely on imageinfo.identify to extract mimetype
- it does what mimetypes.get_from_data()
- .tiff is unused (afaik), so don't bother with it
- it is safer to analyze data for mime type (as data may not match provided mime type)
- when images are loaded from audio file tags, a check is done on valid format
2014-05-15 16:05:01 +02:00
Laurent Monin
8afcefaa6b Remove now unused LockableDefaultDict 2014-05-15 15:42:54 +02:00
Laurent Monin
5ab4625fe7 imageinfo: simplify code and exceptions, image_info() -> identify() 2014-05-15 15:40:36 +02:00
Laurent Monin
9a8fd64aec imageinfo: add extension to result 2014-05-15 15:29:22 +02:00
Laurent Monin
a9e9a14a74 Use real image files to test formats 2014-05-15 14:36:41 +02:00
Laurent Monin
b4367486bd Introduce image_info() to extract width, height from image data 2014-05-15 14:35:56 +02:00
Laurent Monin
42f2048d99 Drop refcount/__del__ mess, make code much more reliable and simpler 2014-05-15 14:26:39 +02:00
Laurent Monin
d652e7307b Make exit cleanup process more generic 2014-05-14 15:55:04 +02:00
Laurent Monin
60bfd6d344 Merge Image() and CoverArtImage()
- Info dialog Artwork tab now displays types and comment for cover art images
- a tooltip gives info about the source (url, caa url, local file, tag, ...)
2014-05-14 15:55:04 +02:00
Sophist
08ca42e90f Add non-NAT and NAT tests 2014-05-14 07:40:11 +01:00
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
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