Compare commits
1014 commits
Author | SHA1 | Date | |
---|---|---|---|
|
88bb8ea789 | ||
|
6ae051157f | ||
|
c260d7b83f | ||
|
25904371de | ||
|
184d0328a9 | ||
|
aceaa69c9a | ||
|
de737fb4ee | ||
|
6f97f93dcc | ||
|
a23e1c5181 | ||
|
35b264bae4 | ||
|
353e32bd6b | ||
|
0fa96932a4 | ||
|
90c3614d6a | ||
|
fa68aa4ae8 | ||
|
8a26cf88d8 | ||
|
82cb504871 | ||
|
9d4283a924 | ||
|
e4d2ebc4a0 | ||
|
d5f1c3d3ac | ||
|
e737ae2f34 | ||
|
f4547a5821 | ||
|
a14a50a333 | ||
|
77d1b0009c | ||
|
d505d57fc4 | ||
|
3890cb4c04 | ||
|
5bccda1102 | ||
|
36d89a69e8 | ||
|
a28dea1158 | ||
|
6c888343c8 | ||
|
ffebde28e2 | ||
|
befb5aeceb | ||
|
370ff77f21 | ||
|
cdfc23b5e4 | ||
|
d5fe263c23 | ||
|
e90d717b66 | ||
|
b4c8dc7282 | ||
|
6f30559a3a | ||
|
a91bac007d | ||
|
c0f9f4222a | ||
|
47872dbb32 | ||
|
74392c4d71 | ||
|
97eab1719f | ||
|
e4b7af41f9 | ||
|
7f1c90cfea | ||
|
68c0197028 | ||
|
9e62e37b1e | ||
|
c26c5f86aa | ||
|
f7a73aa62f | ||
|
34e0e54fea | ||
|
02da99f4b0 | ||
|
5f302e0813 | ||
|
47eda3ea70 | ||
|
7da76f49bd | ||
|
1c669d8bb0 | ||
|
0f59831dc2 | ||
|
8d8263ce42 | ||
|
07ce433fc0 | ||
|
dc4bd8474c | ||
|
b05b8454f5 | ||
|
56fc297371 | ||
|
9f59dd770c | ||
|
f0ea480334 | ||
|
165e4761f4 | ||
|
cdb88b9bbb | ||
|
879591e1cc | ||
|
6a7a23cd9a | ||
|
793ae1453c | ||
|
111334328e | ||
|
15f0ccfd58 | ||
|
94432d62b0 | ||
|
dab0a5b661 | ||
|
7f07babdf4 | ||
|
f5ea06c6c9 | ||
|
4ea1df0930 | ||
|
e63ecc7bea | ||
|
28403386a8 | ||
|
8647cbdd48 | ||
|
a37ac22e6c | ||
|
7861fd55bd | ||
|
219be9f61a | ||
|
8169fad09d | ||
|
0152d98b28 | ||
|
d03e25fc6c | ||
|
ce76c03581 | ||
|
7f3518fc1a | ||
|
0560f711c3 | ||
|
41e0dd604e | ||
|
8ea5b42d92 | ||
|
dbbbcfec44 | ||
|
fc288040a8 | ||
|
98943d606e | ||
|
54a9f04f8f | ||
|
7f1de76f6e | ||
|
ece37c4659 | ||
|
8a967b52f4 | ||
|
d35eb5220f | ||
|
aeba21dedb | ||
|
af71e116e0 | ||
|
7df369dfff | ||
|
790351928f | ||
|
1e9d7d8c94 | ||
|
139e77707d | ||
|
8ed1ff2a3e | ||
|
3823d77a35 | ||
|
9f6fcf34fb | ||
|
75e2dd5f2e | ||
|
11f70bfee9 | ||
|
4fc4a6ad89 | ||
|
861182253c | ||
|
ea421db602 | ||
|
d3ba0be1a3 | ||
|
afbafe1e76 | ||
|
dec407d958 | ||
|
fa94ed0263 | ||
|
5b0c879fa0 | ||
|
aefa7cef1b | ||
|
caf0915062 | ||
|
2478980ca5 | ||
|
c1a8a9455f | ||
|
4f37ba41bd | ||
|
ac991cbd2c | ||
|
14e091c870 | ||
|
7b9c73acb7 | ||
|
54ea354a7a | ||
|
5ab3e53a44 | ||
|
eb4af40d64 | ||
|
6c3f3afb3a | ||
|
4e5fe31572 | ||
|
b0f2f5fe13 | ||
|
95c8b16564 | ||
|
549437b640 | ||
|
b373de6c68 | ||
|
5f8d150652 | ||
|
83aeaddc43 | ||
|
dd8836e59b | ||
|
5c9509dfc4 | ||
|
b726227d5d | ||
|
f28a74791d | ||
|
fe7484b3ca | ||
|
00f92eb436 | ||
|
f7090f26a0 | ||
|
4ae6c16f57 | ||
|
1a45c3b919 | ||
|
da2e7152ba | ||
|
a418f64b15 | ||
|
122c870312 | ||
|
44ade40579 | ||
|
26db2bc68b | ||
|
bb05699252 | ||
|
7f4bea6f07 | ||
|
d610721167 | ||
|
6465f4cf51 | ||
|
bafc3fe673 | ||
|
b151dd0c93 | ||
|
dd869b5183 | ||
|
3ffe7cf65a | ||
|
1841fb66dc | ||
|
d672e89f23 | ||
|
3b7cb9c8c7 | ||
|
e14f51a32a | ||
|
c63e0a75ef | ||
|
a204055798 | ||
|
9676714dcf | ||
|
2469a6ea47 | ||
|
d46aabc372 | ||
|
129e4392fc | ||
|
8b66e69004 | ||
|
2966ecfd13 | ||
|
4d4d167394 | ||
|
b48fbb4eb8 | ||
|
d3ee0e4942 | ||
|
25cf4165ea | ||
|
754d94374b | ||
|
b3fb55586c | ||
|
a0bdc3c5ac | ||
|
3a7c83998f | ||
|
ae7d4e3625 | ||
|
7b98775fa0 | ||
|
05b4ad8c62 | ||
|
c41f831d82 | ||
|
e5b9f2aa19 | ||
|
9072b98a18 | ||
|
3db88e98ce | ||
|
031b3ebbb1 | ||
|
aebbe53a61 | ||
|
73e3b1b9ed | ||
|
fd520ad47b | ||
|
a850f093f0 | ||
|
ddb1b1e501 | ||
|
72491f7a99 | ||
|
c8a64dbee9 | ||
|
20cd3ff475 | ||
|
e193106bde | ||
|
1a35601f51 | ||
|
ce2c1e6f76 | ||
|
a516a44c32 | ||
|
55107d12ba | ||
|
4e645ca134 | ||
|
aad860a222 | ||
|
6fa502ea17 | ||
|
585da81d56 | ||
|
5e1dc22fea | ||
|
e87da1efde | ||
|
20692d1c9e | ||
|
c6e983b579 | ||
|
ea1f2b42f8 | ||
|
10803a0a63 | ||
|
a41f2e0f36 | ||
|
26ffcf5ad6 | ||
|
b7700b58c7 | ||
|
d7ee88ebe2 | ||
|
2bf906af17 | ||
|
c0fb459458 | ||
|
6328b9e106 | ||
|
7a235fcc6e | ||
|
f3ee6a71a7 | ||
|
9241a02637 | ||
|
0c546976b9 | ||
|
6fe9aa632b | ||
|
36b2eeb297 | ||
|
e9bef6db68 | ||
|
eca1db8622 | ||
|
2d2e73c1bc | ||
|
123a00c5e3 | ||
|
3fcf45062d | ||
|
6c66279957 | ||
|
bf7cd60774 | ||
|
34690f68cc | ||
|
c851b82a1d | ||
|
b992d26138 | ||
|
421c80a617 | ||
|
10107a04e4 | ||
|
8be8c4efb6 | ||
|
0999501600 | ||
|
66b4cb7d10 | ||
|
7327b30337 | ||
|
23503a7212 | ||
|
a5034c43c0 | ||
|
08274028eb | ||
|
7193eb0d1f | ||
|
46a3dbf4a6 | ||
|
9033debfcd | ||
|
e4ca881c95 | ||
|
0ba17ecfff | ||
|
e98f493c39 | ||
|
c979b72cf3 | ||
|
5413d636ce | ||
|
815dc62dcd | ||
|
b7e2cce725 | ||
|
d7e1d70c34 | ||
|
69d5d6ec9a | ||
|
c218aab4dd | ||
|
b6eb1c8baf | ||
|
49e2831cf6 | ||
|
b5a9617cdf | ||
|
e888739b14 | ||
|
6da916e78d | ||
|
3a4ad741bd | ||
|
c0298212be | ||
|
85f58472a3 | ||
|
bf753884c4 | ||
|
91f79fd4b0 | ||
|
08ff008505 | ||
|
0f96fe58b1 | ||
|
2d570b97ff | ||
|
99e0cc734a | ||
|
f8a6c20ade | ||
|
3129d6052d | ||
|
77c17a9c36 | ||
|
48f4be0bcf | ||
|
66f5ace917 | ||
|
574476e44c | ||
|
136b7f1cef | ||
|
a769b611f0 | ||
|
0aa6de4769 | ||
|
041eeeba80 | ||
|
52abbba2bd | ||
|
15672922a7 | ||
|
99fb7cd7a5 | ||
|
11d955dd89 | ||
|
92004058ba | ||
|
c2da9a6365 | ||
|
705052ae66 | ||
|
7f59ced4dc | ||
|
43971c05fd | ||
|
7c42504d68 | ||
|
0300b52b4b | ||
|
1844c65f81 | ||
|
00f7014c51 | ||
|
6f2bdb5db8 | ||
|
32461c089d | ||
|
e7ad4ac5b2 | ||
|
e188e78bdd | ||
|
158273e0ae | ||
|
108e3dda44 | ||
|
6f62857164 | ||
|
d467e2ceb7 | ||
|
aae4bb3693 | ||
|
1160ee1513 | ||
|
8437316d3d | ||
|
7689a1e95a | ||
|
898a8b5756 | ||
|
925cae2031 | ||
|
26f2173160 | ||
|
a373654500 | ||
|
2aaa594388 | ||
|
6a28ba076f | ||
|
a040f42f95 | ||
|
b4092695a0 | ||
|
5391e0d233 | ||
|
fa0189d9bc | ||
|
dfb694f2a6 | ||
|
9622fca501 | ||
|
f806a1f36a | ||
|
0f80585d72 | ||
|
7005dbc13f | ||
|
c8e3162b9d | ||
|
a0255a61e1 | ||
|
d367d913c2 | ||
|
2e90f1e424 | ||
|
af036ec5d5 | ||
|
4e98e7af4c | ||
|
e22ad6b464 | ||
|
21f127f88b | ||
|
ac5fb41c68 | ||
|
cd18581fe2 | ||
|
27228e785f | ||
|
662e3bbddd | ||
|
ab4fa70fe9 | ||
|
f9ced38512 | ||
|
7f7d179793 | ||
|
ad2f9cbaa2 | ||
|
364f72f827 | ||
|
846ca20895 | ||
|
baf808a465 | ||
|
7d5947341b | ||
|
13bccb37b6 | ||
|
0fd17e6a6e | ||
|
7b5a365074 | ||
|
4329080457 | ||
|
ec43b92c27 | ||
|
3673c07994 | ||
|
6b04456c55 | ||
|
e8429b07bc | ||
|
d28c0ec167 | ||
|
44e47d84ce | ||
|
782040dc28 | ||
|
109315d93d | ||
|
7383fa20cf | ||
|
99c434c0ef | ||
|
3fd8280e33 | ||
|
d589c5ef8a | ||
|
695a11a4cd | ||
|
7915d7f3e6 | ||
|
fc51315f48 | ||
|
7694de346e | ||
|
46e4c0ec4c | ||
|
c7b927d94c | ||
|
44d0c2c966 | ||
|
dedcbf00f5 | ||
|
f439f205dc | ||
|
9ec4e99271 | ||
|
ce9ab4213e | ||
|
05a7fc07f1 | ||
|
a52f66d316 | ||
|
ab77165ecc | ||
|
b9ef29fa21 | ||
|
c3b36433b2 | ||
|
1a78c0b99d | ||
|
df6e31b4ff | ||
|
a5c53dbf54 | ||
|
694f67b25a | ||
|
c95e39b624 | ||
|
2284dcf580 | ||
|
da473448f4 | ||
|
dc464788f2 | ||
|
65e182c5dd | ||
|
9d125506e5 | ||
|
86c979204d | ||
|
9b2ada5dd0 | ||
|
f32848160c | ||
|
bfd3ffe06c | ||
|
e38d1c516b | ||
|
69b54e8c45 | ||
|
29f38f9531 | ||
|
5406261679 | ||
|
deb25fb030 | ||
|
6a1a5a450e | ||
|
b41c5bc85a | ||
|
d9c086f8cb | ||
|
0ad27dbc7e | ||
|
7f207c50da | ||
|
d7750d8131 | ||
|
4eec2e763d | ||
|
d4fe9e5b36 | ||
|
cfb8134872 | ||
|
850d746b60 | ||
|
45a1b7c7f1 | ||
|
b30fe33cc1 | ||
|
71e9871b1b | ||
|
1a31e4e0c3 | ||
|
d121f2c9cf | ||
|
fffc647811 | ||
|
0a38ac801d | ||
|
aa8adfee4b | ||
|
e77e0f9e35 | ||
|
6134945df7 | ||
|
9968d5f06e | ||
|
f67afa0d58 | ||
|
eb53483f6f | ||
|
c9fa096ef2 | ||
|
4626ff9670 | ||
|
718fba04b8 | ||
|
ee879aa042 | ||
|
742df8b674 | ||
|
53806b0a71 | ||
|
7707c3ced4 | ||
|
d63c0db472 | ||
|
07fac0628c | ||
|
5fded8398b | ||
|
51821e4a9a | ||
|
f9a130f1ba | ||
|
08294f0c52 | ||
|
48f1d72c45 | ||
|
eeb65d9724 | ||
|
d1d17314b2 | ||
|
21ccdeb9fb | ||
|
c269f3567c | ||
|
245dd47a41 | ||
|
bf68d17ca2 | ||
|
51190559d9 | ||
|
518890423a | ||
|
cd8d29ab91 | ||
|
be52e1793a | ||
|
c1e70f798c | ||
|
905d06ef5d | ||
|
0b725831d2 | ||
|
7665fd09d7 | ||
|
691e0a9ab1 | ||
|
1997154a81 | ||
|
907891bcb1 | ||
|
ca11de0a3a | ||
|
d16423c343 | ||
|
efd123004a | ||
|
c6b080d578 | ||
|
35b97356d1 | ||
|
5d085ba9dc | ||
|
4c89c7bf5a | ||
|
5c0785f7fe | ||
|
d65e2bdb3e | ||
|
018675aedd | ||
|
cfaef14a94 | ||
|
5a51d52e0a | ||
|
6503002692 | ||
|
9194232ecd | ||
|
ba946170da | ||
|
da9465c100 | ||
|
e5a5278d51 | ||
|
f3c9b4150d | ||
|
8bca1d2794 | ||
|
c8d349cfb6 | ||
|
000993c328 | ||
|
4aefda5d39 | ||
|
b3a4ac5388 | ||
|
30d512fd0e | ||
|
2194245e75 | ||
|
eae4b6261c | ||
|
fce5e5d830 | ||
|
61e95cc2a4 | ||
|
1d5e965183 | ||
|
7ac0cbb898 | ||
|
d35daaaeba | ||
|
e3537d5b86 | ||
|
fad76315bb | ||
|
8def14de48 | ||
|
f18fd3f758 | ||
|
70aad87a1b | ||
|
60dea38d10 | ||
|
fa601b8111 | ||
|
d1af8d3ebc | ||
|
942ced319a | ||
|
769d70c00b | ||
|
f923cd2c50 | ||
|
cef02d0700 | ||
|
c3476c1133 | ||
|
4083f72ef7 | ||
|
cf2d9113dd | ||
|
971e4e3571 | ||
|
c2dfe04e17 | ||
|
a144ce407d | ||
|
887a47c515 | ||
|
85efc31c10 | ||
|
c929b5bd8f | ||
|
1181dc4f35 | ||
|
4cf7e8c727 | ||
|
2e52023a22 | ||
|
a607dbe491 | ||
|
8b4866682d | ||
|
c5684bb87a | ||
|
72cdd8b979 | ||
|
dfb1ce2e2e | ||
|
892acd6df9 | ||
|
06f6cf627d | ||
|
68ebcf9487 | ||
|
8c5799a4d6 | ||
|
f2ec5bc57e | ||
|
20250237b9 | ||
|
ea87739458 | ||
|
0759bf5b0c | ||
|
aba895d56f | ||
|
8670a87255 | ||
|
77e06add28 | ||
|
0a152fa35d | ||
|
c882d8dea3 | ||
|
acdc23d7e7 | ||
|
b87fefe9ab | ||
|
36f7e9619b | ||
|
6fd84421bd | ||
|
9cb6f6e181 | ||
|
bb589a4d21 | ||
|
612eb75080 | ||
|
fa425188db | ||
|
adea26ec4c | ||
|
8e478e79ea | ||
|
41f8ae95d1 | ||
|
b02b830282 | ||
|
99ad248e6d | ||
|
e0f52ac27d | ||
|
4f4d204300 | ||
|
2703b6b385 | ||
|
d1ea097cd7 | ||
|
2389f745e1 | ||
|
423db55bd0 | ||
|
d24100f2db | ||
|
a1e10e75cd | ||
|
309b156fca | ||
|
22e03705c4 | ||
|
edeec178c5 | ||
|
348d2ce7ba | ||
|
969cbeb36c | ||
|
9abb5884b7 | ||
|
038ab141d3 | ||
|
139fdddb44 | ||
|
9da36d15d7 | ||
|
8bfb70bf28 | ||
|
d3f6e65fa5 | ||
|
a9dfcc8c34 | ||
|
7621673452 | ||
|
339b96faaa | ||
|
8f515d8779 | ||
|
36ed30cc2b | ||
|
128afc7862 | ||
|
d58a8ee61f | ||
|
18708393af | ||
|
35f67a09cb | ||
|
0d98c3590f | ||
|
41a3b96a0e | ||
|
825432b77f | ||
|
121e8a27c1 | ||
|
ae35af7e3b | ||
|
6d3ef3c7bf | ||
|
0d8812caca | ||
|
79fa0c6f9d | ||
|
ec647d181c | ||
|
dc5e0ce843 | ||
|
ad24b8910b | ||
|
b2f58fde63 | ||
|
c601d2f365 | ||
|
3a7cc9c410 | ||
|
cb1f760731 | ||
|
52636b6764 | ||
|
485d69184c | ||
|
68db2da2e9 | ||
|
3607deae80 | ||
|
b559495366 | ||
|
b55b40c3fe | ||
|
666181df50 | ||
|
00b6c0a619 | ||
|
c0a25fbabe | ||
|
60c3b671bf | ||
|
5ae5f995cd | ||
|
8f3628a638 | ||
|
85bf9f9928 | ||
|
f9a8bf3dae | ||
|
ebc5b29f5c | ||
|
5fd9e4c8c5 | ||
|
2ef88dfd4c | ||
|
f2b699a11f | ||
|
f70254b947 | ||
|
58b93c847e | ||
|
641615f44f | ||
|
5ba51c1e2c | ||
|
2edfc108d1 | ||
|
2aa4dbdf88 | ||
|
31aeb6e69a | ||
|
eac93bb84e | ||
|
25f419204a | ||
|
a8522fded3 | ||
|
0eac6e9ae2 | ||
|
ec68660014 | ||
|
27ba0dd6b3 | ||
|
230439f52f | ||
|
61216f73c0 | ||
|
454c519fd9 | ||
|
6d738d3f43 | ||
|
56e193d149 | ||
|
f419c39ef0 | ||
|
3e097b98fc | ||
|
c303fd0139 | ||
|
0d4f674ac7 | ||
|
d6281e3829 | ||
|
e19061a437 | ||
|
20d46a43b3 | ||
|
fe6673ba29 | ||
|
8c6c6aaab8 | ||
|
3be6a0504e | ||
|
fb1263a8dd | ||
|
ebd0bb90b4 | ||
|
5967590feb | ||
|
60a892cc03 | ||
|
13e965d3fd | ||
|
473721a67d | ||
|
df0bdf6ae2 | ||
|
32495cb15e | ||
|
0ce597b5b1 | ||
|
485596d004 | ||
|
68d9a4b783 | ||
|
338abc2883 | ||
|
83567cae64 | ||
|
4d92dcfc83 | ||
|
a565b7f159 | ||
|
5622611abb | ||
|
8baac12650 | ||
|
618833e297 | ||
|
ac6b67ff1e | ||
|
705eafbd3e | ||
|
8e99f2b04e | ||
|
508dc47bdb | ||
|
96d921cdc2 | ||
|
bdd1b8d5e5 | ||
|
802b388e79 | ||
|
f977ba3c01 | ||
|
5a55005240 | ||
|
855dbc623a | ||
|
2e82b0ea48 | ||
|
4a1b50350f | ||
|
41e0dfe0d5 | ||
|
3e5393cde7 | ||
|
3a403c943f | ||
|
47531969b6 | ||
|
93bb581842 | ||
|
b8306e0fd2 | ||
|
b169556e4a | ||
|
9b68fb6c68 | ||
|
30d4cf9111 | ||
|
d700b14f8c | ||
|
b852ec0a80 | ||
|
3c9b2dfa8e | ||
|
5f8be53750 | ||
|
7584679b72 | ||
|
2156466f70 | ||
|
76c9310341 | ||
|
b342bcc8c2 | ||
|
506a911c57 | ||
|
a9549030f4 | ||
|
210789a5fe | ||
|
3f8b03f48c | ||
|
3de3c55244 | ||
|
80f391761c | ||
|
eff3f882f6 | ||
|
b747916147 | ||
|
2a46500aab | ||
|
7fa1c20055 | ||
|
41db3f5a6e | ||
|
4c520eab4a | ||
|
733617adf6 | ||
|
a4ec4b5b82 | ||
|
7b3ab250df | ||
|
6a39962d51 | ||
|
a3cf6644fa | ||
|
5aa61367e0 | ||
|
b410ae8b8d | ||
|
852d575415 | ||
|
76d85f4c19 | ||
|
571edf23d9 | ||
|
ebee3f5568 | ||
|
cdd441dda1 | ||
|
99d567492f | ||
|
44c592df45 | ||
|
373109c0d7 | ||
|
04a3cf7b0a | ||
|
2905eaf8e2 | ||
|
3bf6570a83 | ||
|
3d9e863cd3 | ||
|
54c4f9c093 | ||
|
91bee5b016 | ||
|
b8de00a17b | ||
|
ebde12537d | ||
|
4732bf3750 | ||
|
ea33074941 | ||
|
4c8d2e2a9b | ||
|
8195725500 | ||
|
5eca8f556b | ||
|
a60793ef1f | ||
|
8202bbe76a | ||
|
97c1fcc5ec | ||
|
26f40953e8 | ||
|
36a884ede0 | ||
|
1732ca6686 | ||
|
59738685dc | ||
|
f17929e6cb | ||
|
950c2e78ca | ||
|
0d8763f2da | ||
|
cfa0e38ee7 | ||
|
9158273a21 | ||
|
3941b4b0fc | ||
|
4e6888cea8 | ||
|
5dcfdeb255 | ||
|
0938c596f8 | ||
|
d2f6a1205d | ||
|
236d035bb0 | ||
|
ba196dbb3b | ||
|
f75a29ef9f | ||
|
a098cafd48 | ||
|
42e881824b | ||
|
5bb98a3541 | ||
|
6ecba676bc | ||
|
307b904cad | ||
|
53be0e5f06 | ||
|
37fdc1fe80 | ||
|
6382853b45 | ||
|
63eb4de06b | ||
|
9924500108 | ||
|
f090876c0a | ||
|
cbf2066ee5 | ||
|
f9600268ea | ||
|
dc7528ab5c | ||
|
ac6806cb9f | ||
|
cd1266f807 | ||
|
ab968a3fe3 | ||
|
b96dcddb3d | ||
|
d1958ab8fd | ||
|
072f0aca1a | ||
|
94e8e6f7ad | ||
|
fc293da2ce | ||
|
fb10407a70 | ||
|
2faaf13bfa | ||
|
2fca8c66b2 | ||
|
12b4e04021 | ||
|
dae6a276ea | ||
|
fc206891af | ||
|
6264b4fecc | ||
|
c421fd5cbd | ||
|
3240a54e32 | ||
|
3e434f3714 | ||
|
2f72ec8270 | ||
|
2aaddbd81b | ||
|
5f18619333 | ||
|
6b58f43c01 | ||
|
db9bc4f216 | ||
|
71d59a17ca | ||
|
51b0f3b11a | ||
|
aa5f00bbd6 | ||
|
8b321dfe74 | ||
|
4379e28c19 | ||
|
658ed7a102 | ||
|
c8f8b60ec7 | ||
|
941dd0123b | ||
|
1a46ad2cb3 | ||
|
ebe102643a | ||
|
b47c5e587d | ||
|
fbc0914159 | ||
|
23223d1fe8 | ||
|
bf24aadfff | ||
|
767ff35ff9 | ||
|
67e0e80159 | ||
|
07eb05874b | ||
|
d3edfd99cc | ||
|
4437508e0f | ||
|
615bccb227 | ||
|
5dcf8a2f70 | ||
|
a0256faa4e | ||
|
e26b542bec | ||
|
88a74273a0 | ||
|
97ec6f84fc | ||
|
926c01a97e | ||
|
be8ae40caf | ||
|
8f124f97a8 | ||
|
4597514317 | ||
|
b36762b0f0 | ||
|
f13c94abe8 | ||
|
a6f209a3f9 | ||
|
404f48be1e | ||
|
5d94850eb6 | ||
|
16f12a02c9 | ||
|
0b691de789 | ||
|
4f2871f504 | ||
|
816be1cbe8 | ||
|
38d204ad90 | ||
|
a9340e73f0 | ||
|
ac4d17822a | ||
|
df36b178df | ||
|
a698c8a7e9 | ||
|
925ea840c4 | ||
|
959622fcf2 | ||
|
caa202ccb2 | ||
|
b24417ea56 | ||
|
159925ff08 | ||
|
de31fc33f6 | ||
|
3f9137a700 | ||
|
df75cf2aa2 | ||
|
1f9ebb530a | ||
|
da26531c87 | ||
|
882e749331 | ||
|
dd7fe504d3 | ||
|
781df0c94f | ||
|
f1e14f591c | ||
|
6d84446f03 | ||
|
f2f8ca086d | ||
|
6e6ff1a417 | ||
|
b66ee21ce0 | ||
|
a64d562ae2 | ||
|
ca66e74099 | ||
|
c2b03afe55 | ||
|
387220c1d6 | ||
|
123951517a | ||
|
9b9dc2e2c5 | ||
|
aa022c5a71 | ||
|
cf821de171 | ||
|
a0127432f8 | ||
|
79d741269a | ||
|
24f49074bf | ||
|
5a15b3b6a6 | ||
|
04d26a2c79 | ||
|
2e56084974 | ||
|
0a158e7238 | ||
|
0ae79be3a0 | ||
|
f74451a9af | ||
|
59769d31d6 | ||
|
098b747d8b | ||
|
32a6235f32 | ||
|
813a72b61a | ||
|
3941fd8ab5 | ||
|
8a53afd41b | ||
|
3e4127bf6a | ||
|
8670a2f2d1 | ||
|
bd9c351b21 | ||
|
ab63e85ad6 | ||
|
def9b2414a | ||
|
56d1f2791f | ||
|
2fea3a1b46 | ||
|
bc7433990b | ||
|
e117a2b57c | ||
|
ff69189a6d | ||
|
40c964a18c | ||
|
f2b0237d61 | ||
|
0058c8b832 | ||
|
862ae11cfa | ||
|
a2e9fad56c | ||
|
1e3551e611 | ||
|
f5c8ad3d7d | ||
|
b4ea08a378 | ||
|
28f6293739 | ||
|
23e4ae5c1a | ||
|
f3d31c9629 | ||
|
6a3ba02931 | ||
|
db3ed0fc3c | ||
|
1453e5137c | ||
|
d274ef6a3a | ||
|
9243e98b94 | ||
|
50f1a0ac8f | ||
|
5f69aa591c | ||
|
1c26ef6d24 | ||
|
3bf73a21ff | ||
|
b9d2ca8507 | ||
|
e4ccd8b767 | ||
|
adbe8a8500 | ||
|
e28e2ef0d0 | ||
|
536203fdb8 | ||
|
7fb56b1d28 | ||
|
7a3072b52c | ||
|
862f7fe45c | ||
|
7019b1b946 | ||
|
506bee4fe4 | ||
|
20b9bdedd2 | ||
|
181ad7b6c9 | ||
|
e09c480980 | ||
|
13f642f375 | ||
|
014b76d118 | ||
|
09685547f0 | ||
|
df6cad0298 | ||
|
d81145cb33 | ||
|
a209bce183 | ||
|
bd9f658de8 | ||
|
2254430b39 | ||
|
2235899c98 | ||
|
c3d99385ff | ||
|
4c4e3bfbba | ||
|
4c94c8e53f | ||
|
46b86b57da | ||
|
d5b536d51c | ||
|
5d62680753 | ||
|
d3dba1475a | ||
|
342bb94045 | ||
|
ac87cee29d | ||
|
7cb8a654ec | ||
|
0747d5d20e | ||
|
caea5e129a | ||
|
73cf5b3068 | ||
|
6301a5c670 | ||
|
1d532c0363 | ||
|
779af598db | ||
|
4698993421 | ||
|
f8f9226e94 | ||
|
2a48ccf369 | ||
|
3d169178ae | ||
|
e02893bbaa | ||
|
daa590b11d | ||
|
a97c584059 | ||
|
2938255e2f | ||
|
c587600e16 | ||
|
a254a9fd0c | ||
|
f7e5645ed6 | ||
|
748f66ecc3 | ||
|
9ca4109f22 | ||
|
2d11699df0 | ||
|
1d1eba5af7 | ||
|
1fc02a33c5 | ||
|
9edfcb5745 | ||
|
cd10d53a82 | ||
|
2d42d3b15d | ||
|
b947179972 | ||
|
c15923e4cd | ||
|
40ea12a22f | ||
|
a1867cc8d4 | ||
|
a38f3b485c | ||
|
896e248909 | ||
|
785139dce6 | ||
|
3a0e69f218 | ||
|
023828c07a | ||
|
954e32a819 | ||
|
c57afec43f | ||
|
2d861dcb10 | ||
|
c6c8d45635 | ||
|
6db87f8a27 | ||
|
b29b002b70 | ||
|
9d5d56ceaf | ||
|
d6ef6e1384 | ||
|
d0c80c8b4e | ||
|
3257a2b178 | ||
|
c3bf1f0a06 | ||
|
3fe197bbcc | ||
|
1b5a09b404 | ||
|
6fa52100c3 | ||
|
14293aacca | ||
|
06a05361a5 | ||
|
6caed64f75 | ||
|
6b47ae15b7 | ||
|
d125afd45f | ||
|
b83113bda5 | ||
|
e90f433e5e | ||
|
892ccd3585 | ||
|
7887242e84 | ||
|
f3c583359d | ||
|
fa994f862a | ||
|
baa4e782b6 | ||
|
897d0a132c | ||
|
6b91e6f8e5 | ||
|
f4e1cb7448 | ||
|
0246fa45d5 | ||
|
44318fccc4 | ||
|
e388db1e2f | ||
|
3e5e371b29 | ||
|
bdb429cc8a | ||
|
7eb640fa88 | ||
|
880e160f64 | ||
|
0d67c1e309 | ||
|
16079468ab | ||
|
f59d2cc680 | ||
|
0d483234d4 | ||
|
5324aacd83 | ||
|
50bb692383 | ||
|
4ae2e08539 | ||
|
e7153965f0 | ||
|
56f3666ced | ||
|
6d5c818ad0 | ||
|
ab2b605c8f | ||
|
552c45f18f | ||
|
1c1f56a62d | ||
|
4074c4fae9 | ||
|
b1b1186b06 | ||
|
fc28f21983 | ||
|
d0e4ac0e0f | ||
|
71bef027c4 | ||
|
16482faed1 | ||
|
b48f56badf | ||
|
eadce48315 | ||
|
d1c59f542d | ||
|
e9a25606a0 | ||
|
647cc9bc02 | ||
|
c8216a139e | ||
|
88f5b5e6b9 | ||
|
4621a1a6e4 | ||
|
bb33663472 | ||
|
e2cc69a7e8 | ||
|
78aac5c437 | ||
|
83ee68a400 | ||
|
7fadea93bd | ||
|
04cf7f7e25 | ||
|
0400a87b04 | ||
|
79a43919cc | ||
|
ad525bdd8b | ||
|
a6b1f50f2e | ||
|
240483d72f |
7
.codecov.yml
Normal file
7
.codecov.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Documentation: https://docs.codecov.io/docs/codecov-yaml
|
||||
|
||||
codecov:
|
||||
# Avoid "Missing base report"
|
||||
# https://github.com/codecov/support/issues/363
|
||||
# https://docs.codecov.io/v4.3.6/docs/comparing-commits
|
||||
allow_coverage_offsets: true
|
18
.editorconfig
Normal file
18
.editorconfig
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
# Four-space indentation
|
||||
[*.py]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Two-space indentation
|
||||
[*.yml]
|
||||
indent_size = 2
|
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
github: hugovk
|
22
.github/ISSUE_TEMPLATE.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
### What did you do?
|
||||
|
||||
### What did you expect to happen?
|
||||
|
||||
### What actually happened?
|
||||
|
||||
### What versions are you using?
|
||||
|
||||
* OS:
|
||||
* Python:
|
||||
* pylast:
|
||||
|
||||
Please include **code** that reproduces the issue.
|
||||
|
||||
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example)
|
||||
are
|
||||
[self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/)
|
||||
with minimal dependencies.
|
||||
|
||||
```python
|
||||
# code goes here
|
||||
```
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Fixes #
|
||||
|
||||
Changes proposed in this pull request:
|
||||
|
||||
*
|
||||
*
|
||||
*
|
111
.github/labels.yml
vendored
Normal file
111
.github/labels.yml
vendored
Normal file
|
@ -0,0 +1,111 @@
|
|||
# Default GitHub labels
|
||||
- color: d73a4a
|
||||
description: "Something isn't working"
|
||||
name: bug
|
||||
- color: cfd3d7
|
||||
description: "This issue or pull request already exists"
|
||||
name: duplicate
|
||||
- color: a2eeef
|
||||
description: "New feature or request"
|
||||
name: enhancement
|
||||
- color: 7057ff
|
||||
description: "Good for newcomers"
|
||||
name: good first issue
|
||||
- color: 008672
|
||||
description: "Extra attention is needed"
|
||||
name: help wanted
|
||||
- color: e4e669
|
||||
description: "This doesn't seem right"
|
||||
name: invalid
|
||||
- color: d876e3
|
||||
description: "Further information is requested"
|
||||
name: question
|
||||
- color: ffffff
|
||||
description: "This will not be worked on"
|
||||
name: wontfix
|
||||
|
||||
# Keep a Changelog labels
|
||||
# https://keepachangelog.com/en/1.0.0/
|
||||
- color: 0e8a16
|
||||
description: "For new features"
|
||||
name: "changelog: Added"
|
||||
- color: af99e5
|
||||
description: "For changes in existing functionality"
|
||||
name: "changelog: Changed"
|
||||
- color: FFA500
|
||||
description: "For soon-to-be removed features"
|
||||
name: "changelog: Deprecated"
|
||||
- color: 00A800
|
||||
description: "For any bug fixes"
|
||||
name: "changelog: Fixed"
|
||||
- color: ff0000
|
||||
description: "For now removed features"
|
||||
name: "changelog: Removed"
|
||||
- color: 045aa0
|
||||
description: "In case of vulnerabilities"
|
||||
name: "changelog: Security"
|
||||
- color: fbca04
|
||||
description: "Exclude PR from release draft"
|
||||
name: "changelog: skip"
|
||||
|
||||
# Other labels
|
||||
- color: e11d21
|
||||
description: ""
|
||||
name: Last.fm bug
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Milestone-0.3
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Performance
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Priority-High
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Priority-Low
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Priority-Medium
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Type-Other
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Type-Patch
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: Usability
|
||||
- color: 64c1c0
|
||||
description: ""
|
||||
name: backwards incompatible
|
||||
- color: fef2c0
|
||||
description: ""
|
||||
name: build
|
||||
- color: e99695
|
||||
description: Feature that will be removed in the future
|
||||
name: deprecation
|
||||
- color: FFFFFF
|
||||
description: ""
|
||||
name: imported
|
||||
- color: b60205
|
||||
description: Removal of a feature, usually done in major releases
|
||||
name: removal
|
||||
- color: 0366d6
|
||||
description: "For dependencies"
|
||||
name: dependencies
|
||||
- color: 0052cc
|
||||
description: "Documentation"
|
||||
name: docs
|
||||
- color: f4660e
|
||||
description: ""
|
||||
name: Hacktoberfest
|
||||
- color: f4660e
|
||||
description: "To credit accepted Hacktoberfest PRs"
|
||||
name: hacktoberfest-accepted
|
||||
- color: d65e88
|
||||
description: "Deploy and release"
|
||||
name: release
|
||||
- color: fef2c0
|
||||
description: "Unit tests, linting, CI, etc."
|
||||
name: test
|
48
.github/release-drafter.yml
vendored
Normal file
48
.github/release-drafter.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
name-template: "$RESOLVED_VERSION"
|
||||
tag-template: "$RESOLVED_VERSION"
|
||||
|
||||
categories:
|
||||
- title: "Added"
|
||||
labels:
|
||||
- "changelog: Added"
|
||||
- "enhancement"
|
||||
- title: "Changed"
|
||||
label: "changelog: Changed"
|
||||
- title: "Deprecated"
|
||||
label: "changelog: Deprecated"
|
||||
- title: "Removed"
|
||||
label: "changelog: Removed"
|
||||
- title: "Fixed"
|
||||
labels:
|
||||
- "changelog: Fixed"
|
||||
- "bug"
|
||||
- title: "Security"
|
||||
label: "changelog: Security"
|
||||
|
||||
exclude-labels:
|
||||
- "changelog: skip"
|
||||
|
||||
autolabeler:
|
||||
- label: "changelog: skip"
|
||||
branch:
|
||||
- "/pre-commit-ci-update-config/"
|
||||
|
||||
template: |
|
||||
$CHANGES
|
||||
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- "changelog: Removed"
|
||||
minor:
|
||||
labels:
|
||||
- "changelog: Added"
|
||||
- "changelog: Changed"
|
||||
- "changelog: Deprecated"
|
||||
- "enhancement"
|
||||
|
||||
patch:
|
||||
labels:
|
||||
- "changelog: Fixed"
|
||||
- "bug"
|
||||
default: minor
|
13
.github/renovate.json
vendored
Normal file
13
.github/renovate.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:base"],
|
||||
"labels": ["changelog: skip", "dependencies"],
|
||||
"packageRules": [
|
||||
{
|
||||
"groupName": "github-actions",
|
||||
"matchManagers": ["github-actions"],
|
||||
"separateMajorMinor": "false"
|
||||
}
|
||||
],
|
||||
"schedule": ["on the first day of the month"]
|
||||
}
|
75
.github/workflows/deploy.yml
vendored
Normal file
75
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Always build & lint package.
|
||||
build-package:
|
||||
name: Build & verify package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: hynek/build-and-inspect-python-package@v2
|
||||
|
||||
# Upload to Test PyPI on every commit on main.
|
||||
release-test-pypi:
|
||||
name: Publish in-dev package to test.pypi.org
|
||||
if: |
|
||||
github.repository_owner == 'pylast'
|
||||
&& github.event_name == 'push'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-package
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Download packages built by build-and-inspect-python-package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: Packages
|
||||
path: dist
|
||||
|
||||
- name: Upload package to Test PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
||||
# Upload to real PyPI on GitHub Releases.
|
||||
release-pypi:
|
||||
name: Publish released package to pypi.org
|
||||
if: |
|
||||
github.repository_owner == 'pylast'
|
||||
&& github.event.action == 'published'
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-package
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Download packages built by build-and-inspect-python-package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: Packages
|
||||
path: dist
|
||||
|
||||
- name: Upload package to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
23
.github/workflows/labels.yml
vendored
Normal file
23
.github/workflows/labels.yml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
name: Sync labels
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/labels.yml
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: micnncim/action-label-syncer@v1
|
||||
with:
|
||||
prune: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
22
.github/workflows/lint.yml
vendored
Normal file
22
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
name: Lint
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
PIP_DISABLE_PIP_VERSION_CHECK: 1
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
cache: pip
|
||||
- uses: pre-commit/action@v3.0.1
|
34
.github/workflows/release-drafter.yml
vendored
Normal file
34
.github/workflows/release-drafter.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
name: Release drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- main
|
||||
# pull_request event is required only for autolabeler
|
||||
pull_request:
|
||||
# Only following types are handled by the action, but one can default to all as well
|
||||
types: [opened, reopened, synchronize]
|
||||
# pull_request_target event is required for autolabeler to support PRs from forks
|
||||
# pull_request_target:
|
||||
# types: [opened, reopened, synchronize]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
if: github.repository_owner == 'pylast'
|
||||
permissions:
|
||||
# write permission is required to create a GitHub Release
|
||||
contents: write
|
||||
# write permission is required for autolabeler
|
||||
# otherwise, read permission is required at least
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Drafts your next release notes as pull requests are merged into "main"
|
||||
- uses: release-drafter/release-drafter@v6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
22
.github/workflows/require-pr-label.yml
vendored
Normal file
22
.github/workflows/require-pr-label.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
name: Require PR label
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, labeled, unlabeled, synchronize]
|
||||
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: mheap/github-action-required-labels@v5
|
||||
with:
|
||||
mode: minimum
|
||||
count: 1
|
||||
labels:
|
||||
"changelog: Added, changelog: Changed, changelog: Deprecated, changelog:
|
||||
Fixed, changelog: Removed, changelog: Security, changelog: skip"
|
54
.github/workflows/test.yml
vendored
Normal file
54
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
name: Test
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
allow-prereleases: true
|
||||
cache: pip
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -U pip
|
||||
python -m pip install -U wheel
|
||||
python -m pip install -U tox
|
||||
|
||||
- name: Tox tests
|
||||
run: |
|
||||
tox -e py
|
||||
env:
|
||||
PYLAST_API_KEY: ${{ secrets.PYLAST_API_KEY }}
|
||||
PYLAST_API_SECRET: ${{ secrets.PYLAST_API_SECRET }}
|
||||
PYLAST_PASSWORD_HASH: ${{ secrets.PYLAST_PASSWORD_HASH }}
|
||||
PYLAST_USERNAME: ${{ secrets.PYLAST_USERNAME }}
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v3.1.5
|
||||
with:
|
||||
flags: ${{ matrix.os }}
|
||||
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
|
||||
|
||||
success:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
name: Test successful
|
||||
steps:
|
||||
- name: Success
|
||||
run: echo Test successful
|
71
.gitignore
vendored
Normal file
71
.gitignore
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
# User Credentials
|
||||
test_pylast.yaml
|
||||
.envrc
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
.venv/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# JetBrains
|
||||
.idea/
|
||||
|
||||
# Clone Digger
|
||||
output.html
|
74
.pre-commit-config.yaml
Normal file
74
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,74 @@
|
|||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.5.0
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--exit-non-zero-on-fix]
|
||||
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 24.4.2
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
rev: 1.18.0
|
||||
hooks:
|
||||
- id: blacken-docs
|
||||
args: [--target-version=py38]
|
||||
additional_dependencies: [black]
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
- id: check-merge-conflict
|
||||
- id: check-json
|
||||
- id: check-toml
|
||||
- id: check-yaml
|
||||
- id: debug-statements
|
||||
- id: end-of-file-fixer
|
||||
- id: forbid-submodules
|
||||
- id: trailing-whitespace
|
||||
exclude: .github/(ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE).md
|
||||
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.28.6
|
||||
hooks:
|
||||
- id: check-github-workflows
|
||||
- id: check-renovate
|
||||
|
||||
- repo: https://github.com/rhysd/actionlint
|
||||
rev: v1.7.1
|
||||
hooks:
|
||||
- id: actionlint
|
||||
|
||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||
rev: 2.1.3
|
||||
hooks:
|
||||
- id: pyproject-fmt
|
||||
|
||||
- repo: https://github.com/abravalheri/validate-pyproject
|
||||
rev: v0.18
|
||||
hooks:
|
||||
- id: validate-pyproject
|
||||
|
||||
- repo: https://github.com/tox-dev/tox-ini-fmt
|
||||
rev: 1.3.1
|
||||
hooks:
|
||||
- id: tox-ini-fmt
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v4.0.0-alpha.8
|
||||
hooks:
|
||||
- id: prettier
|
||||
args: [--prose-wrap=always, --print-width=88]
|
||||
exclude: .github/(ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE).md
|
||||
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
- id: check-useless-excludes
|
||||
|
||||
ci:
|
||||
autoupdate_schedule: quarterly
|
159
CHANGELOG.md
Normal file
159
CHANGELOG.md
Normal file
|
@ -0,0 +1,159 @@
|
|||
# Changelog
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 4.2.1 and newer
|
||||
|
||||
See GitHub Releases:
|
||||
|
||||
- https://github.com/pylast/pylast/releases
|
||||
|
||||
## [4.2.0] - 2021-03-14
|
||||
|
||||
## Changed
|
||||
|
||||
- Fix unsafe creation of temp file for caching, and improve exception raising (#356)
|
||||
@kvanzuijlen
|
||||
- [pre-commit.ci] pre-commit autoupdate (#362) @pre-commit-ci
|
||||
|
||||
## [4.1.0] - 2021-01-04
|
||||
|
||||
## Added
|
||||
|
||||
- Add support for streaming (#336) @kvanzuijlen
|
||||
- Add Python 3.9 final to Travis CI (#350) @sheetalsingala
|
||||
|
||||
## Changed
|
||||
|
||||
- Update copyright year (#360) @hugovk
|
||||
- Replace Travis CI with GitHub Actions (#352) @hugovk
|
||||
- [pre-commit.ci] pre-commit autoupdate (#359) @pre-commit-ci
|
||||
|
||||
## Fixed
|
||||
|
||||
- Set limit to 50 by default, not 1 (#355) @hugovk
|
||||
|
||||
## [4.0.0] - 2020-10-07
|
||||
|
||||
## Added
|
||||
|
||||
- Add support for Python 3.9 (#347) @hugovk
|
||||
|
||||
## Removed
|
||||
|
||||
- Remove deprecated `Artist.get_cover_image`, `User.get_artist_tracks` and
|
||||
`STATUS_TOKEN_ERROR` (#348) @hugovk
|
||||
- Drop support for EOL Python 3.5 (#346) @hugovk
|
||||
|
||||
## [3.3.0] - 2020-06-25
|
||||
|
||||
### Added
|
||||
|
||||
- `User.get_now_playing`: Add album and cover image to info (#330) @hugovk
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve handling of error responses from the API (#327) @spiritualized
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Deprecate `Artist.get_cover_image`, they're no longer available from Last.fm (#332)
|
||||
@hugovk
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `artist.get_bio_content()` to return `None` if bio is empty (#326) @hugovk
|
||||
|
||||
## [3.2.1] - 2020-03-05
|
||||
|
||||
### Fixed
|
||||
|
||||
- Only Python 3 is supported: don't create universal wheel (#318) @hugovk
|
||||
- Fix regression calling `get_recent_tracks` with `limit=None` (#320) @hugovk
|
||||
- Fix `DeprecationWarning`: Please use `assertRegex` instead (#323) @hugovk
|
||||
|
||||
## [3.2.0] - 2020-01-03
|
||||
|
||||
### Added
|
||||
|
||||
- Support for Python 3.8
|
||||
- Store album art URLs when you call `GetTopAlbums` ([#307])
|
||||
- Retry paging through results on exception ([#297])
|
||||
- More error status codes from https://last.fm/api/errorcodes ([#297])
|
||||
|
||||
### Changed
|
||||
|
||||
- Respect `get_recent_tracks`' limit when there's a now playing track ([#310])
|
||||
- Move installable code to `src/` ([#301])
|
||||
- Update `get_weekly_artist_charts` docstring: only for `User` ([#311])
|
||||
- Remove Python 2 warnings, `python_requires` should be enough ([#312])
|
||||
- Use setuptools_scm to simplify versioning during release ([#316])
|
||||
- Various lint and test updates
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Last.fm's `user.getArtistTracks` has now been deprecated by Last.fm and is no longer
|
||||
available. Last.fm returns a "Deprecated - This type of request is no longer
|
||||
supported" error when calling it. A future version of pylast will remove its
|
||||
`User.get_artist_tracks` altogether. ([#305])
|
||||
|
||||
- `STATUS_TOKEN_ERROR` is deprecated and will be removed in a future version. Use
|
||||
`STATUS_OPERATION_FAILED` instead.
|
||||
|
||||
## [3.1.0] - 2019-03-07
|
||||
|
||||
### Added
|
||||
|
||||
- Extract username from session via new
|
||||
`SessionKeyGenerator.get_web_auth_session_key_username` ([#290])
|
||||
- `User.get_track_scrobbles` ([#298])
|
||||
|
||||
### Deprecated
|
||||
|
||||
- `User.get_artist_tracks`. Use `User.get_track_scrobbles` as a partial replacement.
|
||||
([#298])
|
||||
|
||||
## [3.0.0] - 2019-01-01
|
||||
|
||||
### Added
|
||||
|
||||
- This changelog file ([#273])
|
||||
|
||||
### Removed
|
||||
|
||||
- Support for Python 2.7 ([#265])
|
||||
|
||||
- Constants `COVER_SMALL`, `COVER_MEDIUM`, `COVER_LARGE`, `COVER_EXTRA_LARGE` and
|
||||
`COVER_MEGA`. Use `SIZE_SMALL` etc. instead. ([#282])
|
||||
|
||||
## [2.4.0] - 2018-08-08
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Support for Python 2.7 ([#265])
|
||||
|
||||
[4.2.0]: https://github.com/pylast/pylast/compare/4.1.0...4.2.0
|
||||
[4.1.0]: https://github.com/pylast/pylast/compare/4.0.0...4.1.0
|
||||
[4.0.0]: https://github.com/pylast/pylast/compare/3.3.0...4.0.0
|
||||
[3.3.0]: https://github.com/pylast/pylast/compare/3.2.1...3.3.0
|
||||
[3.2.1]: https://github.com/pylast/pylast/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/pylast/pylast/compare/3.1.0...3.2.0
|
||||
[3.1.0]: https://github.com/pylast/pylast/compare/3.0.0...3.1.0
|
||||
[3.0.0]: https://github.com/pylast/pylast/compare/2.4.0...3.0.0
|
||||
[2.4.0]: https://github.com/pylast/pylast/compare/2.3.0...2.4.0
|
||||
[#265]: https://github.com/pylast/pylast/issues/265
|
||||
[#273]: https://github.com/pylast/pylast/issues/273
|
||||
[#282]: https://github.com/pylast/pylast/pull/282
|
||||
[#290]: https://github.com/pylast/pylast/pull/290
|
||||
[#297]: https://github.com/pylast/pylast/issues/297
|
||||
[#298]: https://github.com/pylast/pylast/issues/298
|
||||
[#301]: https://github.com/pylast/pylast/issues/301
|
||||
[#305]: https://github.com/pylast/pylast/issues/305
|
||||
[#307]: https://github.com/pylast/pylast/issues/307
|
||||
[#310]: https://github.com/pylast/pylast/issues/310
|
||||
[#311]: https://github.com/pylast/pylast/issues/311
|
||||
[#312]: https://github.com/pylast/pylast/issues/312
|
||||
[#316]: https://github.com/pylast/pylast/issues/316
|
||||
[#346]: https://github.com/pylast/pylast/issues/346
|
||||
[#347]: https://github.com/pylast/pylast/issues/347
|
||||
[#348]: https://github.com/pylast/pylast/issues/348
|
2
COPYING
2
COPYING
|
@ -1,6 +1,6 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
https://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
|
|
4
INSTALL
4
INSTALL
|
@ -1,4 +0,0 @@
|
|||
Installation Instructions
|
||||
=========================
|
||||
|
||||
Execute "python setup.py install" as a super user.
|
201
LICENSE.txt
Normal file
201
LICENSE.txt
Normal file
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
https://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
7
README
7
README
|
@ -1,7 +0,0 @@
|
|||
pylast
|
||||
------
|
||||
|
||||
A python interface to Last.fm. Try using the pydoc utility for help
|
||||
on usage.
|
||||
For more info check out the project's home page at http://code.google.com/p/pylast/
|
||||
or the mailing list http://groups.google.com/group/pylast/
|
193
README.md
Normal file
193
README.md
Normal file
|
@ -0,0 +1,193 @@
|
|||
# pyLast
|
||||
|
||||
[](https://pypi.org/project/pylast/)
|
||||
[](https://pypi.org/project/pylast/)
|
||||
[](https://pypistats.org/packages/pylast)
|
||||
[](https://github.com/pylast/pylast/actions)
|
||||
[](https://codecov.io/gh/pylast/pylast)
|
||||
[](https://github.com/psf/black)
|
||||
[](https://zenodo.org/badge/latestdoi/7803088)
|
||||
|
||||
A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites
|
||||
such as [Libre.fm](https://libre.fm/).
|
||||
|
||||
Use the pydoc utility for help on usage or see [tests/](tests/) for examples.
|
||||
|
||||
## Installation
|
||||
|
||||
Install latest development version:
|
||||
|
||||
```sh
|
||||
python3 -m pip install -U git+https://git.hirad.it/Hirad/pylast
|
||||
```
|
||||
|
||||
Or from requirements.txt:
|
||||
|
||||
```txt
|
||||
-e https://git.hirad.it/Hirad/pylast#egg=pylast
|
||||
```
|
||||
|
||||
Note:
|
||||
|
||||
- pyLast 5.3+ supports Python 3.8-3.13.
|
||||
- pyLast 5.2+ supports Python 3.8-3.12.
|
||||
- pyLast 5.1 supports Python 3.7-3.11.
|
||||
- pyLast 5.0 supports Python 3.7-3.10.
|
||||
- pyLast 4.3 - 4.5 supports Python 3.6-3.10.
|
||||
- pyLast 4.0 - 4.2 supports Python 3.6-3.9.
|
||||
- pyLast 3.2 - 3.3 supports Python 3.5-3.8.
|
||||
- pyLast 3.0 - 3.1 supports Python 3.5-3.7.
|
||||
- pyLast 2.2 - 2.4 supports Python 2.7.10+, 3.4-3.7.
|
||||
- pyLast 2.0 - 2.1 supports Python 2.7.10+, 3.4-3.6.
|
||||
- pyLast 1.7 - 1.9 supports Python 2.7, 3.3-3.6.
|
||||
- pyLast 1.0 - 1.6 supports Python 2.7, 3.3-3.4.
|
||||
- pyLast 0.5 supports Python 2, 3.
|
||||
- pyLast < 0.5 supports Python 2.
|
||||
|
||||
## Features
|
||||
|
||||
- Simple public interface.
|
||||
- Access to all the data exposed by the Last.fm web services.
|
||||
- Scrobbling support.
|
||||
- Full object-oriented design.
|
||||
- Proxy support.
|
||||
- Internal caching support for some web services calls (disabled by default).
|
||||
- Support for other API-compatible networks like Libre.fm.
|
||||
|
||||
## Getting started
|
||||
|
||||
Here's some simple code example to get you started. In order to create any object from
|
||||
pyLast, you need a `Network` object which represents a social music network that is
|
||||
Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm
|
||||
and use it as follows:
|
||||
|
||||
```python
|
||||
import pylast
|
||||
|
||||
# You have to have your own unique two values for API_KEY and API_SECRET
|
||||
# Obtain yours from https://www.last.fm/api/account/create for Last.fm
|
||||
API_KEY = "b25b959554ed76058ac220b7b2e0a026" # this is a sample key
|
||||
API_SECRET = "425b55975eed76058ac220b7b4e8a054"
|
||||
|
||||
# In order to perform a write operation you need to authenticate yourself
|
||||
username = "your_user_name"
|
||||
password_hash = pylast.md5("your_password")
|
||||
|
||||
network = pylast.LastFMNetwork(
|
||||
api_key=API_KEY,
|
||||
api_secret=API_SECRET,
|
||||
username=username,
|
||||
password_hash=password_hash,
|
||||
)
|
||||
```
|
||||
|
||||
Alternatively, instead of creating `network` with a username and password, you can
|
||||
authenticate with a session key:
|
||||
|
||||
```python
|
||||
import pylast
|
||||
|
||||
SESSION_KEY_FILE = os.path.join(os.path.expanduser("~"), ".session_key")
|
||||
network = pylast.LastFMNetwork(API_KEY, API_SECRET)
|
||||
if not os.path.exists(SESSION_KEY_FILE):
|
||||
skg = pylast.SessionKeyGenerator(network)
|
||||
url = skg.get_web_auth_url()
|
||||
|
||||
print(f"Please authorize this script to access your account: {url}\n")
|
||||
import time
|
||||
import webbrowser
|
||||
|
||||
webbrowser.open(url)
|
||||
|
||||
while True:
|
||||
try:
|
||||
session_key = skg.get_web_auth_session_key(url)
|
||||
with open(SESSION_KEY_FILE, "w") as f:
|
||||
f.write(session_key)
|
||||
break
|
||||
except pylast.WSError:
|
||||
time.sleep(1)
|
||||
else:
|
||||
session_key = open(SESSION_KEY_FILE).read()
|
||||
|
||||
network.session_key = session_key
|
||||
```
|
||||
|
||||
And away we go:
|
||||
|
||||
```python
|
||||
# Now you can use that object everywhere
|
||||
track = network.get_track("Iron Maiden", "The Nomad")
|
||||
track.love()
|
||||
track.add_tags(("awesome", "favorite"))
|
||||
|
||||
# Type help(pylast.LastFMNetwork) or help(pylast) in a Python interpreter
|
||||
# to get more help about anything and see examples of how it works
|
||||
```
|
||||
|
||||
More examples in
|
||||
<a href="https://github.com/hugovk/lastfm-tools">hugovk/lastfm-tools</a> and
|
||||
[tests/](https://github.com/pylast/pylast/tree/main/tests).
|
||||
|
||||
## Testing
|
||||
|
||||
The [tests/](https://github.com/pylast/pylast/tree/main/tests) directory contains
|
||||
integration and unit tests with Last.fm, and plenty of code examples.
|
||||
|
||||
For integration tests you need a test account at Last.fm that will become cluttered with
|
||||
test data, and an API key and secret. Either copy
|
||||
[example_test_pylast.yaml](https://github.com/pylast/pylast/blob/main/example_test_pylast.yaml)
|
||||
to test_pylast.yaml and fill out the credentials, or set them as environment variables
|
||||
like:
|
||||
|
||||
```sh
|
||||
export PYLAST_USERNAME=TODO_ENTER_YOURS_HERE
|
||||
export PYLAST_PASSWORD_HASH=TODO_ENTER_YOURS_HERE
|
||||
export PYLAST_API_KEY=TODO_ENTER_YOURS_HERE
|
||||
export PYLAST_API_SECRET=TODO_ENTER_YOURS_HERE
|
||||
```
|
||||
|
||||
To run all unit and integration tests:
|
||||
|
||||
```sh
|
||||
python3 -m pip install -e ".[tests]"
|
||||
pytest
|
||||
```
|
||||
|
||||
Or run just one test case:
|
||||
|
||||
```sh
|
||||
pytest -k test_scrobble
|
||||
```
|
||||
|
||||
To run with coverage:
|
||||
|
||||
```sh
|
||||
pytest -v --cov pylast --cov-report term-missing
|
||||
coverage report # for command-line report
|
||||
coverage html # for HTML report
|
||||
open htmlcov/index.html
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
To enable from your own code:
|
||||
|
||||
```python
|
||||
import logging
|
||||
import pylast
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
network = pylast.LastFMNetwork(...)
|
||||
```
|
||||
|
||||
To enable from pytest:
|
||||
|
||||
```sh
|
||||
pytest --log-cli-level info -k test_album_search_images
|
||||
```
|
||||
|
||||
To also see data returned from the API, use `level=logging.DEBUG` or
|
||||
`--log-cli-level debug` instead.
|
23
RELEASING.md
Normal file
23
RELEASING.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Release Checklist
|
||||
|
||||
- [ ] Get `main` to the appropriate code release state.
|
||||
[GitHub Actions](https://github.com/pylast/pylast/actions) should be running
|
||||
cleanly for all merges to `main`.
|
||||
[](https://github.com/pylast/pylast/actions)
|
||||
|
||||
- [ ] Edit release draft, adjust text if needed:
|
||||
https://github.com/pylast/pylast/releases
|
||||
|
||||
- [ ] Check next tag is correct, amend if needed
|
||||
|
||||
- [ ] Publish release
|
||||
|
||||
- [ ] Check the tagged
|
||||
[GitHub Actions build](https://github.com/pylast/pylast/actions/workflows/deploy.yml)
|
||||
has deployed to [PyPI](https://pypi.org/project/pylast/#history)
|
||||
|
||||
- [ ] Check installation:
|
||||
|
||||
```bash
|
||||
pip3 uninstall -y pylast && pip3 install -U pylast && python3 -c "import pylast; print(pylast.__version__)"
|
||||
```
|
4
example_test_pylast.yaml
Normal file
4
example_test_pylast.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
username: TODO_ENTER_YOURS_HERE
|
||||
password_hash: TODO_ENTER_YOURS_HERE
|
||||
api_key: TODO_ENTER_YOURS_HERE
|
||||
api_secret: TODO_ENTER_YOURS_HERE
|
97
pyproject.toml
Normal file
97
pyproject.toml
Normal file
|
@ -0,0 +1,97 @@
|
|||
[build-system]
|
||||
build-backend = "hatchling.build"
|
||||
requires = [
|
||||
"hatch-vcs",
|
||||
"hatchling",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "pylast"
|
||||
description = "A Python interface to Last.fm and Libre.fm"
|
||||
readme = "README.md"
|
||||
keywords = [
|
||||
"Last.fm",
|
||||
"music",
|
||||
"scrobble",
|
||||
"scrobbling",
|
||||
]
|
||||
license = { text = "Apache-2.0" }
|
||||
maintainers = [
|
||||
{ name = "Hugo van Kemenade" },
|
||||
]
|
||||
authors = [
|
||||
{ name = "Amr Hassan <amr.hassan@gmail.com> and Contributors", email = "amr.hassan@gmail.com" },
|
||||
]
|
||||
requires-python = ">=3.8"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
"Topic :: Internet",
|
||||
"Topic :: Multimedia :: Sound/Audio",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
]
|
||||
dynamic = [
|
||||
"version",
|
||||
]
|
||||
dependencies = [
|
||||
"httpx",
|
||||
]
|
||||
optional-dependencies.tests = [
|
||||
"flaky",
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"pytest-random-order",
|
||||
"pyyaml",
|
||||
]
|
||||
urls.Changelog = "https://github.com/pylast/pylast/releases"
|
||||
urls.Homepage = "https://github.com/pylast/pylast"
|
||||
urls.Source = "https://github.com/pylast/pylast"
|
||||
|
||||
[tool.hatch]
|
||||
version.source = "vcs"
|
||||
|
||||
[tool.hatch.version.raw-options]
|
||||
local_scheme = "no-local-version"
|
||||
|
||||
[tool.ruff]
|
||||
fix = true
|
||||
|
||||
lint.select = [
|
||||
"C4", # flake8-comprehensions
|
||||
"E", # pycodestyle errors
|
||||
"EM", # flake8-errmsg
|
||||
"F", # pyflakes errors
|
||||
"I", # isort
|
||||
"ISC", # flake8-implicit-str-concat
|
||||
"LOG", # flake8-logging
|
||||
"PGH", # pygrep-hooks
|
||||
"RUF022", # unsorted-dunder-all
|
||||
"RUF100", # unused noqa (yesqa)
|
||||
"UP", # pyupgrade
|
||||
"W", # pycodestyle warnings
|
||||
"YTT", # flake8-2020
|
||||
]
|
||||
lint.extend-ignore = [
|
||||
"E203", # Whitespace before ':'
|
||||
"E221", # Multiple spaces before operator
|
||||
"E226", # Missing whitespace around arithmetic operator
|
||||
"E241", # Multiple spaces after ','
|
||||
]
|
||||
lint.isort.known-first-party = [
|
||||
"pylast",
|
||||
]
|
||||
lint.isort.required-imports = [
|
||||
"from __future__ import annotations",
|
||||
]
|
||||
|
||||
[tool.pyproject-fmt]
|
||||
max_supported_python = "3.13"
|
6
pytest.ini
Normal file
6
pytest.ini
Normal file
|
@ -0,0 +1,6 @@
|
|||
[pytest]
|
||||
filterwarnings =
|
||||
once::DeprecationWarning
|
||||
once::PendingDeprecationWarning
|
||||
|
||||
xfail_strict=true
|
32
setup.py
32
setup.py
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
import os
|
||||
def get_build():
|
||||
path = "./.build"
|
||||
|
||||
if os.path.exists(path):
|
||||
fp = open(path, "r")
|
||||
build = eval(fp.read())
|
||||
if os.path.exists("./.increase_build"):
|
||||
build += 1
|
||||
fp.close()
|
||||
else:
|
||||
build = 1
|
||||
|
||||
fp = open(path, "w")
|
||||
fp.write(str(build))
|
||||
fp.close()
|
||||
|
||||
return str(build)
|
||||
|
||||
setup(name = "pylast",
|
||||
version = "0.5." + get_build(),
|
||||
author = "Amr Hassan <amr.hassan@gmail.com>",
|
||||
description = "A Python interface to Last.fm (and other API compatible social networks)",
|
||||
author_email = "amr.hassan@gmail.com",
|
||||
url = "http://code.google.com/p/pylast/",
|
||||
py_modules = ("pylast",),
|
||||
license = "Apache2"
|
||||
)
|
2921
src/pylast/__init__.py
Normal file
2921
src/pylast/__init__.py
Normal file
File diff suppressed because it is too large
Load diff
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
120
tests/test_album.py
Executable file
120
tests/test_album.py
Executable file
|
@ -0,0 +1,120 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastAlbum(TestPyLastWithLastFm):
|
||||
def test_album_tags_are_topitems(self) -> None:
|
||||
# Arrange
|
||||
album = self.network.get_album("Test Artist", "Test Album")
|
||||
|
||||
# Act
|
||||
tags = album.get_top_tags(limit=1)
|
||||
|
||||
# Assert
|
||||
assert len(tags) > 0
|
||||
assert isinstance(tags[0], pylast.TopItem)
|
||||
|
||||
def test_album_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
album = self.network.get_album("Test Artist", "Test Album")
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(album)
|
||||
|
||||
def test_album_in_recent_tracks(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
# limit=2 to ignore now-playing:
|
||||
track = list(lastfm_user.get_recent_tracks(limit=2))[0]
|
||||
|
||||
# Assert
|
||||
assert hasattr(track, "album")
|
||||
|
||||
def test_album_wiki_content(self) -> None:
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act
|
||||
wiki = album.get_wiki_content()
|
||||
|
||||
# Assert
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_wiki_published_date(self) -> None:
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act
|
||||
wiki = album.get_wiki_published_date()
|
||||
|
||||
# Assert
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_wiki_summary(self) -> None:
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act
|
||||
wiki = album.get_wiki_summary()
|
||||
|
||||
# Assert
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_album_eq_none_is_false(self) -> None:
|
||||
# Arrange
|
||||
album1 = None
|
||||
album2 = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert album1 != album2
|
||||
|
||||
def test_album_ne_none_is_true(self) -> None:
|
||||
# Arrange
|
||||
album1 = None
|
||||
album2 = pylast.Album("Test Artist", "Test Album", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert album1 != album2
|
||||
|
||||
def test_get_cover_image(self) -> None:
|
||||
# Arrange
|
||||
album = self.network.get_album("Test Artist", "Test Album")
|
||||
|
||||
# Act
|
||||
image = album.get_cover_image()
|
||||
|
||||
# Assert
|
||||
assert image.startswith("https://")
|
||||
assert image.endswith(".gif") or image.endswith(".png")
|
||||
|
||||
def test_mbid(self) -> None:
|
||||
# Arrange
|
||||
album = self.network.get_album("Radiohead", "OK Computer")
|
||||
|
||||
# Act
|
||||
mbid = album.get_mbid()
|
||||
|
||||
# Assert
|
||||
assert mbid == "0b6b4ba0-d36f-47bd-b4ea-6a5b91842d29"
|
||||
|
||||
def test_no_mbid(self) -> None:
|
||||
# Arrange
|
||||
album = self.network.get_album("Test Artist", "Test Album")
|
||||
|
||||
# Act
|
||||
mbid = album.get_mbid()
|
||||
|
||||
# Assert
|
||||
assert mbid is None
|
278
tests/test_artist.py
Executable file
278
tests/test_artist.py
Executable file
|
@ -0,0 +1,278 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastArtist(TestPyLastWithLastFm):
|
||||
def test_repr(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act
|
||||
representation = repr(artist)
|
||||
|
||||
# Assert
|
||||
assert representation.startswith("pylast.Artist('Test Artist',")
|
||||
|
||||
def test_artist_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
test_artist = self.network.get_artist("Radiohead")
|
||||
artist = test_artist.get_similar(limit=2)[0].item
|
||||
assert isinstance(artist, pylast.Artist)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(artist)
|
||||
|
||||
def test_bio_published_date(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act
|
||||
bio = artist.get_bio_published_date()
|
||||
|
||||
# Assert
|
||||
assert bio is not None
|
||||
assert len(bio) >= 1
|
||||
|
||||
def test_bio_content(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act
|
||||
bio = artist.get_bio_content(language="en")
|
||||
|
||||
# Assert
|
||||
assert bio is not None
|
||||
assert len(bio) >= 1
|
||||
|
||||
def test_bio_content_none(self) -> None:
|
||||
# Arrange
|
||||
# An artist with no biography, with "<content/>" in the API XML
|
||||
artist = pylast.Artist("Mr Sizef + Unquote", self.network)
|
||||
|
||||
# Act
|
||||
bio = artist.get_bio_content()
|
||||
|
||||
# Assert
|
||||
assert bio is None
|
||||
|
||||
def test_bio_summary(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act
|
||||
bio = artist.get_bio_summary(language="en")
|
||||
|
||||
# Assert
|
||||
assert bio is not None
|
||||
assert len(bio) >= 1
|
||||
|
||||
def test_artist_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
# Pick an artist with plenty of plays
|
||||
artist = self.network.get_top_artists(limit=1)[0].item
|
||||
|
||||
# Act
|
||||
things = artist.get_top_tracks(limit=2)
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Track)
|
||||
|
||||
def test_artist_top_albums(self) -> None:
|
||||
# Arrange
|
||||
# Pick an artist with plenty of plays
|
||||
artist = self.network.get_top_artists(limit=1)[0].item
|
||||
|
||||
# Act
|
||||
things = list(artist.get_top_albums(limit=2))
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Album)
|
||||
|
||||
@pytest.mark.parametrize("test_limit", [1, 50, 100])
|
||||
def test_artist_top_albums_limit(self, test_limit: int) -> None:
|
||||
# Arrange
|
||||
# Pick an artist with plenty of plays
|
||||
artist = self.network.get_top_artists(limit=1)[0].item
|
||||
|
||||
# Act
|
||||
things = artist.get_top_albums(limit=test_limit)
|
||||
|
||||
# Assert
|
||||
assert len(things) == test_limit
|
||||
|
||||
def test_artist_top_albums_limit_default(self) -> None:
|
||||
# Arrange
|
||||
# Pick an artist with plenty of plays
|
||||
artist = self.network.get_top_artists(limit=1)[0].item
|
||||
|
||||
# Act
|
||||
things = artist.get_top_albums()
|
||||
|
||||
# Assert
|
||||
assert len(things) == 50
|
||||
|
||||
def test_artist_listener_count(self) -> None:
|
||||
# Arrange
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
|
||||
# Act
|
||||
count = artist.get_listener_count()
|
||||
|
||||
# Assert
|
||||
assert isinstance(count, int)
|
||||
assert count > 0
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_tag_artist(self) -> None:
|
||||
# Arrange
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
# artist.clear_tags()
|
||||
|
||||
# Act
|
||||
artist.add_tag("testing")
|
||||
|
||||
# Assert
|
||||
tags = artist.get_tags()
|
||||
assert len(tags) > 0
|
||||
found = any(tag.name == "testing" for tag in tags)
|
||||
assert found
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_remove_tag_of_type_text(self) -> None:
|
||||
# Arrange
|
||||
tag = "testing" # text
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
artist.add_tag(tag)
|
||||
|
||||
# Act
|
||||
artist.remove_tag(tag)
|
||||
|
||||
# Assert
|
||||
tags = artist.get_tags()
|
||||
found = any(tag.name == "testing" for tag in tags)
|
||||
assert not found
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_remove_tag_of_type_tag(self) -> None:
|
||||
# Arrange
|
||||
tag = pylast.Tag("testing", self.network) # Tag
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
artist.add_tag(tag)
|
||||
|
||||
# Act
|
||||
artist.remove_tag(tag)
|
||||
|
||||
# Assert
|
||||
tags = artist.get_tags()
|
||||
found = any(tag.name == "testing" for tag in tags)
|
||||
assert not found
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_remove_tags(self) -> None:
|
||||
# Arrange
|
||||
tags = ["removetag1", "removetag2"]
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
artist.add_tags(tags)
|
||||
artist.add_tags("1more")
|
||||
tags_before = artist.get_tags()
|
||||
|
||||
# Act
|
||||
artist.remove_tags(tags)
|
||||
|
||||
# Assert
|
||||
tags_after = artist.get_tags()
|
||||
assert len(tags_after) == len(tags_before) - 2
|
||||
found1 = any(tag.name == "removetag1" for tag in tags_after)
|
||||
found2 = any(tag.name == "removetag2" for tag in tags_after)
|
||||
assert not found1
|
||||
assert not found2
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_set_tags(self) -> None:
|
||||
# Arrange
|
||||
tags = ["sometag1", "sometag2"]
|
||||
artist = self.network.get_artist("Test Artist 2")
|
||||
artist.add_tags(tags)
|
||||
tags_before = artist.get_tags()
|
||||
new_tags = ["settag1", "settag2"]
|
||||
|
||||
# Act
|
||||
artist.set_tags(new_tags)
|
||||
|
||||
# Assert
|
||||
tags_after = artist.get_tags()
|
||||
assert tags_before != tags_after
|
||||
assert len(tags_after) == 2
|
||||
found1, found2 = False, False
|
||||
for tag in tags_after:
|
||||
if tag.name == "settag1":
|
||||
found1 = True
|
||||
elif tag.name == "settag2":
|
||||
found2 = True
|
||||
assert found1
|
||||
assert found2
|
||||
|
||||
def test_artists(self) -> None:
|
||||
# Arrange
|
||||
artist1 = self.network.get_artist("Radiohead")
|
||||
artist2 = self.network.get_artist("Portishead")
|
||||
|
||||
# Act
|
||||
url = artist1.get_url()
|
||||
mbid = artist1.get_mbid()
|
||||
|
||||
playcount = artist1.get_playcount()
|
||||
name = artist1.get_name(properly_capitalized=False)
|
||||
name_cap = artist1.get_name(properly_capitalized=True)
|
||||
|
||||
# Assert
|
||||
assert playcount > 1
|
||||
assert artist1 != artist2
|
||||
assert name.lower() == name_cap.lower()
|
||||
assert url == "https://www.last.fm/music/radiohead"
|
||||
assert mbid == "a74b1b7f-71a5-4011-9441-d0b5e4122711"
|
||||
|
||||
def test_artist_eq_none_is_false(self) -> None:
|
||||
# Arrange
|
||||
artist1 = None
|
||||
artist2 = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert artist1 != artist2
|
||||
|
||||
def test_artist_ne_none_is_true(self) -> None:
|
||||
# Arrange
|
||||
artist1 = None
|
||||
artist2 = pylast.Artist("Test Artist", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert artist1 != artist2
|
||||
|
||||
def test_artist_get_correction(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("guns and roses", self.network)
|
||||
|
||||
# Act
|
||||
corrected_artist_name = artist.get_correction()
|
||||
|
||||
# Assert
|
||||
assert corrected_artist_name == "Guns N' Roses"
|
||||
|
||||
def test_get_userplaycount(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("John Lennon", self.network, username=self.username)
|
||||
|
||||
# Act
|
||||
playcount = artist.get_userplaycount()
|
||||
|
||||
# Assert
|
||||
assert playcount >= 0
|
36
tests/test_country.py
Executable file
36
tests/test_country.py
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastCountry(TestPyLastWithLastFm):
|
||||
def test_country_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
country = self.network.get_country("Italy")
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(country)
|
||||
|
||||
def test_countries(self) -> None:
|
||||
# Arrange
|
||||
country1 = pylast.Country("Italy", self.network)
|
||||
country2 = pylast.Country("Finland", self.network)
|
||||
|
||||
# Act
|
||||
text = str(country1)
|
||||
rep = repr(country1)
|
||||
url = country1.get_url()
|
||||
|
||||
# Assert
|
||||
assert "Italy" in rep
|
||||
assert "pylast.Country" in rep
|
||||
assert text == "Italy"
|
||||
assert country1 == country1
|
||||
assert country1 != country2
|
||||
assert url == "https://www.last.fm/place/italy"
|
56
tests/test_library.py
Executable file
56
tests/test_library.py
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastLibrary(TestPyLastWithLastFm):
|
||||
def test_repr(self) -> None:
|
||||
# Arrange
|
||||
library = pylast.Library(user=self.username, network=self.network)
|
||||
|
||||
# Act
|
||||
representation = repr(library)
|
||||
|
||||
# Assert
|
||||
assert representation.startswith("pylast.Library(")
|
||||
|
||||
def test_str(self) -> None:
|
||||
# Arrange
|
||||
library = pylast.Library(user=self.username, network=self.network)
|
||||
|
||||
# Act
|
||||
string = str(library)
|
||||
|
||||
# Assert
|
||||
assert string.endswith("'s Library")
|
||||
|
||||
def test_library_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
library = pylast.Library(user=self.username, network=self.network)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(library)
|
||||
|
||||
def test_cacheable_library(self) -> None:
|
||||
# Arrange
|
||||
library = pylast.Library(self.username, self.network)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_validate_cacheable(library, "get_artists")
|
||||
|
||||
def test_get_user(self) -> None:
|
||||
# Arrange
|
||||
library = pylast.Library(user=self.username, network=self.network)
|
||||
user_to_get = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
library_user = library.get_user()
|
||||
|
||||
# Assert
|
||||
assert library_user == user_to_get
|
43
tests/test_librefm.py
Executable file
43
tests/test_librefm.py
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from flaky import flaky
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import load_secrets
|
||||
|
||||
|
||||
@flaky(max_runs=3, min_passes=1)
|
||||
class TestPyLastWithLibreFm:
|
||||
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
|
||||
|
||||
def test_libre_fm(self) -> None:
|
||||
# Arrange
|
||||
secrets = load_secrets()
|
||||
username = secrets["username"]
|
||||
password_hash = secrets["password_hash"]
|
||||
|
||||
# Act
|
||||
network = pylast.LibreFMNetwork(password_hash=password_hash, username=username)
|
||||
artist = network.get_artist("Radiohead")
|
||||
name = artist.get_name()
|
||||
|
||||
# Assert
|
||||
assert name == "Radiohead"
|
||||
|
||||
def test_repr(self) -> None:
|
||||
# Arrange
|
||||
secrets = load_secrets()
|
||||
username = secrets["username"]
|
||||
password_hash = secrets["password_hash"]
|
||||
network = pylast.LibreFMNetwork(password_hash=password_hash, username=username)
|
||||
|
||||
# Act
|
||||
representation = repr(network)
|
||||
|
||||
# Assert
|
||||
assert representation.startswith("pylast.LibreFMNetwork(")
|
420
tests/test_network.py
Executable file
420
tests/test_network.py
Executable file
|
@ -0,0 +1,420 @@
|
|||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastNetwork(TestPyLastWithLastFm):
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_scrobble(self) -> None:
|
||||
# Arrange
|
||||
artist = "test artist"
|
||||
title = "test title"
|
||||
timestamp = self.unix_timestamp()
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
self.network.scrobble(artist=artist, title="test title 2", timestamp=timestamp)
|
||||
self.network.scrobble(artist=artist, title=title, timestamp=timestamp)
|
||||
|
||||
# Assert
|
||||
# limit=2 to ignore now-playing:
|
||||
last_scrobble = list(lastfm_user.get_recent_tracks(limit=2))[0]
|
||||
assert str(last_scrobble.track.artist).lower() == artist
|
||||
assert str(last_scrobble.track.title).lower() == title
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_update_now_playing(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
album = "Test Album"
|
||||
track_number = 1
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
self.network.update_now_playing(
|
||||
artist=artist, title=title, album=album, track_number=track_number
|
||||
)
|
||||
|
||||
# Assert
|
||||
current_track = lastfm_user.get_now_playing()
|
||||
assert current_track is not None
|
||||
assert str(current_track.title).lower() == "test title"
|
||||
assert str(current_track.artist).lower() == "test artist"
|
||||
assert current_track.info["album"] == "Test Album"
|
||||
assert current_track.get_album().title == "Test Album"
|
||||
|
||||
assert len(current_track.info["image"])
|
||||
assert re.search(r"^http.+$", current_track.info["image"][pylast.SIZE_LARGE])
|
||||
|
||||
def test_enable_rate_limiting(self) -> None:
|
||||
# Arrange
|
||||
assert not self.network.is_rate_limited()
|
||||
|
||||
# Act
|
||||
self.network.enable_rate_limit()
|
||||
then = time.time()
|
||||
# Make some network call, limit not applied first time
|
||||
self.network.get_top_artists()
|
||||
# Make a second network call, limiting should be applied
|
||||
self.network.get_top_artists()
|
||||
now = time.time()
|
||||
|
||||
# Assert
|
||||
assert self.network.is_rate_limited()
|
||||
assert now - then >= 0.2
|
||||
|
||||
def test_disable_rate_limiting(self) -> None:
|
||||
# Arrange
|
||||
self.network.enable_rate_limit()
|
||||
assert self.network.is_rate_limited()
|
||||
|
||||
# Act
|
||||
self.network.disable_rate_limit()
|
||||
# Make some network call, limit not applied first time
|
||||
self.network.get_user(self.username)
|
||||
# Make a second network call, limiting should be applied
|
||||
self.network.get_top_artists()
|
||||
|
||||
# Assert
|
||||
assert not self.network.is_rate_limited()
|
||||
|
||||
def test_lastfm_network_name(self) -> None:
|
||||
# Act
|
||||
name = str(self.network)
|
||||
|
||||
# Assert
|
||||
assert name == "Last.fm Network"
|
||||
|
||||
def test_geo_get_top_artists(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
artists = self.network.get_geo_top_artists(country="United Kingdom", limit=1)
|
||||
|
||||
# Assert
|
||||
assert len(artists) == 1
|
||||
assert isinstance(artists[0], pylast.TopItem)
|
||||
assert isinstance(artists[0].item, pylast.Artist)
|
||||
|
||||
def test_geo_get_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
tracks = self.network.get_geo_top_tracks(
|
||||
country="United Kingdom", location="Manchester", limit=1
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert len(tracks) == 1
|
||||
assert isinstance(tracks[0], pylast.TopItem)
|
||||
assert isinstance(tracks[0].item, pylast.Track)
|
||||
|
||||
def test_network_get_top_artists_with_limit(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
artists = self.network.get_top_artists(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(artists, pylast.Artist)
|
||||
|
||||
def test_network_get_top_tags_with_limit(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
tags = self.network.get_top_tags(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(tags, pylast.Tag)
|
||||
|
||||
def test_network_get_top_tags_with_no_limit(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
tags = self.network.get_top_tags()
|
||||
|
||||
# Assert
|
||||
self.helper_at_least_one_thing_in_top_list(tags, pylast.Tag)
|
||||
|
||||
def test_network_get_top_tracks_with_limit(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
tracks = self.network.get_top_tracks(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(tracks, pylast.Track)
|
||||
|
||||
def test_country_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
country = self.network.get_country("Croatia")
|
||||
|
||||
# Act
|
||||
things = country.get_top_tracks(limit=2)
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Track)
|
||||
|
||||
def test_country_network_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
# Act
|
||||
things = self.network.get_geo_top_tracks("Croatia", limit=2)
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Track)
|
||||
|
||||
def test_tag_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
tag = self.network.get_tag("blues")
|
||||
|
||||
# Act
|
||||
things = tag.get_top_tracks(limit=2)
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Track)
|
||||
|
||||
def test_album_data(self) -> None:
|
||||
# Arrange
|
||||
thing = self.network.get_album("Test Artist", "Test Album")
|
||||
|
||||
# Act
|
||||
stringed = str(thing)
|
||||
rep = thing.__repr__()
|
||||
title = thing.get_title()
|
||||
name = thing.get_name()
|
||||
playcount = thing.get_playcount()
|
||||
url = thing.get_url()
|
||||
|
||||
# Assert
|
||||
assert stringed == "Test Artist - Test Album"
|
||||
assert "pylast.Album('Test Artist', 'Test Album'," in rep
|
||||
assert title == name
|
||||
assert isinstance(playcount, int)
|
||||
assert playcount > 1
|
||||
assert "https://www.last.fm/music/test%2bartist/test%2balbum" == url
|
||||
|
||||
def test_track_data(self) -> None:
|
||||
# Arrange
|
||||
thing = self.network.get_track("Test Artist", "test title")
|
||||
|
||||
# Act
|
||||
stringed = str(thing)
|
||||
rep = thing.__repr__()
|
||||
title = thing.get_title()
|
||||
name = thing.get_name()
|
||||
playcount = thing.get_playcount()
|
||||
url = thing.get_url(pylast.DOMAIN_FRENCH)
|
||||
|
||||
# Assert
|
||||
assert stringed == "Test Artist - test title"
|
||||
assert "pylast.Track('Test Artist', 'test title'," in rep
|
||||
assert title == "test title"
|
||||
assert title == name
|
||||
assert isinstance(playcount, int)
|
||||
assert playcount > 1
|
||||
assert "https://www.last.fm/fr/music/test%2bartist/_/test%2btitle" == url
|
||||
|
||||
def test_country_top_artists(self) -> None:
|
||||
# Arrange
|
||||
country = self.network.get_country("Ukraine")
|
||||
|
||||
# Act
|
||||
artists = country.get_top_artists(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(artists, pylast.Artist)
|
||||
|
||||
def test_caching(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
self.network.enable_caching()
|
||||
tags1 = user.get_top_tags(limit=1, cacheable=True)
|
||||
tags2 = user.get_top_tags(limit=1, cacheable=True)
|
||||
|
||||
# Assert
|
||||
assert self.network.is_caching_enabled()
|
||||
assert tags1 == tags2
|
||||
self.network.disable_caching()
|
||||
assert not self.network.is_caching_enabled()
|
||||
|
||||
def test_album_mbid(self) -> None:
|
||||
# Arrange
|
||||
mbid = "03c91c40-49a6-44a7-90e7-a700edf97a62"
|
||||
|
||||
# Act
|
||||
album = self.network.get_album_by_mbid(mbid)
|
||||
album_mbid = album.get_mbid()
|
||||
|
||||
# Assert
|
||||
assert isinstance(album, pylast.Album)
|
||||
assert album.title == "Believe"
|
||||
assert album_mbid == mbid
|
||||
|
||||
def test_artist_mbid(self) -> None:
|
||||
# Arrange
|
||||
mbid = "7e84f845-ac16-41fe-9ff8-df12eb32af55"
|
||||
|
||||
# Act
|
||||
artist = self.network.get_artist_by_mbid(mbid)
|
||||
|
||||
# Assert
|
||||
assert isinstance(artist, pylast.Artist)
|
||||
assert artist.name in ("MusicBrainz Test Artist", "MusicBrainzz Test Artist")
|
||||
|
||||
def test_track_mbid(self) -> None:
|
||||
# Arrange
|
||||
mbid = "ebc037b1-cc9c-44f2-a21f-83c219f0e1e0"
|
||||
|
||||
# Act
|
||||
track = self.network.get_track_by_mbid(mbid)
|
||||
track_mbid = track.get_mbid()
|
||||
|
||||
# Assert
|
||||
assert isinstance(track, pylast.Track)
|
||||
assert track.title == "first"
|
||||
assert track_mbid == mbid
|
||||
|
||||
def test_init_with_token(self) -> None:
|
||||
# Arrange/Act
|
||||
msg = None
|
||||
try:
|
||||
pylast.LastFMNetwork(
|
||||
api_key=self.__class__.secrets["api_key"],
|
||||
api_secret=self.__class__.secrets["api_secret"],
|
||||
token="invalid",
|
||||
)
|
||||
except pylast.WSError as exc:
|
||||
msg = str(exc)
|
||||
|
||||
# Assert
|
||||
assert msg == "Unauthorized Token - This token has not been issued"
|
||||
|
||||
def test_proxy(self) -> None:
|
||||
# Arrange
|
||||
proxy = "http://example.com:1234"
|
||||
|
||||
# Act / Assert
|
||||
self.network.enable_proxy(proxy)
|
||||
assert self.network.is_proxy_enabled()
|
||||
assert self.network.proxy == "http://example.com:1234"
|
||||
|
||||
self.network.disable_proxy()
|
||||
assert not self.network.is_proxy_enabled()
|
||||
|
||||
def test_album_search(self) -> None:
|
||||
# Arrange
|
||||
album = "Nevermind"
|
||||
|
||||
# Act
|
||||
search = self.network.search_for_album(album)
|
||||
results = search.get_next_page()
|
||||
|
||||
# Assert
|
||||
assert isinstance(results, list)
|
||||
assert isinstance(results[0], pylast.Album)
|
||||
|
||||
def test_album_search_images(self) -> None:
|
||||
# Arrange
|
||||
album = "Nevermind"
|
||||
search = self.network.search_for_album(album)
|
||||
|
||||
# Act
|
||||
results = search.get_next_page()
|
||||
images = results[0].info["image"]
|
||||
|
||||
# Assert
|
||||
assert len(images) == 4
|
||||
|
||||
assert images[pylast.SIZE_SMALL].startswith("https://")
|
||||
assert images[pylast.SIZE_SMALL].endswith(".png")
|
||||
assert "/34s/" in images[pylast.SIZE_SMALL]
|
||||
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].startswith("https://")
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].endswith(".png")
|
||||
assert "/300x300/" in images[pylast.SIZE_EXTRA_LARGE]
|
||||
|
||||
def test_artist_search(self) -> None:
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
|
||||
# Act
|
||||
search = self.network.search_for_artist(artist)
|
||||
results = search.get_next_page()
|
||||
|
||||
# Assert
|
||||
assert isinstance(results, list)
|
||||
assert isinstance(results[0], pylast.Artist)
|
||||
|
||||
def test_artist_search_images(self) -> None:
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
search = self.network.search_for_artist(artist)
|
||||
|
||||
# Act
|
||||
results = search.get_next_page()
|
||||
images = results[0].info["image"]
|
||||
|
||||
# Assert
|
||||
assert len(images) == 5
|
||||
|
||||
assert images[pylast.SIZE_SMALL].startswith("https://")
|
||||
assert images[pylast.SIZE_SMALL].endswith(".png")
|
||||
assert "/34s/" in images[pylast.SIZE_SMALL]
|
||||
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].startswith("https://")
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].endswith(".png")
|
||||
assert "/300x300/" in images[pylast.SIZE_EXTRA_LARGE]
|
||||
|
||||
def test_track_search(self) -> None:
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
track = "Smells Like Teen Spirit"
|
||||
|
||||
# Act
|
||||
search = self.network.search_for_track(artist, track)
|
||||
results = search.get_next_page()
|
||||
|
||||
# Assert
|
||||
assert isinstance(results, list)
|
||||
assert isinstance(results[0], pylast.Track)
|
||||
|
||||
def test_track_search_images(self) -> None:
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
track = "Smells Like Teen Spirit"
|
||||
search = self.network.search_for_track(artist, track)
|
||||
|
||||
# Act
|
||||
results = search.get_next_page()
|
||||
images = results[0].info["image"]
|
||||
|
||||
# Assert
|
||||
assert len(images) == 4
|
||||
|
||||
assert images[pylast.SIZE_SMALL].startswith("https://")
|
||||
assert images[pylast.SIZE_SMALL].endswith(".png")
|
||||
assert "/34s/" in images[pylast.SIZE_SMALL]
|
||||
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].startswith("https://")
|
||||
assert images[pylast.SIZE_EXTRA_LARGE].endswith(".png")
|
||||
assert "/300x300/" in images[pylast.SIZE_EXTRA_LARGE]
|
||||
|
||||
def test_search_get_total_result_count(self) -> None:
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
track = "Smells Like Teen Spirit"
|
||||
search = self.network.search_for_track(artist, track)
|
||||
|
||||
# Act
|
||||
total = search.get_total_result_count()
|
||||
|
||||
# Assert
|
||||
assert int(total) > 10000
|
138
tests/test_pylast.py
Executable file
138
tests/test_pylast.py
Executable file
|
@ -0,0 +1,138 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from flaky import flaky
|
||||
|
||||
import pylast
|
||||
|
||||
WRITE_TEST = False
|
||||
|
||||
|
||||
def load_secrets(): # pragma: no cover
|
||||
secrets_file = "test_pylast.yaml"
|
||||
if os.path.isfile(secrets_file):
|
||||
import yaml # pip install pyyaml
|
||||
|
||||
with open(secrets_file) as f: # see example_test_pylast.yaml
|
||||
doc = yaml.load(f)
|
||||
else:
|
||||
doc = {}
|
||||
try:
|
||||
doc["username"] = os.environ["PYLAST_USERNAME"].strip()
|
||||
doc["password_hash"] = os.environ["PYLAST_PASSWORD_HASH"].strip()
|
||||
doc["api_key"] = os.environ["PYLAST_API_KEY"].strip()
|
||||
doc["api_secret"] = os.environ["PYLAST_API_SECRET"].strip()
|
||||
except KeyError:
|
||||
pytest.skip("Missing environment variables: PYLAST_USERNAME etc.")
|
||||
return doc
|
||||
|
||||
|
||||
def _no_xfail_rerun_filter(err, name, test, plugin) -> bool:
|
||||
for _ in test.iter_markers(name="xfail"):
|
||||
return False
|
||||
|
||||
|
||||
@flaky(max_runs=3, min_passes=1, rerun_filter=_no_xfail_rerun_filter)
|
||||
class TestPyLastWithLastFm:
|
||||
secrets = None
|
||||
|
||||
@staticmethod
|
||||
def unix_timestamp() -> int:
|
||||
return int(time.time())
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls) -> None:
|
||||
if cls.secrets is None:
|
||||
cls.secrets = load_secrets()
|
||||
|
||||
cls.username = cls.secrets["username"]
|
||||
password_hash = cls.secrets["password_hash"]
|
||||
|
||||
api_key = cls.secrets["api_key"]
|
||||
api_secret = cls.secrets["api_secret"]
|
||||
|
||||
cls.network = pylast.LastFMNetwork(
|
||||
api_key=api_key,
|
||||
api_secret=api_secret,
|
||||
username=cls.username,
|
||||
password_hash=password_hash,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def helper_is_thing_hashable(thing) -> None:
|
||||
# Arrange
|
||||
things = set()
|
||||
|
||||
# Act
|
||||
things.add(thing)
|
||||
|
||||
# Assert
|
||||
assert thing is not None
|
||||
assert len(things) == 1
|
||||
|
||||
@staticmethod
|
||||
def helper_validate_results(a, b, c) -> None:
|
||||
# Assert
|
||||
assert a is not None
|
||||
assert b is not None
|
||||
assert c is not None
|
||||
assert isinstance(len(a), int)
|
||||
assert isinstance(len(b), int)
|
||||
assert isinstance(len(c), int)
|
||||
assert a == b
|
||||
assert b == c
|
||||
|
||||
def helper_validate_cacheable(self, thing, function_name) -> None:
|
||||
# Arrange
|
||||
# get thing.function_name()
|
||||
func = getattr(thing, function_name, None)
|
||||
|
||||
# Act
|
||||
result1 = func(limit=1, cacheable=False)
|
||||
result2 = func(limit=1, cacheable=True)
|
||||
result3 = list(func(limit=1))
|
||||
|
||||
# Assert
|
||||
self.helper_validate_results(result1, result2, result3)
|
||||
|
||||
@staticmethod
|
||||
def helper_at_least_one_thing_in_top_list(things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) > 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], pylast.TopItem)
|
||||
assert isinstance(things[0].item, expected_type)
|
||||
|
||||
@staticmethod
|
||||
def helper_only_one_thing_in_top_list(things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], pylast.TopItem)
|
||||
assert isinstance(things[0].item, expected_type)
|
||||
|
||||
@staticmethod
|
||||
def helper_only_one_thing_in_list(things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], expected_type)
|
||||
|
||||
@staticmethod
|
||||
def helper_two_different_things_in_top_list(things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 2
|
||||
thing1 = things[0]
|
||||
thing2 = things[1]
|
||||
assert isinstance(thing1, pylast.TopItem)
|
||||
assert isinstance(thing2, pylast.TopItem)
|
||||
assert isinstance(thing1.item, expected_type)
|
||||
assert isinstance(thing2.item, expected_type)
|
||||
assert thing1 != thing2
|
58
tests/test_tag.py
Executable file
58
tests/test_tag.py
Executable file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastTag(TestPyLastWithLastFm):
|
||||
def test_tag_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
tag = self.network.get_top_tags(limit=1)[0]
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(tag)
|
||||
|
||||
def test_tag_top_artists(self) -> None:
|
||||
# Arrange
|
||||
tag = self.network.get_tag("blues")
|
||||
|
||||
# Act
|
||||
artists = tag.get_top_artists(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(artists, pylast.Artist)
|
||||
|
||||
def test_tag_top_albums(self) -> None:
|
||||
# Arrange
|
||||
tag = self.network.get_tag("blues")
|
||||
|
||||
# Act
|
||||
albums = tag.get_top_albums(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(albums, pylast.Album)
|
||||
|
||||
def test_tags(self) -> None:
|
||||
# Arrange
|
||||
tag1 = self.network.get_tag("blues")
|
||||
tag2 = self.network.get_tag("rock")
|
||||
|
||||
# Act
|
||||
tag_repr = repr(tag1)
|
||||
tag_str = str(tag1)
|
||||
name = tag1.get_name(properly_capitalized=True)
|
||||
url = tag1.get_url()
|
||||
|
||||
# Assert
|
||||
assert "blues" == tag_str
|
||||
assert "pylast.Tag" in tag_repr
|
||||
assert "blues" in tag_repr
|
||||
assert "blues" == name
|
||||
assert tag1 == tag1
|
||||
assert tag1 != tag2
|
||||
assert url == "https://www.last.fm/tag/blues"
|
231
tests/test_track.py
Executable file
231
tests/test_track.py
Executable file
|
@ -0,0 +1,231 @@
|
|||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastTrack(TestPyLastWithLastFm):
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_love(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
track = self.network.get_track(artist, title)
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
track.love()
|
||||
|
||||
# Assert
|
||||
loved = list(lastfm_user.get_loved_tracks(limit=1))
|
||||
assert str(loved[0].track.artist).lower() == "test artist"
|
||||
assert str(loved[0].track.title).lower() == "test title"
|
||||
|
||||
@pytest.mark.skipif(not WRITE_TEST, reason="Only test once to avoid collisions")
|
||||
def test_unlove(self) -> None:
|
||||
# Arrange
|
||||
artist = pylast.Artist("Test Artist", self.network)
|
||||
title = "test title"
|
||||
track = pylast.Track(artist, title, self.network)
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
track.love()
|
||||
|
||||
# Act
|
||||
track.unlove()
|
||||
time.sleep(1) # Delay, for Last.fm latency. TODO Can this be removed later?
|
||||
|
||||
# Assert
|
||||
loved = list(lastfm_user.get_loved_tracks(limit=1))
|
||||
if len(loved): # OK to be empty but if not:
|
||||
assert str(loved[0].track.artist) != "Test Artist"
|
||||
assert str(loved[0].track.title) != "test title"
|
||||
|
||||
def test_user_play_count_in_track_info(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
track = pylast.Track(
|
||||
artist=artist, title=title, network=self.network, username=self.username
|
||||
)
|
||||
|
||||
# Act
|
||||
count = track.get_userplaycount()
|
||||
|
||||
# Assert
|
||||
assert count >= 0
|
||||
|
||||
def test_user_loved_in_track_info(self) -> None:
|
||||
# Arrange
|
||||
artist = "Test Artist"
|
||||
title = "test title"
|
||||
track = pylast.Track(
|
||||
artist=artist, title=title, network=self.network, username=self.username
|
||||
)
|
||||
|
||||
# Act
|
||||
loved = track.get_userloved()
|
||||
|
||||
# Assert
|
||||
assert loved is not None
|
||||
assert isinstance(loved, bool)
|
||||
assert not isinstance(loved, str)
|
||||
|
||||
def test_track_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
track = artist.get_top_tracks(stream=False)[0].item
|
||||
assert isinstance(track, pylast.Track)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(track)
|
||||
|
||||
def test_track_wiki_content(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
# Act
|
||||
wiki = track.get_wiki_content()
|
||||
|
||||
# Assert
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_track_wiki_summary(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
# Act
|
||||
wiki = track.get_wiki_summary()
|
||||
|
||||
# Assert
|
||||
assert wiki is not None
|
||||
assert len(wiki) >= 1
|
||||
|
||||
def test_track_get_duration(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Daft Punk", "Something About Us", self.network)
|
||||
|
||||
# Act
|
||||
duration = track.get_duration()
|
||||
|
||||
# Assert
|
||||
assert duration >= 100000
|
||||
|
||||
def test_track_get_album(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Nirvana", "Lithium", self.network)
|
||||
|
||||
# Act
|
||||
album = track.get_album()
|
||||
|
||||
# Assert
|
||||
assert str(album) == "Nirvana - Nevermind"
|
||||
|
||||
def test_track_get_similar(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Cher", "Believe", self.network)
|
||||
|
||||
# Act
|
||||
similar = track.get_similar()
|
||||
|
||||
# Assert
|
||||
found = any(str(track.item) == "Cher - Strong Enough" for track in similar)
|
||||
assert found
|
||||
|
||||
def test_track_get_similar_limits(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Cher", "Believe", self.network)
|
||||
|
||||
# Act/Assert
|
||||
assert len(track.get_similar(limit=20)) == 20
|
||||
assert len(track.get_similar(limit=10)) <= 10
|
||||
assert len(track.get_similar(limit=None)) >= 23
|
||||
assert len(track.get_similar(limit=0)) >= 23
|
||||
|
||||
def test_tracks_notequal(self) -> None:
|
||||
# Arrange
|
||||
track1 = pylast.Track("Test Artist", "test title", self.network)
|
||||
track2 = pylast.Track("Test Artist", "Test Track", self.network)
|
||||
|
||||
# Act
|
||||
# Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_title_prop_caps(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("test artist", "test title", self.network)
|
||||
|
||||
# Act
|
||||
title = track.get_title(properly_capitalized=True)
|
||||
|
||||
# Assert
|
||||
assert title == "Test Title"
|
||||
|
||||
def test_track_listener_count(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("test artist", "test title", self.network)
|
||||
|
||||
# Act
|
||||
count = track.get_listener_count()
|
||||
|
||||
# Assert
|
||||
assert count > 21
|
||||
|
||||
def test_album_tracks(self) -> None:
|
||||
# Arrange
|
||||
album = pylast.Album("Test Artist", "Test", self.network)
|
||||
|
||||
# Act
|
||||
tracks = album.get_tracks()
|
||||
url = tracks[0].get_url()
|
||||
|
||||
# Assert
|
||||
assert isinstance(tracks, list)
|
||||
assert isinstance(tracks[0], pylast.Track)
|
||||
assert len(tracks) == 1
|
||||
assert url.startswith("https://www.last.fm/music/test")
|
||||
|
||||
def test_track_eq_none_is_false(self) -> None:
|
||||
# Arrange
|
||||
track1 = None
|
||||
track2 = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_ne_none_is_true(self) -> None:
|
||||
# Arrange
|
||||
track1 = None
|
||||
track2 = pylast.Track("Test Artist", "test title", self.network)
|
||||
|
||||
# Act / Assert
|
||||
assert track1 != track2
|
||||
|
||||
def test_track_get_correction(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Guns N' Roses", "mrbrownstone", self.network)
|
||||
|
||||
# Act
|
||||
corrected_track_name = track.get_correction()
|
||||
|
||||
# Assert
|
||||
assert corrected_track_name == "Mr. Brownstone"
|
||||
|
||||
def test_track_with_no_mbid(self) -> None:
|
||||
# Arrange
|
||||
track = pylast.Track("Static-X", "Set It Off", self.network)
|
||||
|
||||
# Act
|
||||
mbid = track.get_mbid()
|
||||
|
||||
# Assert
|
||||
assert mbid is None
|
496
tests/test_user.py
Executable file
496
tests/test_user.py
Executable file
|
@ -0,0 +1,496 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import calendar
|
||||
import datetime as dt
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
class TestPyLastUser(TestPyLastWithLastFm):
|
||||
def test_repr(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
representation = repr(user)
|
||||
|
||||
# Assert
|
||||
assert representation.startswith("pylast.User('RJ',")
|
||||
|
||||
def test_str(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
string = str(user)
|
||||
|
||||
# Assert
|
||||
assert string == "RJ"
|
||||
|
||||
def test_equality(self) -> None:
|
||||
# Arrange
|
||||
user_1a = self.network.get_user("RJ")
|
||||
user_1b = self.network.get_user("RJ")
|
||||
user_2 = self.network.get_user("Test User")
|
||||
not_a_user = self.network
|
||||
|
||||
# Act / Assert
|
||||
assert user_1a == user_1b
|
||||
assert user_1a != user_2
|
||||
assert user_1a != not_a_user
|
||||
|
||||
def test_get_name(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
name = user.get_name(properly_capitalized=True)
|
||||
|
||||
# Assert
|
||||
assert name == "RJ"
|
||||
|
||||
def test_get_user_registration(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
registered = user.get_registered()
|
||||
|
||||
# Assert
|
||||
if int(registered):
|
||||
# Last.fm API broken? Used to be yyyy-mm-dd not Unix timestamp
|
||||
assert registered == "1037793040"
|
||||
else: # pragma: no cover
|
||||
# Old way
|
||||
# Just check date because of timezones
|
||||
assert "2002-11-20 " in registered
|
||||
|
||||
def test_get_user_unixtime_registration(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
unixtime_registered = user.get_unixtime_registered()
|
||||
|
||||
# Assert
|
||||
# Just check date because of timezones
|
||||
assert unixtime_registered == 1037793040
|
||||
|
||||
def test_get_countryless_user(self) -> None:
|
||||
# Arrange
|
||||
# Currently test_user has no country set:
|
||||
lastfm_user = self.network.get_user("test_user")
|
||||
|
||||
# Act
|
||||
country = lastfm_user.get_country()
|
||||
|
||||
# Assert
|
||||
assert country is None
|
||||
|
||||
def test_user_get_country(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
country = lastfm_user.get_country()
|
||||
|
||||
# Assert
|
||||
assert str(country) == "United Kingdom"
|
||||
|
||||
def test_user_equals_none(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
value = lastfm_user is None
|
||||
|
||||
# Assert
|
||||
assert not value
|
||||
|
||||
def test_user_not_equal_to_none(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
value = lastfm_user is not None
|
||||
|
||||
# Assert
|
||||
assert value
|
||||
|
||||
def test_now_playing_user_with_no_scrobbles(self) -> None:
|
||||
# Arrange
|
||||
# Currently test-account has no scrobbles:
|
||||
user = self.network.get_user("test-account")
|
||||
|
||||
# Act
|
||||
current_track = user.get_now_playing()
|
||||
|
||||
# Assert
|
||||
assert current_track is None
|
||||
|
||||
def test_love_limits(self) -> None:
|
||||
# Arrange
|
||||
# Currently test-account has at least 23 loved tracks:
|
||||
user = self.network.get_user("test-user")
|
||||
|
||||
# Act/Assert
|
||||
assert len(user.get_loved_tracks(limit=20)) == 20
|
||||
assert len(user.get_loved_tracks(limit=100)) <= 100
|
||||
assert len(user.get_loved_tracks(limit=None)) >= 23
|
||||
assert len(user.get_loved_tracks(limit=0)) >= 23
|
||||
|
||||
def test_user_is_hashable(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user(self.username)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_is_thing_hashable(user)
|
||||
|
||||
# Commented out because (a) it'll take a long time and (b) it strangely
|
||||
# fails due Last.fm's complaining of hitting the rate limit, even when
|
||||
# limited to one call per second. The ToS allows 5 calls per second.
|
||||
# def test_get_all_scrobbles(self):
|
||||
# # Arrange
|
||||
# lastfm_user = self.network.get_user("RJ")
|
||||
# self.network.enable_rate_limit() # this is going to be slow...
|
||||
#
|
||||
# # Act
|
||||
# tracks = lastfm_user.get_recent_tracks(limit=None)
|
||||
#
|
||||
# # Assert
|
||||
# self.assertGreaterEqual(len(tracks), 0)
|
||||
|
||||
def test_pickle(self) -> None:
|
||||
# Arrange
|
||||
import pickle
|
||||
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
filename = str(self.unix_timestamp()) + ".pkl"
|
||||
|
||||
# Act
|
||||
with open(filename, "wb") as f:
|
||||
pickle.dump(lastfm_user, f)
|
||||
with open(filename, "rb") as f:
|
||||
loaded_user = pickle.load(f)
|
||||
os.remove(filename)
|
||||
|
||||
# Assert
|
||||
assert lastfm_user == loaded_user
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_cacheable_user(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_authenticated_user()
|
||||
|
||||
# Act/Assert
|
||||
self.helper_validate_cacheable(lastfm_user, "get_friends")
|
||||
# no cover whilst xfail:
|
||||
self.helper_validate_cacheable( # pragma: no cover
|
||||
lastfm_user, "get_loved_tracks"
|
||||
)
|
||||
self.helper_validate_cacheable( # pragma: no cover
|
||||
lastfm_user, "get_recent_tracks"
|
||||
)
|
||||
|
||||
def test_user_get_top_tags_with_limit(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
tags = user.get_top_tags(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(tags, pylast.Tag)
|
||||
|
||||
def test_user_top_tracks(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
things = lastfm_user.get_top_tracks(limit=2)
|
||||
|
||||
# Assert
|
||||
self.helper_two_different_things_in_top_list(things, pylast.Track)
|
||||
|
||||
def helper_assert_chart(self, chart, expected_type) -> None:
|
||||
# Assert
|
||||
assert chart is not None
|
||||
assert len(chart) > 0
|
||||
assert isinstance(chart[0], pylast.TopItem)
|
||||
assert isinstance(chart[0].item, expected_type)
|
||||
|
||||
def helper_get_assert_charts(self, thing, date) -> None:
|
||||
# Arrange
|
||||
album_chart, track_chart = None, None
|
||||
(from_date, to_date) = date
|
||||
|
||||
# Act
|
||||
artist_chart = thing.get_weekly_artist_charts(from_date, to_date)
|
||||
if type(thing) is not pylast.Tag:
|
||||
album_chart = thing.get_weekly_album_charts(from_date, to_date)
|
||||
track_chart = thing.get_weekly_track_charts(from_date, to_date)
|
||||
|
||||
# Assert
|
||||
self.helper_assert_chart(artist_chart, pylast.Artist)
|
||||
if type(thing) is not pylast.Tag:
|
||||
self.helper_assert_chart(album_chart, pylast.Album)
|
||||
self.helper_assert_chart(track_chart, pylast.Track)
|
||||
|
||||
def helper_dates_valid(self, dates) -> None:
|
||||
# Assert
|
||||
assert len(dates) >= 1
|
||||
assert isinstance(dates[0], tuple)
|
||||
(start, end) = dates[0]
|
||||
assert start < end
|
||||
|
||||
def test_user_charts(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("RJ")
|
||||
dates = lastfm_user.get_weekly_chart_dates()
|
||||
self.helper_dates_valid(dates)
|
||||
|
||||
# Act/Assert
|
||||
self.helper_get_assert_charts(lastfm_user, dates[0])
|
||||
|
||||
def test_user_top_artists(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
artists = lastfm_user.get_top_artists(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(artists, pylast.Artist)
|
||||
|
||||
def test_user_top_albums(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
albums = user.get_top_albums(limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_top_list(albums, pylast.Album)
|
||||
|
||||
top_album = albums[0].item
|
||||
assert len(top_album.info["image"])
|
||||
assert re.search(r"^http.+$", top_album.info["image"][pylast.SIZE_LARGE])
|
||||
|
||||
def test_user_tagged_artists(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
tags = ["artisttagola"]
|
||||
artist = self.network.get_artist("Test Artist")
|
||||
artist.add_tags(tags)
|
||||
|
||||
# Act
|
||||
artists = lastfm_user.get_tagged_artists("artisttagola", limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_list(artists, pylast.Artist)
|
||||
|
||||
def test_user_tagged_albums(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
tags = ["albumtagola"]
|
||||
album = self.network.get_album("Test Artist", "Test Album")
|
||||
album.add_tags(tags)
|
||||
|
||||
# Act
|
||||
albums = lastfm_user.get_tagged_albums("albumtagola", limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_list(albums, pylast.Album)
|
||||
|
||||
def test_user_tagged_tracks(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user(self.username)
|
||||
tags = ["tracktagola"]
|
||||
track = self.network.get_track("Test Artist", "test title")
|
||||
track.add_tags(tags)
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_tagged_tracks("tracktagola", limit=1)
|
||||
|
||||
# Assert
|
||||
self.helper_only_one_thing_in_list(tracks, pylast.Track)
|
||||
|
||||
def test_user_subscriber(self) -> None:
|
||||
# Arrange
|
||||
subscriber = self.network.get_user("RJ")
|
||||
non_subscriber = self.network.get_user("Test User")
|
||||
|
||||
# Act
|
||||
subscriber_is_subscriber = subscriber.is_subscriber()
|
||||
non_subscriber_is_subscriber = non_subscriber.is_subscriber()
|
||||
|
||||
# Assert
|
||||
assert subscriber_is_subscriber
|
||||
assert not non_subscriber_is_subscriber
|
||||
|
||||
def test_user_get_image(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
url = user.get_image()
|
||||
|
||||
# Assert
|
||||
assert url.startswith("https://")
|
||||
|
||||
def test_user_get_library(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user(self.username)
|
||||
|
||||
# Act
|
||||
library = user.get_library()
|
||||
|
||||
# Assert
|
||||
assert isinstance(library, pylast.Library)
|
||||
|
||||
def test_get_recent_tracks_from_to(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("RJ")
|
||||
start = dt.datetime(2011, 7, 21, 15, 10)
|
||||
end = dt.datetime(2011, 7, 21, 15, 15)
|
||||
|
||||
utc_start = calendar.timegm(start.utctimetuple())
|
||||
utc_end = calendar.timegm(end.utctimetuple())
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_recent_tracks(time_from=utc_start, time_to=utc_end)
|
||||
|
||||
# Assert
|
||||
assert len(tracks) == 1
|
||||
assert str(tracks[0].track.artist) == "Johnny Cash"
|
||||
assert str(tracks[0].track.title) == "Ring of Fire"
|
||||
|
||||
def test_get_recent_tracks_limit_none(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("bbc6music")
|
||||
start = dt.datetime(2020, 2, 15, 15, 00)
|
||||
end = dt.datetime(2020, 2, 15, 15, 40)
|
||||
|
||||
utc_start = calendar.timegm(start.utctimetuple())
|
||||
utc_end = calendar.timegm(end.utctimetuple())
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_recent_tracks(
|
||||
time_from=utc_start, time_to=utc_end, limit=None
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert len(tracks) == 11
|
||||
assert str(tracks[0].track.artist) == "Seun Kuti & Egypt 80"
|
||||
assert str(tracks[0].track.title) == "Struggles Sounds"
|
||||
|
||||
def test_get_recent_tracks_is_streamable(self) -> None:
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("bbc6music")
|
||||
start = dt.datetime(2020, 2, 15, 15, 00)
|
||||
end = dt.datetime(2020, 2, 15, 15, 40)
|
||||
|
||||
utc_start = calendar.timegm(start.utctimetuple())
|
||||
utc_end = calendar.timegm(end.utctimetuple())
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_recent_tracks(
|
||||
time_from=utc_start, time_to=utc_end, limit=None, stream=True
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert inspect.isgenerator(tracks)
|
||||
|
||||
def test_get_playcount(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
playcount = user.get_playcount()
|
||||
|
||||
# Assert
|
||||
assert playcount >= 128387
|
||||
|
||||
def test_get_image(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
image = user.get_image()
|
||||
|
||||
# Assert
|
||||
assert image.startswith("https://")
|
||||
assert image.endswith(".png")
|
||||
|
||||
def test_get_url(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
||||
# Act
|
||||
url = user.get_url()
|
||||
|
||||
# Assert
|
||||
assert url == "https://www.last.fm/user/rj"
|
||||
|
||||
def test_get_weekly_artist_charts(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("bbc6music")
|
||||
|
||||
# Act
|
||||
charts = user.get_weekly_artist_charts()
|
||||
artist, weight = charts[0]
|
||||
|
||||
# Assert
|
||||
assert artist is not None
|
||||
assert isinstance(artist.network, pylast.LastFMNetwork)
|
||||
|
||||
def test_get_weekly_track_charts(self) -> None:
|
||||
# Arrange
|
||||
user = self.network.get_user("bbc6music")
|
||||
|
||||
# Act
|
||||
charts = user.get_weekly_track_charts()
|
||||
track, weight = charts[0]
|
||||
|
||||
# Assert
|
||||
assert track is not None
|
||||
assert isinstance(track.network, pylast.LastFMNetwork)
|
||||
|
||||
def test_user_get_track_scrobbles(self) -> None:
|
||||
# Arrange
|
||||
artist = "France Gall"
|
||||
title = "Laisse Tomber Les Filles"
|
||||
user = self.network.get_user("bbc6music")
|
||||
|
||||
# Act
|
||||
scrobbles = user.get_track_scrobbles(artist, title)
|
||||
|
||||
# Assert
|
||||
assert len(scrobbles) > 0
|
||||
assert str(scrobbles[0].track.artist) == "France Gall"
|
||||
assert scrobbles[0].track.title == "Laisse Tomber Les Filles"
|
||||
|
||||
def test_cacheable_user_get_track_scrobbles(self) -> None:
|
||||
# Arrange
|
||||
artist = "France Gall"
|
||||
title = "Laisse Tomber Les Filles"
|
||||
user = self.network.get_user("bbc6music")
|
||||
|
||||
# Act
|
||||
result1 = user.get_track_scrobbles(artist, title, cacheable=False)
|
||||
result2 = list(user.get_track_scrobbles(artist, title, cacheable=True))
|
||||
result3 = list(user.get_track_scrobbles(artist, title))
|
||||
|
||||
# Assert
|
||||
self.helper_validate_results(result1, result2, result3)
|
70
tests/unicode_test.py
Normal file
70
tests/unicode_test.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
|
||||
def mock_network():
|
||||
return mock.Mock(_get_ws_auth=mock.Mock(return_value=("", "", "")))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"artist",
|
||||
[
|
||||
"\xe9lafdasfdsafdsa",
|
||||
"ééééééé",
|
||||
pylast.Artist("B\xe9l", mock_network()),
|
||||
"fdasfdsafsaf not unicode",
|
||||
],
|
||||
)
|
||||
def test_get_cache_key(artist) -> None:
|
||||
request = pylast._Request(mock_network(), "some_method", params={"artist": artist})
|
||||
request._get_cache_key()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("obj", [pylast.Artist("B\xe9l", mock_network())])
|
||||
def test_cast_and_hash(obj) -> None:
|
||||
assert isinstance(str(obj), str)
|
||||
assert isinstance(hash(obj), int)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
[
|
||||
(
|
||||
# Plain text
|
||||
'<album mbid="">test album name</album>',
|
||||
'<album mbid="">test album name</album>',
|
||||
),
|
||||
(
|
||||
# Contains Unicode ENQ Enquiry control character
|
||||
'<album mbid="">test album \u0005name</album>',
|
||||
'<album mbid="">test album name</album>',
|
||||
),
|
||||
],
|
||||
)
|
||||
def test__remove_invalid_xml_chars(test_input: str, expected: str) -> None:
|
||||
assert pylast._remove_invalid_xml_chars(test_input) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
[
|
||||
(
|
||||
# Plain text
|
||||
'<album mbid="">test album name</album>',
|
||||
'<?xml version="1.0" ?><album mbid="">test album name</album>',
|
||||
),
|
||||
(
|
||||
# Contains Unicode ENQ Enquiry control character
|
||||
'<album mbid="">test album \u0005name</album>',
|
||||
'<?xml version="1.0" ?><album mbid="">test album name</album>',
|
||||
),
|
||||
],
|
||||
)
|
||||
def test__parse_response(test_input: str, expected: str) -> None:
|
||||
doc = pylast._parse_response(test_input)
|
||||
assert doc.toxml() == expected
|
40
tox.ini
Normal file
40
tox.ini
Normal file
|
@ -0,0 +1,40 @@
|
|||
[tox]
|
||||
requires =
|
||||
tox>=4.2
|
||||
env_list =
|
||||
lint
|
||||
py{py3, 313, 312, 311, 310, 39, 38}
|
||||
|
||||
[testenv]
|
||||
extras =
|
||||
tests
|
||||
pass_env =
|
||||
FORCE_COLOR
|
||||
PYLAST_API_KEY
|
||||
PYLAST_API_SECRET
|
||||
PYLAST_PASSWORD_HASH
|
||||
PYLAST_USERNAME
|
||||
commands =
|
||||
{envpython} -m pytest -v -s -W all \
|
||||
--cov pylast \
|
||||
--cov tests \
|
||||
--cov-report html \
|
||||
--cov-report term-missing \
|
||||
--cov-report xml \
|
||||
--random-order \
|
||||
{posargs}
|
||||
|
||||
[testenv:lint]
|
||||
skip_install = true
|
||||
deps =
|
||||
pre-commit
|
||||
pass_env =
|
||||
PRE_COMMIT_COLOR
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
[testenv:venv]
|
||||
deps =
|
||||
ipdb
|
||||
commands =
|
||||
{posargs}
|
Loading…
Reference in a new issue