Commit Graph

1091 Commits

Author SHA1 Message Date
Philipp Wolfer
112e0d885e PICARD-2685: Preserve calculated AcoustID and ReplayGain tags
Preserve calculated AcoustID fingerprint and ReplayGain tags set on a file
object when that file object gets moved between tracks.
2023-07-25 00:47:31 +02:00
Philipp Wolfer
c9e728f97d Added tests for file.copy_metadata 2023-07-25 00:47:31 +02:00
Laurent Monin
497aeae35b Rework _try_locales(), introduce _try_encodings(), and add tests for them 2023-06-12 23:29:56 +02:00
Philipp Wolfer
27edb07068 Merge pull request #2231 from phw/i18n-tests
Refactor loading of locales in i18n module, extended logging and added tests
2023-06-11 17:40:51 +02:00
Laurent Monin
54801d97df Now that we default to 'C' locale for tests, remove redundant setups 2023-06-11 16:56:37 +02:00
Laurent Monin
386bbd683d test_existing_locales(): assert the _() changed after setup 2023-06-11 16:56:37 +02:00
Laurent Monin
be393f60af Default to C locale for all tests
It ensures tests aren't locale-dependent.
2023-06-11 16:56:37 +02:00
Laurent Monin
5d486c94fc WebService: add more tests for queryargs and unencoded_queryargs 2023-06-09 10:20:20 +02:00
Philipp Wolfer
866ef71dce Skip locale test if locales are not built, build locales in CI tests 2023-06-09 09:19:07 +02:00
Philipp Wolfer
79cbc53f4d i18n: basic tests for working locales 2023-06-09 08:59:16 +02:00
Laurent Monin
5395cbfc3d MBAPIHelper: introduce _make_inc_arg() to build inc parameter value
- it produces a more stable output (elements are sorted)
- it gets rid of empty elements (preventing a++b case)
- it accepts any iterable
- add a test for it

I also removed 2 useless conversion to tuple() (it can use a set() anyway)
2023-06-09 08:50:34 +02:00
Laurent Monin
58f6b8dc7b Get rid of APIHelper path list, just pass the path string to append 2023-06-08 16:44:15 +02:00
Laurent Monin
efde79a5e1 API Helpers: use unencoded_queryargs 2023-06-08 16:44:15 +02:00
Philipp Wolfer
c7acf9ea5b Use base_url in APIHelper instead of separate url and base_path properties 2023-06-08 16:44:15 +02:00
Laurent Monin
944a92eecd Add an helper method to encode query arguments: encoded_queryargs() 2023-06-08 16:44:15 +02:00
Laurent Monin
16ff3c5c97 Move few functions to new webservice.utils and introduce set_minimum_delay_for_url()
- it limits the need to import hostkey_from_url()
- it reduces the size of webservice.py
- it reduces dependencies between files
2023-06-08 16:44:15 +02:00
Laurent Monin
2e54681fd6 Introduce host_port_to_url()
This method will help with the move, since we have in many places just host & port (including in Options dialog).

