Commit Graph

9537 Commits

Author SHA1 Message Date
Laurent Monin
d9429cd70a WSRequest: host, port, path, queryargs are now properties deduced from WSRequest.qurl 2023-06-03 14:23:14 +02:00
Laurent Monin
f9ee0d37e4 WSRequest: add qurl parameter, to pass a QUrl directly
In this case, it replaces host, port, path and queryargs
2023-06-03 13:17:07 +02:00
Laurent Monin
c553dc2947 _handle_redirect(): url -> source_qurl, redirect -> redirect_qurl
Use qurl suffix to denote those are QUrl objects, not strings.
2023-06-03 12:41:17 +02:00
Laurent Monin
db12d7fb90 Redirect handling: use WSRequest directly, instead of using get().
- remove useless intermediate variables
2023-06-03 12:24:25 +02:00
Laurent Monin
e7e80aa1ba Merge pull request #2220 from zas/webservice_tidyup
Enforce keywords arguments only for WSRequest and drop WS*Request sub…
2023-06-03 12:04:44 +02:00
Laurent Monin
9e7b103a43 download(): call WSRequest() directly
parse_response_type=None is the default, so removed
2023-06-03 11:28:28 +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
Philipp Wolfer
0aa81d009e Merge pull request #2219 from zas/mbjson_tidy3
Tidy up mbjson (pass 3)
2023-06-02 18:02:14 +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
Philipp Wolfer
e9cb996739 Translated using Weblate (German)
Currently translated at 100.0% (1594 of 1594 strings)

Co-authored-by: Philipp Wolfer <ph.wolfer@gmail.com>
Translate-URL: https://translations.metabrainz.org/projects/picard/app/de/
Translation: Picard/app
2023-06-02 13:26:27 +00: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
b83567d204 Remove unused code
- move test in _parse_attributes()
- drop _REPLACE_MAP and _transform_attribute() (only used once)
2023-06-02 11:02:33 +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
Laurent Monin
ca879789fd Move code from _translate_artist_node() to new _locales_from_aliases()
- it will ease testing
2023-06-01 19:35:21 +02:00
Laurent Monin
19b19976d2 Move definitions where they are used 2023-06-01 19:27:29 +02:00
Laurent Monin
2012a07548 Fix matching issue with alias types and use alias type id instead
- web service returns "Legal name" not "Legal Name"
- match is dependent on text strings, but since a while the service provides an alias type id
- use the type id instead for the match
- add ALIAS_TYPE_*_ID constants to picard/const
2023-06-01 16:48:33 +02:00
Philipp Wolfer
cdd73e8e8e Translated using Weblate (German)
Currently translated at 100.0% (1594 of 1594 strings)

Co-authored-by: Philipp Wolfer <ph.wolfer@gmail.com>
Translate-URL: https://translations.metabrainz.org/projects/picard/app/de/
Translation: Picard/app
2023-06-01 12:36:54 +00:00
Laurent Monin
3d502c8fc8 _parse_attributes(): move prefix declaration near where it is used 2023-06-01 14:33:51 +02:00
Laurent Monin
19cf094084 _PREFIX_ATTRS: list -> set 2023-06-01 14:31:06 +02:00
Laurent Monin
c887fd8c7d _artist_rel_types -> _ARTIST_REL_TYPES as it is a constant 2023-06-01 14:28:12 +02:00
Hosted Weblate
d5f3485430 Update translation files
Updated by "Update LINGUAS file" hook in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://translations.metabrainz.org/projects/picard/appstream/
Translation: Picard/appstream
2023-06-01 04:45:01 +00:00
Philipp Wolfer
4a58b13fcc Cleanup all translation files with msgmerge 2023-05-31 18:11:08 +02:00
Philipp Wolfer
8a4a437078 Removed .po files not used by Weblate 2023-05-31 18:04:01 +02:00
Philipp Wolfer
80ffc93ceb Translated using Weblate (Italian)
Currently translated at 100.0% (14 of 14 strings)

Translated using Weblate (Hebrew)

Currently translated at 100.0% (14 of 14 strings)

Translated using Weblate (Spanish)

Currently translated at 100.0% (14 of 14 strings)

