Commit Graph

584 Commits

Author SHA1 Message Date
Laurent Monin
ccf6edfbd9 Complete multi functions tests 2020-02-20 21:06:09 +01:00
Laurent Monin
037a487710 $title: test all cases, and drop test for empty text which cannot happen 2020-02-20 21:06:09 +01:00
Laurent Monin
37631e8ad7 $rsearch: test unmatched regex 2020-02-20 21:06:09 +01:00
Laurent Monin
5b1cfc5470 $div: test non-numeric parameter 2020-02-20 21:06:09 +01:00
Laurent Monin
665a3e9885 $div: Test and handle division by zero error 2020-02-20 21:06:09 +01:00
Laurent Monin
55ad8a3924 Test various unknown functions and unexpected script errors 2020-02-20 21:06:09 +01:00
Laurent Monin
0da4ab5d74 Tidy up script tests
Remove useless whitespaces
Fix typo in comment
test_optional_kwonly_parameters(): self is unused -> static method
Use raw string notation
2020-02-20 20:53:02 +01:00
Philipp Wolfer
7e350da299 Refactor File to handle acoustid_fingerprint
acoustid_fingerprint is now a normal attribute of File and always available. Adding and removing the file to and from the AcoustIDManager is now completely handled in File.
2020-02-20 07:29:51 +00:00
Philipp Wolfer
800f61e6b6 PICARD-1752: Use the first matching preferred release country
For releases with multiple release countries use the first matching preferred release country for %releasecountry%.
2020-02-19 21:55:23 +00:00
Philipp Wolfer
7539d8dc23 PICARD-1751: Provide a ~releasecountries variable 2020-02-19 21:55:23 +00:00
Laurent Monin
fd25dc987d PICARD-1748: limit number of countries displayed to 10 2020-02-19 20:11:58 +00:00
Philipp Wolfer
c018f076ea PICARD-1739: Use new Version class for version comparison in update check
Fixes update check not properly comparing alpha, beta and rc releases.
2020-02-11 23:03:20 +01:00
Philipp Wolfer
dce902f192 PICARD-1688: Added tests for AcoustID submission 2020-02-11 13:35:04 +01:00
Laurent Monin
0631e5ff28 Move copy_file_tmp() and remove_file_tmp() to PicardTestCase
It helps to reduce code redundancy.
2020-02-08 18:04:39 +01:00
Laurent Monin
64291c309c Use NamedTemporaryFile instead of mkstemp 2020-02-08 18:04:39 +01:00
Laurent Monin
498c8eab1b Add mktmpdir method to PicardTestCase, and use it more widely 2020-02-08 18:04:39 +01:00
Laurent Monin
b7389a6445 Tests: ensure temporary directories and files are removed after tests
- QSettings object needs special care, as file was re-created on exit
- Append a cleanup function as soon as possible to ensure temporary dirs & files are removed in any case
- prefer addCleanup() over tearDown(), keeping creation and cleanup together
2020-02-08 18:04:39 +01:00
Bob Swift
7762f9b929 Add $datetime() function and associated tests 2020-02-07 00:49:35 +01:00
Philipp Wolfer
7c6929286b Apply utime test workaround for all macOS versions.
This also seems not only on the macOS version but also on the Python build being used. On the build server with macOS 10.15 this works with the Python binaries provided on the server, but fails with official binaries from python.org.
2020-02-06 19:55:42 +01:00
Bob Swift
3903007a79 Add $slice() function and associated tests 2020-02-03 14:58:16 -07:00
Bob Swift
761c49124a Add $join() function and associated tests 2020-02-03 12:24:26 -07: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
Laurent Monin
52b80593ac Unify new and old script function names
Before introduction of new functions, we had a pattern: "name" script function was defined by "func_name"
Recent patches changed this, introducing inconsistencies.
Also we have inmulti and lenmulti, so stick to this scheme for getmulti and others.

