Laurent Monin
14ce07756e
Update Copyright headers, with the help of fix-headers.py script
2021-11-10 21:38:54 +01:00
Philipp Wolfer
1686b7eb9c
imagelist.add_metadata_images must return False on empty image list
2021-11-07 15:01:18 +01:00
Philipp Wolfer
dbc236c48b
Optimize imagelist.add_metadata_images
...
Only update image list if new images are not already in the existing images. Also return bool value as indicated in the function documentation.
2021-11-07 15:01:18 +01:00
Philipp Wolfer
bbad105db5
Avoid emiting metadata_images_changed without changes
2020-12-02 09:06:01 +01:00
Philipp Wolfer
a54090a960
Let Track inherit from FileList
...
Unifies handling of objects with linked files. Simplifies code, e.g. cover art propagation to parent objects
2020-12-02 09:06:00 +01:00
Philipp Wolfer
fb83a8e76b
Enable flake8 E265: Block comment should start with '# '
...
Most changes involve replacing non-breaking space with a simple space after the #.
2020-05-13 11:03:13 +02:00
Philipp Wolfer
909ea667b8
Check code style of tests with flake8
2020-05-13 11:03:13 +02:00
Laurent Monin
6b5e852a60
Run fix-header on *.py
2020-02-24 10:25:09 +01:00
Laurent Monin
3f25bda3c8
Fix a bunch of flake8 warnings, mostly cosmetic changes
2020-02-21 21:43:40 +01:00
Philipp Wolfer
05ffd72884
tests: use assertIn and assertNotIn
2019-09-13 22:09:36 +02:00
Laurent Monin
99896bff8b
Add tests for ImageList copy()/clear()/del
...
Note: clear() is apparently inherited, i read docs saying otherwise, so i add a test for it to be sure
2019-03-22 10:32:32 +01:00
Laurent Monin
3a44ec41e2
Disable pylint warning about ImageList.insert()
2019-03-22 10:32:32 +01:00
Laurent Monin
9340c6c2ec
Drop Metadata.set_front_image(), replace with ImageList.strip_front_images()
...
- only used in ui/coverartbox.py and not directly linked to metadata
- add tests
-
2019-03-22 10:32:31 +01:00
Laurent Monin
78c9890e21
Drop Metadata.append_image(), use Metadata.images.append() instead
2019-03-22 10:32:31 +01:00
Laurent Monin
0b837ebe8d
Move Metadata.images_to_be_saved_to_tags() to ImageList.to_be_saved_to_tags()
...
- make it a generator
- drop @property, it's a function, no point in hiding it
- add tests
2019-03-22 10:32:31 +01:00
Laurent Monin
eb73ea6bc4
Replace Metadata.get_single_front_image() with ImageList.get_front_image()
...
- it makes much more sense, Metadata.images is an ImageList
- minimal changes required
- add tests for it
2019-03-22 10:32:31 +01:00
Laurent Monin
d60afe35d7
ImageList(): fix untestable class, since it requires gettext...
...
- image.types_as_string() was called from get_image_type() without translate=False
- dependency wasn't satisfied, so impossible to test as is
- make tests depending on languages isn't a good idea anyway
- use new CoverArtImage.normalized_types() instead
- simplify code
- add tests for ImageList.append() and ImageList.__eq__()
2019-03-22 10:32:31 +01:00
Philipp Wolfer
ecf8ad565a
PICARD-1178: Support comparing cover images with only one type
...
All our current tags support either no or only one type.
Fixes issues where files where shown as modified when loading again and comparing against cover art with more than one type.
2019-02-22 11:05:08 +01:00
Wieland Hoffmann
5391db12e7
Remove unused imports
2019-01-13 10:22:25 +01:00
Wieland Hoffmann
e624aa121c
Make PicardTestCase the parent class of all tests
...
This brings the faketagger and, more importantly, settings reset to all of them.
2018-10-23 17:32:50 +02:00
Wieland Hoffmann
f01f9299a9
Extract setting up a FakeTagger into a PicardTestCase class
2018-10-23 17:32:50 +02:00
Wieland Hoffmann
3c366c7e36
test_imagelist: Fulfill the assumption that QObject.tagger is a FakeTagger object
...
Previously, these tests were failing if executed before test_filesystem or
test_format which already did the same:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_imagelist.py:25: in create_test_files
CoverArtImage(url='file://file1', data=create_fake_png(b'a')),
picard/coverart/image.py:151: in __init__
self.set_data(data)
picard/coverart/image.py:248: in set_data
self.datahash = DataHash(data, suffix=self.extension)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <picard.coverart.image.DataHash object at 0x7f367fe036a0>
data = b'\x89PNG\r\n\x1a\naaaaIHDR\x00\x00\x00d\x00\x00\x00da', prefix = 'picard', suffix = '.png'
def __init__(self, data, prefix='picard', suffix=''):
self._filename = None
_datafile_mutex.lock()
try:
m = md5()
m.update(data)
self._hash = m.hexdigest()
if self._hash not in _datafiles:
(fd, self._filename) = tempfile.mkstemp(prefix=prefix, suffix=suffix)
> QObject.tagger.register_cleanup(self.delete_file)
E AttributeError: type object 'QObject' has no attribute 'tagger'
picard/coverart/image.py:68: AttributeError
2018-10-23 17:32:50 +02:00
Laurent Monin
6fe07b45ae
Removed a bunch of unused imports
2018-10-11 14:34:26 +02:00
Philipp Wolfer
a4f2cd8a89
PICARD-1339: Added add_metadata_images function
2018-10-06 09:58:43 +02:00
Philipp Wolfer
ab2778a521
PICARD-1339: Use remove_metadata_images for Album and Track
2018-10-06 09:58:43 +02:00
Philipp Wolfer
bc9c9ba602
PICARD-1339: WIP Added optimized imagelist.remove_metadata_images
2018-10-06 09:58:43 +02:00
Philipp Wolfer
a68e76a4b7
PICARD-1339: Added unitttest for update_metadata_images
2018-10-06 09:58:43 +02:00