Commit Graph

924 Commits

Author SHA1 Message Date
Philipp Wolfer
59ffd90f88 PICARD-2292: Fix detecting instrumnetal for multi-work recordings
A recording with multiple works should only get the language set to "no lyrics" if all performances are instrumental
2022-01-23 18:04:18 +01:00
Philipp Wolfer
5b58e15cfc Merge pull request #2029 from rdswift/allow_empty_strings_in_multi-value
PICARD-2392: Allow empty strings in multi-value variables
2022-01-20 08:18:43 +01:00
Bob Swift
b804208123 Make 'end' argument optional for $substr() function 2022-01-20 08:18:16 +01:00
Philipp Wolfer
0983c9531d Set log level in tests to DEBUG
This allows pytest to capture the log output and display it in context of the test.d
2022-01-19 08:11:33 +01:00
Philipp Wolfer
0bf99949c4 Merge pull request #2003 from phw/PICARD-2368-compare-medium-track-count
PICARD-2368: When comparing metadata to a release consider the actual medium track count
2022-01-16 11:32:15 +01:00
Philipp Wolfer
c5662606cc PICARD-2332: Use PyQt5 scoped enums
This will ease the transition to Qt6
2022-01-14 18:28:01 +01:00
Bob Swift
975dfdffa9 PICARD-2382: Add option to keep duplicates in $copymerge() function. (#2020) 2022-01-14 07:58:35 +01:00
Bob Swift
c1cbb17a76 PICARD-2349: Standardize on "Standalone recordings" rather than "Non-album tracks" 2022-01-14 07:55:49 +01:00
Bob Swift
d0f512f79f Additional tests to ensure that changes don't break other functions 2022-01-07 09:30:58 -07:00
Bob Swift
49c6c0f2ec Remove underscore from clean_multi for consistency with other functions 2022-01-07 08:56:45 -07:00
Bob Swift
63fa1633f1 Allow empty strings in multi-value variables
- Keep empty strings in multi-value lists
- Add scripting function to remove empty strings from multi-value
- Update tests
2022-01-06 10:43:47 -07:00
Laurent Monin
53ec0e066f Add test for = encoding
Suggested by phw
2022-01-06 16:07:50 +01:00
Laurent Monin
8b787482ff _query_data(): Use urllib.parse.urlencode() instead of QUrl/QUrlQuery
Note: previously spaces weren't encoded, with this change they are (as plus) which is more conform to expected format for application/x-www-form-urlencoded
Actually this was a bug in previous version, as addQueryItem() didn't encode spaces as they should
See https://doc.qt.io/qt-5/qurlquery.html#addQueryItem
"This method does not treat spaces (ASCII 0x20) and plus ("+") signs as the same, like HTML forms do. If you need spaces to be represented as plus signs, use actual plus signs."

It wasn't an issue because none of passed data should contain spaces in our current code
2022-01-06 14:41:09 +01:00
Laurent Monin
d1de2a7208 _query_data(): skip empty key and add a test 2022-01-06 14:16:11 +01:00
Laurent Monin
820551d513 Move FILE_INFO_TAGS to File class and reduce code redundancy
- add a test for File._copy_file_info_tags()
2022-01-04 12:00:19 +01:00
Philipp Wolfer
1e9c61fcfb Ensure rating submission XML is valid
Properly encode provided data
2022-01-02 17:29:34 +01:00
Laurent Monin
728b110bac Get rid of _static_encode_acoustid_args()
- modify _encode_acoustid_args() accordingly
- modify tests to reflect changes
2021-12-28 19:23:04 +01:00
Laurent Monin
c6044fbdf5 Rework AcoustIdAPIHelper and add few tests 2021-12-28 15:10:00 +01:00
Laurent Monin
6ac0501f55 Simplify & test MBAPIHelper._collection_request()
- add batch size as parameter
- use range() step and do not modify passed releases argument
- add test
2021-12-27 17:33:46 +01:00
Laurent Monin
f14922ccc4 Move part of code to _xml_ratings() and test it 2021-12-27 11:50:52 +01:00
Philipp Wolfer
7b9bec2dd8 Fix set_genre_inc_params accepting config object 2021-12-26 12:32:42 +01:00
Laurent Monin
416a55dbc0 Use set+tuple for inc, and tuple for path_list, instead of lists 2021-12-26 12:20:17 +01:00
Bob Swift
9d5597f9ff Make $slice() 'end' parameter optional 2021-12-22 12:23:27 +01:00
Philipp Wolfer
a25a6fd0aa Fixed headers with fix-header.py 2021-12-21 08:38:20 +01:00
Philipp Wolfer
e32e116d5e PICARD-2368: Use totalalbumtracks for cluster matching 2021-12-18 17:26:57 +01:00
Philipp Wolfer
8ed8075cea PICARD-2368: When comparing metadata to a release consider the actual medium track count
tracktotal in a file is supposed to have the total number of tracks on the specific medium. Comparing to the total tracks of a release across all medium hence gives wrong results.
2021-12-18 17:26:56 +01:00
Philipp Wolfer
d1a7063c56 PICARD-2361: Fix clustering using removed files 2021-12-14 12:29:37 +01:00
Laurent Monin
d64c8c859b Merge pull request #1983 from zas/cleanup3
Add more tests and optimize similarity2()
2021-12-04 20:12:40 +01:00
Philipp Wolfer
a4e5c7ed42 PICARD-2346: Fix ID3v2.3 files showing changes with identical tags
Fixes a regression introduced in a5fcde to optimize display of format specific metadata
2021-12-04 17:05:31 +01:00
Laurent Monin
0765da5d7e similarity2(): test few more cases 2021-12-04 16:21:41 +01:00
Philipp Wolfer
2b8ea202b5 Merge pull request #1979 from phw/refactor-webservice-queue
Refactor webservice queue
2021-11-28 20:16:01 +01:00
Philipp Wolfer
54f7ad5f44 Extract queuing code from WebService into RequestPriorityQueue class
Eases testing and reduces the webservice class complexity.
2021-11-28 17:19:28 +01:00
Laurent Monin
ac57f95d92 Introduce _node_skip_empty_iter() to reduce code redundancy 2021-11-27 19:54:18 +01:00
Philipp Wolfer
1c566ca08c PICARD-2342: Fix saving MP4 and ASF files with "clear tags" and "preserve images"
Saving MP4 or ASF files failed if the files do not have existing embedded cover art and both "clear existing tags" and "keep embedded images when clearing tags" are active.
2021-11-27 15:06:39 +01:00
Laurent Monin
7f00f523ad Improve coverage 2021-11-26 15:21:38 +01:00
Laurent Monin
bd773b56a9 Reformat test json files
Fix spacing, end of lines, overall indentation
With the help of `python3.9 -m json.tool --no-ensure-ascii`
2021-11-26 15:03:14 +01:00
Laurent Monin
208fd09a03 Merge branch 'master' into genres_counters 2021-11-26 11:33:41 +01:00
Philipp Wolfer
543709eab2 Various minor code cleanups
- Use generator comprehension where possible
- Prefer dict comprehension over dict([...])
- General code cleanup
2021-11-26 08:00:43 +01:00
Laurent Monin
8d87135684 TagGenreFilter.filter(): make it a generator taking a Counter as input
Suggested by @phw
2021-11-25 17:17:52 +01:00
Laurent Monin
2be33ef810 Move part of code to static method _genres_to_metadata() and add tests for it 2021-11-25 14:59:13 +01:00
Laurent Monin
4f04772d43 Drop DataObject.merge_genres(), use Counter() instead 2021-11-25 11:33:53 +01:00
Philipp Wolfer
76975ae108 Have album_artist_from_path strip the Windows drive letter 2021-11-23 19:24:10 +01:00
Philipp Wolfer
b4ccb1618d PICARD-2340: Use configured Various Artists name for clusters without artist 2021-11-23 15:31:58 +01:00
Philipp Wolfer
2aefcd051a PICARD-2339: Ensure clustering uses most common spelling of the same artist
This restores previous behavior, where a cluster primary artist is based on the tokenized artist name, but then the most common real spelling is being used.
2021-11-23 15:17:07 +01:00
Philipp Wolfer
bb48705357 PICARD-2339: Simplify clustering algorithm
The existing code was using the Levenshtein distance to calculate similarity, which caused a O(n^2) performance. But since only exactly similar matches where used (similarity threshold 1.0) this was not necessary.

This new implementation uses simple comparison for string equality and performs in O(n).
2021-11-23 15:16:59 +01:00
Philipp Wolfer
0ff35391be Added tests for clustering algorithm
Co-authored-by: Laurent Monin <github@norz.org>
2021-11-23 15:11:15 +01:00
Laurent Monin
02ca1e641b Fix typo: threshhold -> threshold 2021-11-21 19:16:47 +01:00
Laurent Monin
7a143c1a02 Merge pull request #1954 from rdswift/unique_title_naming
Add functions for creating unique numbered script/profile titles
2021-11-20 18:37:26 +01:00
Laurent Monin
7c3171619f Add tests for _regex_numbered_title_fmt() 2021-11-20 14:15:15 +01:00
Laurent Monin
66b63968cd Introduce new class ABExtractor in order to get extractor dynamically
- use a cache to prevent useless version & sha calculations
- based cache key on stat.st_mtime_ns + path
- declare ab_extractor as a property of tagger class
- pass tagger to all methods that needs it
2021-11-18 18:48:16 +01:00