Commit Graph

9592 Commits

Author SHA1 Message Date
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
59550aa366 Simplify code using encoded_queryargs() 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
dffb7cd7db WSRequest: make it clear queryargs should consist of encoded arguments 2023-06-08 16:44:15 +02:00
Laurent Monin
60778cd9fe Mark WebService.(get|post|put|delete|download)() methods as deprecated
- log a warning
2023-06-08 16:44:15 +02:00
Laurent Monin
f876fc0403 CoverArtBox: simplify code using WebService.download_url() 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
886cc15ef3 Drop ACOUSTID_HOST, ACOUSTID_PORT in favor of new ACOUSTID_URL 2023-06-08 16:44:15 +02:00
Laurent Monin
a39932c264 Introduce APIHelper url property and replace host & port properties
- __init__() calls in subclasses are not needed anymore
- base_path class property defines the url path prefix
2023-06-08 16:44:15 +02:00
Laurent Monin
884b7e1990 Convert MBAPIHelper 2023-06-08 16:44:15 +02:00
Laurent Monin
6583ba7524 Convert APIHelper 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
8b243e72b6 Get rid of CAA_HOST / CAA_PORT, replaced by CAA_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
0eff0e1562 CoverArtProviderCaa: use WebService.get_url() 2023-06-08 16:44:15 +02:00
Laurent Monin
cef706de08 Plugins API: use WebService.get_url() and URLs instead of host,port,etc 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
76139d946d CoverArt: use WebService.download_url() 2023-06-08 16:44:15 +02:00
Laurent Monin
572648d110 oauth: use WebService *_url() methods 2023-06-08 16:44:15 +02:00
Laurent Monin
a0213bd817 Use WebService.get_url() and WebService.get_download(), introduce CAA_URL constant
Note: I removed a call to CaaThumbnailCoverArtImage() that doesn't look to make sense
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
07a7ea84a2 WebService: add *_url() methods accepting url= (and others) parameters
Those are meant to ease the transition from equivalent methods using host,port,etc...
2023-06-08 16:44:15 +02:00
Laurent Monin
8ed7d43435 Merge pull request #2229 from zas/rating_submit_error
Display a message when rating submission fails due to server error
2023-06-08 16:43:34 +02:00
Laurent Monin
de81416427 Merge pull request #2228 from phw/PICARD-2653-update-alias-locales
PICARD-2653: Update locale list
2023-06-08 16:39:05 +02:00
Laurent Monin
ea09604ce9 Display a message when rating submission fails due to server error
- a message is written to status bar and history, translatable
- another message is sent via log.error()
2023-06-08 14:43:23 +02:00
Philipp Wolfer
df55462824 PICARD-2653: Update locale list
Add the new additions from MB server code (see MBS-13102)
2023-06-08 13:02:12 +02:00
Philipp Wolfer
ecafcbe79d Update calculation of patch versions for Windows store
For Windows store we combine the patch version with the build number to
ensure continuously growing version numbers for upgrades.
Reduce the version numbers to be multiplied to 1000 to allow for two
digit patch version numbers.
2023-06-07 08:58:16 +02:00
Laurent Monin
88c8dbced8 PICARD-2651: do not propagate history logger either 2023-06-06 07:36:11 +02:00
Laurent Monin
5fb2ad4017 Merge pull request #2224 from zas/update_headers
Update copyright headers
2023-06-04 11:27:54 +02:00
Laurent Monin
2f81bf5992 Update copyright headers 2023-06-04 11:08:21 +02:00
Laurent Monin
e51b40b59d Merge pull request #2223 from zas/fix_header_improv
Fix header help script improvements
2023-06-04 11:02:25 +02:00
Laurent Monin
afdcc16b40 Merge pull request #2222 from zas/PICARD-2651
PICARD-2651: fix duplicate messages on console
2023-06-04 11:01:42 +02:00
Philipp Wolfer
889a0cdf15 Merge pull request #2221 from zas/webservice_tidyup2
Webservice tidy up (pass 2)
2023-06-04 10:34:32 +02:00
Laurent Monin
f9cd8e0d4c Add fix-header: nolicense 2023-06-04 10:34:01 +02:00
Laurent Monin
40a16cf147 fix-header: add alias for bob 2023-06-04 10:29:41 +02:00
Laurent Monin
9b87499999 fix-header: add support for nolicense to avoid adding our license
It also adds support for multiple words in fix-header: line
2023-06-04 10:29:15 +02:00
Laurent Monin
a45a4f0ee9 match -> matched 2023-06-04 10:26:52 +02:00
Laurent Monin
700cfb166e fix-header: improve aliases matching 2023-06-04 10:26:03 +02:00
Laurent Monin
9cddc64d71 fix-header: replace print() with logging.*() 2023-06-04 10:24:48 +02:00
Laurent Monin
3a845fc53f PICARD-2651: fix duplicate messages on console
Set logging.propagate to False for `main_logger`
2023-06-03 23:22:53 +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
428a45ef75 WSRequest: move properties initialization to class level if it makes sense 2023-06-03 19:26:32 +02:00
Laurent Monin
37ce367fce WSRequest: drop (now) useless _init_headers() method 2023-06-03 19:17:13 +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
eb5b11e227 Drop unused WSRequest.queryargs
Parent class methods and properties can achieve the same, so no point in keeping it
2023-06-03 14:35:28 +02:00
Laurent Monin
3286d5dd7b Drop WSRequest.qurl as we can use parent-class url() method 2023-06-03 14:32:08 +02:00
Laurent Monin
fa55b00380 Set WSRequest.qurl after parent class init and get it from url() 2023-06-03 14:23:14 +02:00