Basically it does its best to convert it to an URL.
2023-06-08 16:44:15 +02:00
Laurent Monin
d10397d30a Introduce hostkey_from_url()
It calculates (host, port) from passed URL.
With matching tests.
2023-06-08 16:44:15 +02:00
Laurent Monin
f7151e17f7 Move code returning port from QUrl outside WSRequest
- it will be needed elsewhere
- add matching tests
2023-06-08 16:44:15 +02:00
Laurent Monin
d4e4641837 WSRequest: (re-)introduce queryargs optional parameter to ease adding query params 2023-06-08 16:44:15 +02:00
Laurent Monin
04fb24deb0 Add tests for WebService.*_url() new methods 2023-06-08 16:44:15 +02:00
Laurent Monin
76154e0b78 Introduce WSRequest.has_auth and simplify _update_authorization_header
Add matching tests
2023-06-03 19:41:17 +02:00
Laurent Monin
bdd31ab5a4 Complete tests for WSRequest
- 100% coverage of the class
2023-06-03 17:08:18 +02:00
Laurent Monin
8d1e304fbe Add minimal testing for WSRequest 2023-06-03 15:05:12 +02:00
Laurent Monin
91a0618a48 qurl -> url, and convert to Qurl is passed as a string 2023-06-03 14:48:59 +02:00
Laurent Monin
8bb5457f4f Simplify tests, pass QUrl to WSRequest 2023-06-03 14:23:14 +02:00
Laurent Monin
3d6554a958 Replace assert with if / raise AssertionError
- check path & handler aren't None either
- use a generic dummy_handler method for tests
2023-06-03 11:06:29 +02:00
Laurent Monin
3d95051ecf Enforce keywords arguments only for WSRequest and drop WS*Request subclasses
- using only keyword arguments will ease future changes
- order of arguments do not matter anymore
- this class isn't used directly for now, I don't think any plugin uses it
- subclasses aren't strictly needed
- since methods have a lot of parameters, making them obvious is much easier to read
- we can pass a dict (**kwargs)
- note the use of * in __init__() enforcing keyword args only.
- use few asserts as safety for "mandatory" arguments
2023-06-02 22:44:49 +02:00
Laurent Monin
ee76bf9e51 Improve coverage of artist_to_metadata(), checking for ended/endarea/enddate
- drop redundant test
2023-06-02 15:47:16 +02:00
Laurent Monin
a962f9176e Improve coverage of media_formats_from_node() and medium_to_metadata()
- use a multi-media release (this case wasn't tested at all)
- fuse old and new tests
- drop media.json test file as it was only used there
2023-06-02 15:26:53 +02:00
Laurent Monin
2060e3bc82 Add tests for _relations_to_metadata_target_type_url()
- 100% coverage of this method
2023-06-02 11:40:00 +02:00
Laurent Monin
2ae3b54614 Basic tests for _parse_attributes() 2023-06-02 10:59:18 +02:00
Laurent Monin
c82ef8b0f1 Extensively test _locales_from_aliases()
- use a stripped down version of aliases (unused fields were removed)
- 100% coverage
- correctness of results has to be reviewed
2023-06-02 00:45:40 +02:00
Philipp Wolfer
26cf9b507e PICARD-711: Add support for series variables
Adds support for variables for release group, release, recording
and work series. The following variables are getting set:

- ~recording_series
- ~recording_series_id
- ~recording_seriescomment
- ~recording_seriesnumber
- ~release_series
- ~release_series_id
- ~release_seriescomment
- ~release_seriesnumber
- ~releasegroup_series
- ~releasegroup_series_id
- ~releasegroup_seriescomment
- ~releasegroup_seriesnumber
- ~work_series
- ~work_series_id
- ~work_seriescomment
- ~work_seriesnumber
2023-05-29 21:42:42 +02:00
Philipp Wolfer
b273b116ca PICARD-2616: Add tests for releasedate tag 2023-05-22 20:46:45 +02:00
Philipp Wolfer
0b823f2443 PICARD-2535: Strip trailing null chars for Vorbis / FLAC 2023-04-18 11:16:48 +02:00
Philipp Wolfer
03449e01d3 PICARD-2630: Fix potential crash on config upgrade 2023-04-18 10:43:10 +02:00
Philipp Wolfer
c5445cf2e2 PICARD-2609: Run file.update on priority_thread_pool 2023-01-12 19:29:15 +01:00
Philipp Wolfer
c513e71cf0 Implement a FakeThreadPool for testing
This runs the specified task directly instead of doing actual threading.
2023-01-12 19:29:15 +01:00
David Kellner
2055b05d9a PICARD-2606: Add writer and lyricist sort names as variables 2023-01-07 23:00:08 +01:00
Philipp Wolfer
75871991b8 PICARD-2595: Customizable replacement for directory separators 2022-12-06 09:37:45 +01:00
Philipp Wolfer
a8a7ac8a50 Merge pull request #2177 from phw/filenaming-compat-options
Extended compatibility options for file names
2022-12-05 17:45:11 +01:00
Philipp Wolfer
0b6c78e9fb Merge pull request #2173 from rdswift/sequential_command_processing
PICARD-2546: Sequential processing of executable commands
2022-12-05 17:42:29 +01:00
Philipp Wolfer
cb339c6a4a PICARD-356: Allow user defined replacements for Windows incompatible characters 2022-12-05 17:08:56 +01:00
Philipp Wolfer
95c736a13e PICARD-2553: Add option to use underscores instead of spaces in file naming
This collapses multiple whitespace characters and underscores in a filename into a single underscore
2022-12-04 18:07:42 +01:00
Philipp Wolfer
a65a078e3b Added test for default cover name with CoverArtImage._make_image_filename 2022-11-28 10:23:19 +01:00
Philipp Wolfer
de94e98fc8 Added test for relative paths with CoverArtImage._make_image_filename 2022-11-28 10:05:29 +01:00
Philipp Wolfer
c39c0cbb8d PICARD-2590: Fix saving cover art images with relative paths 2022-11-28 09:46:55 +01:00
Bob Swift
1847b4d068 Refactor to create new RemoteCommands class 2022-11-22 15:54:39 -07:00
Bob Swift
551043ceaf Process command line executable commands through a queue object.
- Implement a queue object to hold the executable command queue
- Implement a command processor thread to parse the command queue
- Implement command file tracking to avoid circular references
- Do not queue additional commands after a `QUIT` has been queued

Still required:

- Block new command execution until current command is complete
- Test for completion must include all sub threads created
2022-11-22 15:54:38 -07:00