Co-authored-by: Philipp Wolfer <ph.wolfer@gmail.com>
Translate-URL: https://translations.metabrainz.org/projects/picard/installer/es/
Translate-URL: https://translations.metabrainz.org/projects/picard/installer/he/
Translate-URL: https://translations.metabrainz.org/projects/picard/installer/it/
Translation: Picard/installer
2023-05-31 13:26:11 +00:00
Philipp Wolfer
2f76f68020 Translated using Weblate (German)
Currently translated at 100.0% (1594 of 1594 strings)

Co-authored-by: Philipp Wolfer <ph.wolfer@gmail.com>
Translate-URL: https://translations.metabrainz.org/projects/picard/app/de/
Translation: Picard/app
2023-05-31 13:18:16 +00:00
Philipp Wolfer
b0a6cbf352 Remove PGP code signing for PyPI release
PyPI stopped supporting PGP code signing, see
https://blog.pypi.org/posts/2023-05-23-removing-pgp/
2023-05-31 14:48:23 +02:00
Philipp Wolfer
88674073c3 Release 2.9.0b1 2023-05-31 09:22:22 +02:00
Philipp Wolfer
0d3365627d PICARD-2624: Use mutagen 1.46 with IFF file patch for macOS / Windows packages
Fixes writing IFF files with truncated trailing null bytes.
2023-05-31 09:21:24 +02:00
Philipp Wolfer
c38aad000c Updated Swedish translation 2023-05-31 08:34:51 +02:00
Laurent Monin
54a4444986 Merge pull request #2216 from zas/mbjson_tidy2
Tidy up mbjson a tad more
2023-05-30 13:49:35 +02:00
Laurent Monin
a972b72ca6 Change few more double quotes to single quotes 2023-05-30 12:35:41 +02:00
Laurent Monin
e80980aa82 _relations_to_metadata_target_type_artist(): valuesort -> sort_name 2023-05-30 11:39:25 +02:00
Laurent Monin
44bbb9976a _relations_to_metadata_target_type_artist(): value -> translated_name 2023-05-30 11:37:32 +02:00
Laurent Monin
7d366c0f03 artist_credit_from_node(), artist_credit_to_metadata(): improve naming consistency 2023-05-30 11:35:43 +02:00
Laurent Monin
187bf41b09 _translate_artist_node(): transl -> translated_name
Well, it stores the translated artist name (depending on options).
2023-05-30 11:22:50 +02:00
Laurent Monin
9185c485af _translate_artist_node(): translsort -> sort_name
This isn't a translation at all, just the sort name.
2023-05-30 11:21:05 +02:00
Laurent Monin
c272a8c21a Improve quotes consistency
- use single quotes for dict keys (those are very unlikely to contain any single or double quotes)
- use double quotes for strings meant to be displayed (meaning when building error messages here)
 except when the string contains double quotes

Previously it was a mixed bag, and in practice it makes no difference, so this move is just about making code more consistent and easier to read.
2023-05-30 11:13:27 +02:00
Laurent Monin
09ab2193a1 add_genres(), add_user_genres(): move test for empty name to dataobj add_genre() 2023-05-30 10:49:51 +02:00
Laurent Monin
16507ff4a3 Simplify _relation_attributes() (#2215)
Use try/except as the key should be always there, and that's the fastest in such case.
Except is there to prevent any issue if the API does something weird.
2023-05-30 10:10:02 +02:00
Philipp Wolfer
e01a43dc4b Updated translations 2023-05-30 08:58:26 +02:00
Laurent Monin
33b9f6c4aa Merge pull request #2214 from zas/mbjson_split
_relations_to_metadata(): split in smaller bits and reduce code redundancy
2023-05-30 08:18:37 +02:00
Laurent Monin
70a5945a9e _relations_to_metadata(): convert if/elif to dict search returning a function 2023-05-29 23:23:33 +02:00
Laurent Monin
ca561b38dd Convert context to new namedtuple TargetTypeFuncContext 2023-05-29 23:23:33 +02:00
Laurent Monin
1f72c6982b _relations_to_metadata(): merge contexts in one 2023-05-29 23:23:33 +02:00
Laurent Monin
91d943e37c _relations_to_metadata(): move bits to new _relations_to_metadata_target_type_series() 2023-05-29 23:23:33 +02:00
Laurent Monin
2a85a96bfc _relations_to_metadata(): move part of the code to new _relations_to_metadata_target_type_url() 2023-05-29 23:23:33 +02:00
Laurent Monin
1d27db520a _relations_to_metadata(): move part of the code to new _relations_to_metadata_target_type_work() 2023-05-29 23:23:33 +02:00