Laurent Monin
14ce07756e
Update Copyright headers, with the help of fix-headers.py script
2021-11-10 21:38:54 +01:00
Philipp Wolfer
c0e6243a13
PICARD-1926: Adjust test cases for new config structure
2020-12-25 12:37:15 +01:00
Wieland Hoffmann
1386f1db03
PICARD-2036: Add MultiMetadataProxy::pop to WRITE_METHODS
2020-11-29 19:53:51 +01:00
Philipp Wolfer
53a2e3bb60
PICARD-1972: When matching files to tracks preserve track length ( #1659 )
...
PICARD-1972: Allow initializing Metadata with another Metadata object
If calling Metadata(other_metadata) make a full copy and don't just treat other_metadata as a dict.
Apart of making the API more intuitive this fixes issues with track metadata being not fully preserved when attaching files to tracks.
2020-10-16 13:27:10 +02:00
Philipp Wolfer
c3ccd6a392
Make MultiMetadataProxy fully compatible with Metadata
...
Run the same test cases against both Metadata and MultiMetadataProxy
2020-10-07 17:48:24 +02:00
Philipp Wolfer
06508560f9
MultiMetadataProxy to combine multiple metadata objects
2020-10-06 20:04:52 +02:00
Philipp Wolfer
21d4f04029
PICARD-259: Preserve manual changes to tracks on matched files
...
Keep track of manual changes to a track's metadata and reapply them to matched files.
2020-09-22 09:34:27 +02:00
dukeyin
f042928433
Don't use release relationships if they are disabled in metadata options
2020-07-17 19:57:37 -04:00
Philipp Wolfer
cbe88786a6
PICARD-1846: Do not raise KeyError in Metadata.unset
2020-06-19 14:47:03 +02: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
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
d653270b71
PICARD-1723: Consider disc number when comparing metadata
...
Improves results when matching files to multi-disc albums.
2020-02-03 11:16:52 +01:00
Philipp Wolfer
3d2a5cf250
PICARD-1719: Fix $unset must not mark tags for deletion.
...
This regressed in Picard 2.2.0 with commit 503b520 and $unset behaves the same as $delete.
2020-01-31 18:09:07 +01:00
Philipp Wolfer
c52519d91a
PICARD-239: Handle tags like "comment" and "comment:" the same
...
Some of Picard's tag names allow an additional description separated by a colon, e.g. "comment:desc". In case the description part is empty and the tag ends on a colon this is now treated the same as without any colon. So "lyrics" and "lyrics:" are the same tag.
Handling this in Metadata makes this change immediately available in scripting and to all formats. Script using both forms will still work.
2020-01-26 17:07:42 +01:00
Laurent Monin
aefbdb6a73
Move more code from Metadata to external small functions, test them
2020-01-23 18:01:28 +01:00
Laurent Monin
210e71b426
Pass parts to weights_from_release_type_scores()
2020-01-23 18:01:28 +01:00
Laurent Monin
e44c6929c5
Move code outside Metadata class, to ease testing
2020-01-19 13:51:41 +01:00
Philipp Wolfer
5c2e1eaa0a
PICARD-1664: Use preferred release type for cluster lookup
2019-12-02 13:52:13 +01:00
Philipp Wolfer
4dffc55ef1
Merge pull request #1379 from phw/PICARD-1677-ignore-tags
...
PICARD-1677: Tags can be ignored for metadata comparisson
2019-11-29 17:02:15 +01:00
Philipp Wolfer
4f684d0a48
PICARD-1678: Fix Picard crashing on non-integer search scores
...
If the search scores returned by the server are not integer values Picard crashed during metadata comparisson.
2019-11-29 17:00:59 +01:00
Philipp Wolfer
c6fcf3f1a0
PICARD-1677: Allow ignoring tags for metadata comparisson
...
Files that only differ in the tags set in the ignore list will not show up as changed even if those tags have changed.
2019-11-29 15:21:10 +01:00
Philipp Wolfer
96ca9188ba
PICARD-1406: Make setting data in Metadata consistently use strings
...
- All Metadata methods setting data (__setitem__, set, add, add_unique) will convert values to strings
- __setitem__ and set are equivalent
2019-11-12 07:55:54 +01:00
Philipp Wolfer
05ffd72884
tests: use assertIn and assertNotIn
2019-09-13 22:09:36 +02:00
Philipp Wolfer
cdaf812587
PICARD-1573: Metadata.apply_func() must handle tags getting removed
2019-08-14 18:59:55 +02:00
Philipp Wolfer
40f12e5eb2
Simplified metadata comparisson in tests
2019-06-24 14:59:22 +02:00
Philipp Wolfer
604e542d10
Check if images get copied in test for Metadata.update()
2019-06-23 11:39:38 +02:00
Philipp Wolfer
0c57969735
PICARD-1529: Allow copying metadata without images
2019-06-23 11:35:18 +02:00
Laurent Monin
7e3c9673c8
Add test for Metadata.apply_func() with preserved tags
2019-03-22 11:04:44 +01:00
Laurent Monin
b81947e22d
Add test for Metadata.strip_whitespace()
2019-03-22 10:54: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
6bf103bf34
Drop useless Metadata.remove_image()
2019-03-22 10:32:31 +01:00
Laurent Monin
b58c353259
Metadata.__setitem__(): accept any iterable as values
...
https://github.com/metabrainz/picard/pull/1137#discussion_r266974994
2019-03-21 11:53:39 +01:00
Laurent Monin
b5cc54e255
Make Metadata.__setitem__() consistent with Metadata.add() regarding 0 values
...
m['tag'] = 0 wasn't doing the same thing as m.add('tag', 0), because the test in __setitem__()
was different: if value vs if value or value == 0
So modify it to make behavior much more consistent.
m['tag'] = 0 or m.add('tag', 0) actually set tag to ['0']
m.add('tag', '') does nothing
m['tag'] = '' explicitly delete the tag (removing it from store, adding it to deleted tags)
m = Metadata(tag='') doesn't create an entry 'tag' (at all)
m = Metadata(tag=0) creates a tag, with internal value ['0']
This way, one can rewrite:
self.metadata = Metadata()
self.metadata['album'] = name
self.metadata['albumartist'] = artist
self.metadata['totaltracks'] = 0
to:
self.metadata = Metadata(album=name, albumartist=artist, totaltracks=0)
Without this patch, totaltracks wasn't set at all.
2019-03-21 11:38:58 +01:00
Laurent Monin
99604ac01f
Test and annotate the case of del with unknown keys
2019-03-20 21:17:06 +01:00
Laurent Monin
f6e3aedf7a
Raises TypeError if Metadata.update() is called without argument
...
This is more consistent with dict.update() behavior (and shouldn't happen anyway).
2019-03-20 11:03:56 +01:00
Laurent Monin
39b069adae
Test Metadata.len() with images
2019-03-20 10:42:50 +01:00
Laurent Monin
1a1e250489
Add tests for Metadata with images
2019-03-20 10:42:50 +01:00
Laurent Monin
2aec4a4185
Metadata.update(): fix a corner case leading to inconsistent data
...
```python
m = Metadata(tag1='a', tag2='b')
del m['tag1']
```
```
m store: {'tag2': ['b']}
m deleted: {'tag1'}
```
```python
m2 = Metadata(tag1='c', tag2='d')
del m2['tag2']
```
```
m2 store: {'tag2': ['b']}
m2 deleted: {'tag1'}
```
```python
m.update(m2)
```
```
m store: {'tag1': ['c']}
m deleted: {'tag1', 'tag2'} <---- this was incorrect, and untested case
```
This patch fixes it, and results to:
```
m store: {'tag1': ['c']}
m deleted: {'tag2'}
```
2019-03-20 10:42:50 +01:00
Laurent Monin
090c1e4eaf
Reduce code redundancy in tests
2019-03-20 10:42:50 +01:00
Laurent Monin
4e977cfb2c
Improve dict compatibility of Metadata.update() + minor fixes
2019-03-20 10:42:50 +01:00
Laurent Monin
503b5203f1
Metadata class: inherit from MutableMapping instead of dict
2019-03-20 10:42:49 +01:00
Philipp Wolfer
c8cd00fd7e
PICARD-1412: Consider deleted tags as changed
2018-11-14 09:18:15 +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
Laurent Monin
16a3074be4
PEP8 fixes
2018-09-13 17:54:13 +02:00
Philipp Wolfer
97bd392844
PICARD-1112: Clear deleted tags after saving file
2018-09-07 13:18:19 +02:00
Philipp Wolfer
cc93a2a45f
PICARD-1332: Deleted tags on tracks get applied to matched files
2018-09-05 08:33:19 +02:00
Laurent Monin
5329e3592a
Clean up and sort imports using isort
...
Add a config for isort (https://github.com/timothycrosley/isort )
Run isort -rc . and make import style consistent across files
Add a note about `isort` in CONTRIBUTING.md
2018-08-22 08:51:25 +02:00
Wieland Hoffmann
c18ae092ba
Fix length_score and add tests
...
In 2f8496e , 1.0 - ... turned into 0.0. Fix that.
2018-01-18 20:58:32 +01:00
Sophist
6474915c00
Remove unneeded imports, refactor code.
2017-04-27 12:26:08 +01:00