func_find_str -> func_find
find_str -> find
func_reverse_str -> func_reverse
reverse_str -> reverse
func_get_multi -> func_getmulti
func_foreach_multi -> func_foreach
func_while_loop -> func_while
func_map_multi -> func_map
2020-02-01 18:07:38 +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
Bob Swift
0bea47fcdf Add tests on missing inputs. 2020-01-31 08:20:58 -07:00
Bob Swift
9ac7fd290b Add tests for new functions. 2020-01-30 19:31:41 -07:00
Philipp Wolfer
a9cb192f00 PICARD-1646: Consider release types for AcoustId results
Make the release primary and secondary type as provided by AcoustId available to the matching.
2020-01-29 19:25:36 +01:00
Philipp Wolfer
1799011eb6 PICARD-1715: Add new script_to_filename_with_metadata function
Keep existing script_to_filename function with same behavior as before
2020-01-28 15:14:47 +01:00
Philipp Wolfer
bcc81d86eb PICARD-1715: Allow changing file extension in renaming script 2020-01-28 13:41:27 +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
Philipp Wolfer
8f745f1a0d PICARD-1711: Fix deleting lyrics tag from ASF, APE, ID3 files 2020-01-23 12:10:15 +01:00
Philipp Wolfer
4d85c2e31f PICARD-1589: Support language for ID3 comments.
Adds syntax "comment:{language}:{description}" in addition to existing "comment:{description}" for comment tag names.
2020-01-23 07:57:41 +01:00
Laurent Monin
e44c6929c5 Move code outside Metadata class, to ease testing 2020-01-19 13:51:41 +01:00
Philipp Wolfer
63cb098006 PICARD-34: Fingerprint indicators shows submission status
The fingerprint indicator is shown in red for unsubmitted fingerprints and gray for submitted fingerprints. The tooltip explains the status.
2020-01-13 15:39:54 +01:00
Philipp Wolfer
83de668fdf Refactor Version.to_string and Version.from_string to improve readability 2020-01-03 14:26:40 +01:00
Philipp Wolfer
2f1b6d79da Implement proper version comparison for dev, alpha, beta and rc releases
The version identifier was previously compared alphabetically, which fails for e.g. "dev" < "alpha".

Implement proper version comparison by introducing a Version class (inherited from tuple).
2020-01-03 14:25:15 +01:00
Philipp Wolfer
95c3689a86 PICARD-1665: Refactoring for detecting user installed plugins 2019-12-31 17:17:54 +01:00
Philipp Wolfer
aa372fbe4c Format short version for alpha, beta and rc according to PEP 440
This omits the dot before the version identifier. Avoids setuptools warning about version normalization for alpha, beta and rc versions.

Note that it is still ".dev1", this is also according to PEP 440.
2019-12-16 08:13:24 +01:00
Philipp Wolfer
ac171c1ed6 Re-add ability to mark alpha, beta and rc pre-release versions
For Picard versions support the version identifiers 'alpha', 'beta' and 'rc' again (in addition to 'final' and 'dev'). This used to be supported, but got lost at some point

Long version strings will be e.g. 2.3.0beta2. If the shortened string is generated the idenfitiers for alpha and beta will be shortened to 'a' and 'b' (e.g. 2.3.0b2). This confirms to pre-release versioning is defined in PEP 440.
2019-12-16 07:52:01 +01:00
Philipp Wolfer
0855862c8c PICARD-321: Support backslash in filenames on non-Windows OS
With this change backslashes can be used in filenames on systems other than Windows. Only if Windows compatibility is activated backslashes will be replaced as before.
2019-12-14 01:03:46 +01:00
Zenara Daley
30fee6e38f PICARD-1521: Add TOFN to ID3 metadata (#1401)
* Add TOFN to ID3 metadata

Co-authored-by: Andrew Wiggins <xandrewwiggins@gmail.com>
Co-authored-by: Wyll Brimacombe <wyll.brimacombe@gmail.com>
Co-authored-by: Raunaq Gupta <raunaqg10@gmail.com>
Co-authored-by: Matt Ehrler <mehrler12@gmail.com>

* Add internal tag name; check for expected value in test

Co-authored-by: Andrew Wiggins <xandrewwiggins@gmail.com>
Co-authored-by: Wyll Brimacombe <wyll.brimacombe@gmail.com>
Co-authored-by: Raunaq Gupta <raunaqg10@gmail.com>
Co-authored-by: Matt Ehrler <mehrler12@gmail.com>
2019-12-09 23:38:22 +01:00
Laurent Monin
e529ee7d71 Test display_tag_name() when name contains multiple double dot separators 2019-12-09 12:48:24 +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
a78e857834 isort import sorting fixes 2019-11-26 13:11:08 +01:00
Philipp Wolfer
229116f95a Merge pull request #1306 from phw/PICARD-125-ac3
PICARD-125: Support for raw AC3 / EAC3 files
2019-11-19 09:45:08 +01:00