Spaces:
Build error
Build error
Upload 19 files
Browse files- .gitattributes +36 -0
- Data/new_tracks.csv +115 -0
- Data/sc.sav +0 -0
- Data/streamlit.csv +3 -0
- LICENSE +201 -0
- README.md +10 -0
- gitignore.txt +4 -0
- main.py +512 -0
- model.py +520 -0
- requirements.txt +7 -0
- spotify_get_artist_url.png +0 -0
- spotify_get_playlist_url.png +0 -0
- spotify_get_song_url.png +0 -0
- spotifysearch/__init__.py +0 -0
- spotifysearch/calls.py +24 -0
- spotifysearch/classes.py +219 -0
- spotifysearch/client.py +19 -0
- spotifysearch/constructor.py +80 -0
- spotifysearch/urlbuilder.py +28 -0
.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Data/streamlit.csv filter=lfs diff=lfs merge=lfs -text
|
Data/new_tracks.csv
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
track_uri,artist_uri,album_uri,danceability,energy,key,loudness,mode,speechiness,acousticness,instrumentalness,liveness,valence,tempo,duration_ms,time_signature,Track_release_date,Track_pop,Artist_pop,Artist_genres
|
| 2 |
+
0SPBrxOUEMIKugXR4bFhxs,07XSN3sPlIlB2L2XNcTwJw,77opKywcxPnBu5aBMASS2b,0.409,0.868,3.0,-6.234,0.0,0.0368,0.0266,0.0357,0.276,0.704,147.2,198707.0,4.0,39,12,14,album_rock glam_rock hard_rock metal rock
|
| 3 |
+
0Wa5Q145xoXkfhaCRgA67U,36QJpDe2go2KgaRleHCDTp,4Q7cPyiP8cMIlUEHAqeYfd,0.483,0.615,2.0,-8.54,1.0,0.0497,0.452,0.000414,0.0512,0.594,80.56,517125.0,3.0,39,8,15,album_rock classic_rock hard_rock rock
|
| 4 |
+
5UdShl12E6eHEgS8lQ1bPr,36QJpDe2go2KgaRleHCDTp,4wExFfncaUIqSgoxnqa3Eh,0.552,0.791,7.0,-8.36,1.0,0.0303,0.123,1.42e-05,0.162,0.698,91.2,355893.0,4.0,40,10,15,album_rock classic_rock hard_rock rock
|
| 5 |
+
2GnVuaoKSkB6Xa07l1BBg8,5M52tdBnJaKSvOpJGz8mfZ,6TcPqftScGmR0aEgIb43Vv,0.476,0.556,4.0,-10.586,0.0,0.0646,0.0838,1.59e-05,0.125,0.43,103.1,364493.0,4.0,40,11,14,album_rock birmingham_metal classic_rock hard_rock metal rock stoner_rock uk_doom_metal
|
| 6 |
+
5SAUIWdZ04OxYfJFDchC7S,568ZhdwyaiCyOGJRtNYhWf,1EK3a0Yctg4d3nGQzE4Uty,0.632,0.586,0.0,-11.336,1.0,0.0284,0.0983,0.581,0.0535,0.89,114.25,342173.0,4.0,39,12,13,album_rock blues_rock classic_rock hard_rock metal psychedelic_rock rock
|
| 7 |
+
2cc9k15AifO7RfxxuEExkS,0cc6vw3VN8YlIcvr1v7tBL,23krn1eEy7o3u9laLI1PLD,0.535,0.967,2.0,-4.082,1.0,0.0678,0.000885,0.0181,0.233,0.353,111.0,291307.0,4.0,39,13,14,glam_metal hard_rock metal rock sleaze_rock
|
| 8 |
+
2C0hJUVjp7FSchyhYiceJq,0cc6vw3VN8YlIcvr1v7tBL,4ns4vxdkk4PdkneLNfJL52,0.395,0.777,5.0,-5.848,1.0,0.0334,0.097,5.54e-06,0.197,0.12,75.56,239080.0,4.0,39,13,14,glam_metal hard_rock metal rock sleaze_rock
|
| 9 |
+
0cKk8BKEi7zXbdrYdyqBP5,67ea9eGLXYMsO2eYQRui3w,5MqyhhHbT13zsloD3uHhlQ,0.394,0.622,4.0,-8.26,0.0,0.0336,0.213,4.45e-05,0.0892,0.342,126.9,221427.0,4.0,39,14,13,album_rock art_rock blues_rock british_invasion classic_rock hard_rock mellow_gold psychedelic_rock rock
|
| 10 |
+
1ju7EsSGvRybSNEsRvc7qY,4MVyzYMgTwdP7Z49wAZHx0,6DExt1eX4lflLacVjHHbOs,0.422,0.752,6.0,-8.68,1.0,0.0449,0.0366,0.000119,0.129,0.403,120.5,356627.0,4.0,39,14,14,album_rock blues_rock classic_rock country_rock hard_rock mellow_gold rock southern_rock
|
| 11 |
+
4J0kN8QS2esY6cWBsFjtW9,1dfeR4HaWDbWqFHLkxsg1d,6X9k3hSsvQck2OfKYdBbXr,0.395,0.698,2.0,-6.242,1.0,0.0573,0.334,6.44e-05,0.155,0.455,124.7,223173.0,4.0,39,9,16,classic_rock glam_rock rock
|
| 12 |
+
6Wx88Mv6b9ofjKMKkdwOJd,6XyY86QOPPrYVGvF9ch6wz,1fqibtpI0bwD73uQGeEnhn,0.493,0.808,5.0,-3.365,0.0,0.0362,0.000235,0.0,0.0983,0.38,118.0,268613.0,4.0,40,13,16,alternative_metal nu_metal post-grunge rap_metal
|
| 13 |
+
4CWhc9FaMMfBTt4ANjfbOf,6XyY86QOPPrYVGvF9ch6wz,2tlTBLz2w52rpGCLBGyGw6,0.571,0.934,3.0,-4.22,0.0,0.0531,0.00316,6.2e-06,0.197,0.409,132.6,221720.0,4.0,40,12,16,alternative_metal nu_metal post-grunge rap_metal
|
| 14 |
+
0sp00HSXkQyqTa6QqM0O8V,6XyY86QOPPrYVGvF9ch6wz,2tlTBLz2w52rpGCLBGyGw6,0.509,0.629,0.0,-6.434,1.0,0.0335,0.209,1.97e-06,0.369,0.237,80.0,209307.0,4.0,40,13,16,alternative_metal nu_metal post-grunge rap_metal
|
| 15 |
+
0OYcEfskah1egYHjYRvbg1,6XyY86QOPPrYVGvF9ch6wz,2tlTBLz2w52rpGCLBGyGw6,0.534,0.393,11.0,-7.812,1.0,0.0292,0.00479,0.0107,0.107,0.0641,110.0,290360.0,4.0,40,13,16,alternative_metal nu_metal post-grunge rap_metal
|
| 16 |
+
1fLlRApgzxWweF1JTf8yM5,6XyY86QOPPrYVGvF9ch6wz,2tlTBLz2w52rpGCLBGyGw6,0.655,0.885,7.0,-4.117,1.0,0.0438,0.00117,0.000473,0.0448,0.938,100.06,189293.0,4.0,40,14,16,alternative_metal nu_metal post-grunge rap_metal
|
| 17 |
+
7dvd3b2oz7AFgXrPBIIYxR,3nFkdlSjzX9mRTtwJOzDYB,5NH94cATqx5fjBE794xZLy,0.557,0.905,11.0,-4.508,1.0,0.267,0.0104,0.0,0.111,0.799,160.0,244693.0,4.0,40,11,16,east_coast_hip_hop hip_hop rap
|
| 18 |
+
2eVofaQRJvddSUBfcub7Gz,2KjAo6wVc9d2WcxdxSArpV,6kfKntjGEwjKUL7q43j5rO,0.659,0.387,6.0,-13.17,0.0,0.0335,0.467,0.692,0.0839,0.0779,115.0,279573.0,4.0,40,11,12,indie_folk
|
| 19 |
+
5u51UnecWzSb1ezJmDhBFw,2KjAo6wVc9d2WcxdxSArpV,2jCMxN3Ys1PCq6FQBEwM5L,0.61,0.671,1.0,-9.5,1.0,0.0361,0.441,0.0066,0.103,0.056,103.0,277633.0,4.0,40,8,12,indie_folk
|
| 20 |
+
4wNj7wubtz1KnGaFg2VwcU,7E3BRXV9ZbCt5lQTCXMTia,2YlB5eElaicdKaMYZVUHsO,0.628,0.0184,4.0,-22.56,0.0,0.0612,0.996,0.951,0.0993,0.232,103.8,121845.0,4.0,40,7,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 21 |
+
3m6A0Rpu03KYNyWzbCo0yO,7E3BRXV9ZbCt5lQTCXMTia,7lMrHurKbBzzHDVCblN0X3,0.159,0.0358,10.0,-26.84,0.0,0.0435,0.984,0.88,0.102,0.0391,72.7,210013.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 22 |
+
1EEJBUOORu9dLZQSeQkZOP,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.231,0.0749,0.0,-20.97,0.0,0.0351,0.989,0.933,0.112,0.0735,134.2,256507.0,4.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 23 |
+
5RqKo9P4DLA0bVyY70cWkr,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.583,0.0238,0.0,-32.25,0.0,0.0369,0.994,0.847,0.103,0.426,108.75,131923.0,4.0,40,12,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 24 |
+
5tmtJPv2RyTqFQUC4VDgYy,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.171,0.193,4.0,-12.984,0.0,0.0392,0.974,0.924,0.0822,0.0922,132.5,204866.0,5.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 25 |
+
7zTaLLMF9A170FfPtBaL3m,7E3BRXV9ZbCt5lQTCXMTia,3qFNuf0WssUVPXTPdrxGho,0.373,0.163,6.0,-21.81,1.0,0.0332,0.936,0.936,0.128,0.0377,94.06,137680.0,4.0,40,7,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 26 |
+
7gOi88gP4o1uv1kaL02yBB,7E3BRXV9ZbCt5lQTCXMTia,1LvZUmULkYj2c3oxIZhbkX,0.14,0.133,10.0,-15.78,0.0,0.038,0.93,0.918,0.121,0.0716,142.0,268773.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 27 |
+
5Ag8TTr1IdnqqLWJjVwpsl,7E3BRXV9ZbCt5lQTCXMTia,3kc6nAFF8njXeLUk16CXl6,0.443,0.11,6.0,-18.6,0.0,0.0955,0.996,0.959,0.0882,0.152,66.5,134714.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 28 |
+
6oVhL0lLUMswqSV3VcKwJO,7E3BRXV9ZbCt5lQTCXMTia,3GmecFBWNs4fTi0PkLF7qR,0.462,0.339,6.0,-14.305,0.0,0.0418,0.813,0.808,0.108,0.0395,115.0,272014.0,4.0,40,10,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 29 |
+
7ajRLygLieUKb5qsumndfc,7E3BRXV9ZbCt5lQTCXMTia,0DZZLQvXZzgurc5wWFgAst,0.182,0.019,4.0,-30.6,1.0,0.0435,0.988,0.971,0.0907,0.0334,95.3,114426.0,4.0,40,7,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 30 |
+
4lSsH5NXdwFbBhRrFXPVFj,7E3BRXV9ZbCt5lQTCXMTia,6NW97EFYSQ9X1CulKyL7wf,0.297,0.126,1.0,-23.8,0.0,0.0408,0.992,0.81,0.134,0.17,153.6,190284.0,1.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 31 |
+
7djcz9efRuDz8jklVJn4DC,7E3BRXV9ZbCt5lQTCXMTia,0oBmVbeJmelnhnYiacIvde,0.062,0.0249,0.0,-20.03,0.0,0.0465,0.981,0.827,0.236,0.0306,67.94,236395.0,3.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 32 |
+
42DSWZ06VzGVzuoRwZEHHe,7E3BRXV9ZbCt5lQTCXMTia,0lCyefnvL1HqQkpXl5HjC5,0.222,0.11,0.0,-18.31,0.0,0.0377,0.979,0.902,0.128,0.0638,103.25,226000.0,5.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 33 |
+
3NJy8hN4OXIMyqbskBsL8v,7E3BRXV9ZbCt5lQTCXMTia,2YlB5eElaicdKaMYZVUHsO,0.4,0.0333,8.0,-28.05,1.0,0.0389,0.994,0.881,0.0947,0.239,131.2,163861.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 34 |
+
2BeTUHecaoBWc825E3CPLK,7E3BRXV9ZbCt5lQTCXMTia,6NW97EFYSQ9X1CulKyL7wf,0.149,0.084,8.0,-21.06,1.0,0.0391,0.987,0.944,0.0726,0.0406,79.9,200965.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 35 |
+
7b44iVYyWxXXhxtfIU3NTW,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.36,0.158,6.0,-24.23,0.0,0.0359,0.988,0.927,0.104,0.04,133.4,235534.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 36 |
+
3WoFKA49Hjdoj1O9yhV62c,7E3BRXV9ZbCt5lQTCXMTia,7o4mIRr1MVq4dMgQiIsUw7,0.208,0.0847,0.0,-20.92,1.0,0.0425,0.982,0.931,0.102,0.0391,124.0,274355.0,5.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 37 |
+
0nYm42RuPWFaHWUXUdwHYm,7E3BRXV9ZbCt5lQTCXMTia,4kqcQUsGW2cJbztclbqLbO,0.4,0.128,5.0,-16.61,0.0,0.0401,0.989,0.85,0.11,0.124,123.0,251626.0,3.0,40,11,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 38 |
+
3YjTarxfHHEBUWqW5532uv,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.388,0.0103,3.0,-32.16,1.0,0.0445,0.984,0.94,0.188,0.0506,64.56,254297.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 39 |
+
5NVM9GhtQLTTyF910jfHmy,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.288,0.0427,8.0,-19.14,1.0,0.0427,0.982,0.93,0.127,0.0938,99.6,212178.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 40 |
+
3u3SG5Mo1jGymmhEvuLA3G,7E3BRXV9ZbCt5lQTCXMTia,6NW97EFYSQ9X1CulKyL7wf,0.455,0.0951,1.0,-20.64,1.0,0.0394,0.988,0.95,0.104,0.168,121.94,242002.0,4.0,40,7,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 41 |
+
6ptovgL1si4Xn6BunkGg7t,7E3BRXV9ZbCt5lQTCXMTia,5yulSZK48ArdLPXWur0qik,0.471,0.103,3.0,-29.47,1.0,0.0337,0.993,0.914,0.106,0.174,116.5,315574.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 42 |
+
13MOQ6oQqkrZEDkZOHukCw,7E3BRXV9ZbCt5lQTCXMTia,6s61oZwe1dZuqBFi1pPo09,0.281,0.0333,6.0,-31.45,1.0,0.0348,0.994,0.959,0.0995,0.169,90.25,190500.0,1.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 43 |
+
7vbCfkJf89i4s745KbELgr,7E3BRXV9ZbCt5lQTCXMTia,5yulSZK48ArdLPXWur0qik,0.359,0.0224,3.0,-29.1,1.0,0.039,0.987,0.866,0.111,0.169,107.9,354989.0,3.0,40,11,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 44 |
+
0NVsz5lExNqzVDznhdPlU8,7E3BRXV9ZbCt5lQTCXMTia,1LvZUmULkYj2c3oxIZhbkX,0.201,0.132,3.0,-18.25,1.0,0.0342,0.992,0.942,0.132,0.141,169.9,202547.0,4.0,40,10,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 45 |
+
00L9p3dKK3ufNyua3pzVeC,7E3BRXV9ZbCt5lQTCXMTia,18Jd3iAcykSIDGTA0vanR3,0.0613,0.0285,7.0,-28.08,0.0,0.0427,0.95,0.899,0.106,0.0374,210.1,196440.0,4.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 46 |
+
6VuXB4kcwQaLxDeXOs1Nyi,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.192,0.0777,10.0,-19.27,1.0,0.038,0.986,0.916,0.0485,0.154,87.4,138360.0,4.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 47 |
+
2BE9wLg2nyJahAecN1a6La,7E3BRXV9ZbCt5lQTCXMTia,0DZZLQvXZzgurc5wWFgAst,0.435,0.0275,1.0,-32.38,0.0,0.0382,0.991,0.955,0.082,0.0524,120.0,136996.0,4.0,40,7,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 48 |
+
4tnWEXeAgZWTRULCkJ6IGL,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.435,0.0564,5.0,-27.61,0.0,0.0369,0.99,0.943,0.113,0.127,110.0,155485.0,4.0,40,10,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 49 |
+
1ijwLR1iybtxaUbasUj7kJ,7E3BRXV9ZbCt5lQTCXMTia,3s5UDbcu9PBKBJ4xIz0zcW,0.289,0.0253,2.0,-31.44,1.0,0.0376,0.994,0.919,0.0837,0.138,99.8,150000.0,4.0,40,11,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 50 |
+
6wUU6ff7O1jlE4NOrv01gI,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.366,0.336,8.0,-17.4,1.0,0.0367,0.968,0.934,0.0898,0.0542,140.0,364648.0,4.0,40,10,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 51 |
+
5nW41zamR8GqKYUxvxo12d,7E3BRXV9ZbCt5lQTCXMTia,3YW20Fu5fMy01J2EY4Dlav,0.304,0.0903,2.0,-17.4,0.0,0.0326,0.985,0.891,0.0622,0.165,180.2,278400.0,3.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 52 |
+
6yidnXvq5fN4ULkgk8FOIU,7E3BRXV9ZbCt5lQTCXMTia,0DZZLQvXZzgurc5wWFgAst,0.541,0.0342,8.0,-35.25,0.0,0.0378,0.995,0.952,0.101,0.498,113.4,148433.0,3.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 53 |
+
2xkgm3ZHezoiW9tGblP5gi,7E3BRXV9ZbCt5lQTCXMTia,1LvZUmULkYj2c3oxIZhbkX,0.223,0.0696,5.0,-23.77,1.0,0.0314,0.991,0.933,0.0671,0.0411,81.25,242400.0,4.0,40,8,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 54 |
+
1CWCGglkuopcEsOaAXX8IN,7E3BRXV9ZbCt5lQTCXMTia,59XsnSTi3KDC8UtvOCMUSI,0.486,0.233,11.0,-25.77,1.0,0.0287,0.989,0.917,0.337,0.437,74.9,340751.0,4.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 55 |
+
2vD20Aj8Ru9NAmJl1Ca2qS,7E3BRXV9ZbCt5lQTCXMTia,6JpQGIi2he6iskzR4aLwPG,0.429,0.00693,9.0,-31.05,1.0,0.0539,0.995,0.938,0.0711,0.431,97.06,125413.0,4.0,40,11,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 56 |
+
6bcjo4kEC3bS46YbKjdywg,7E3BRXV9ZbCt5lQTCXMTia,1LvZUmULkYj2c3oxIZhbkX,0.262,0.0589,8.0,-16.56,1.0,0.0357,0.964,0.000934,0.105,0.0677,182.6,238707.0,3.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 57 |
+
0YPagAr3GhXlRX06E4nUcw,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.437,0.0463,0.0,-25.92,1.0,0.0369,0.988,0.917,0.0845,0.139,140.5,187848.0,4.0,40,9,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 58 |
+
6Xajr512QEGAZ20bqAWkyT,7E3BRXV9ZbCt5lQTCXMTia,69Q8uDA8C7EdKUo5oveufQ,0.477,0.348,2.0,-14.586,1.0,0.0335,0.931,0.949,0.11,0.0867,117.94,208589.0,4.0,40,10,12,bow_pop compositional_ambient icelandic_classical neo-classical neoclassical_darkwave
|
| 59 |
+
1rpF77jsLBMG2QjCuhe0Sr,0fauHpmSHwodVYIjTqOGHz,4vtunVFmIlrxIrkOobdfDH,0.417,0.0287,7.0,-25.06,1.0,0.0714,0.994,0.889,0.079,0.285,143.2,264053.0,4.0,40,11,12,korean_instrumental neo-classical new_age_piano
|
| 60 |
+
5pW62tsMUPtw8k69ifpcjJ,2AcUPzkVWo81vumdzeLLRN,4emDc6rcjqJGqCj8NqEIzG,0.631,0.14,8.0,-16.38,1.0,0.0368,0.957,0.0106,0.109,0.1,140.0,254347.0,4.0,40,8,12,downtempo indie_soul indietronica shimmer_pop
|
| 61 |
+
4S2lJF9tqs5MRLtWzuPXx1,2i1CPudyCUjL50Wqjv8AMI,79a34uOB7jdMrSECClgqOv,0.444,0.0903,11.0,-19.28,0.0,0.0456,0.994,0.905,0.0856,0.0899,80.7,207680.0,4.0,40,9,9,british_jazz indie_jazz indie_soul uk_contemporary_jazz
|
| 62 |
+
3Bsyp79WSkfDruQBBo8FMO,6pSQcy8935ABNiK2qOpOlK,5xu1hee0bAPBpMmysKSmdc,0.553,0.11,11.0,-23.62,0.0,0.0307,0.966,0.931,0.0878,0.133,148.0,224736.0,4.0,40,8,9,compositional_ambient neo-classical
|
| 63 |
+
1n6ouOiQpRXaWVTeDOGxDW,54MsweggxTxlfYUbhZNIQ0,5KmLU0k60tDKnEhgRAqG2N,0.352,0.127,10.0,-26.31,0.0,0.0304,0.988,0.929,0.134,0.13,137.9,291000.0,4.0,40,10,9,compositional_ambient neo-classical
|
| 64 |
+
3yPd2RxNNcPwOV06zoexrv,21mKp7DqtSNHhCAU2ugvUw,0xVucRYJf5luWLekMGYh3i,0.403,0.636,9.0,-5.91,1.0,0.0449,0.395,0.604,0.439,0.0367,107.9,400130.0,4.0,40,10,13,chillwave edm ninja
|
| 65 |
+
1wb6pRSvhekFyXO5j3fXol,14YzutUdMwS9yTnI0IFBaD,27yZ8bTAOMlvnfU4vaIxvK,0.273,0.0338,1.0,-33.88,0.0,0.0343,0.984,0.878,0.105,0.134,147.6,227675.0,3.0,40,10,10,compositional_ambient neo-classical
|
| 66 |
+
4wCg95zm652wWBnryX9oS6,2SMBaAG61s9mtyJ0eeXSWx,79a34uOB7jdMrSECClgqOv,0.246,0.108,0.0,-18.19,0.0,0.0366,0.962,0.876,0.0782,0.0738,67.3,236999.0,4.0,40,9,9,compositional_ambient neo-classical
|
| 67 |
+
3uUUJo8kymUm0a9L7JSEDF,6ntwC60sylc4u0Npjoj6GM,5b7quz61hkXH51ocDuSeCp,0.658,0.591,5.0,-8.18,0.0,0.043,0.154,0.672,0.0585,0.215,105.94,238213.0,4.0,40,5,3,palestinian_alternative
|
| 68 |
+
1qrRl5pJWiL93EukHOMB0h,3fyyPt5BZ20BkmqVcQV6wS,09J4Y6mUcrEjkhzIAEwg1x,0.588,0.814,9.0,-5.953,0.0,0.0702,0.0398,0.0,0.0493,0.704,159.9,249750.0,4.0,40,4,7,jordanian_pop middle_east_hip_hop palestinian_hip_hop palestinian_pop
|
| 69 |
+
6unp5zGcRjIAyeNjiVMLHX,76G2QPGz4HBmhn0D3vr9UL,5ydSYLaBAPJIV2bn2HmkSs,0.494,0.553,11.0,-9.164,0.0,0.2,0.00601,0.0,0.0542,0.354,113.3,177388.0,5.0,40,7,8,palestinian_pop
|
| 70 |
+
3AQMp7f6Pgm3gHUGoTqDyL,0ezquZkJscWDhtBZwptcKT,6RMRNXNTg12KwIUIxFcYay,0.481,0.658,6.0,-6.754,0.0,0.03,0.0263,0.0282,0.132,0.513,162.0,228334.0,4.0,40,4,4,arab_alternative jordanian_pop
|
| 71 |
+
5FoOlTlC8pzAHV23s7gPqY,0ezquZkJscWDhtBZwptcKT,2gnn8Mwb6Njbh34OsqvoIh,0.407,0.766,4.0,-4.992,1.0,0.0365,0.0064,0.0525,0.115,0.269,140.0,336008.0,4.0,40,6,4,arab_alternative jordanian_pop
|
| 72 |
+
2rD1eIqfbnsCk9GJxiXQBK,0ezquZkJscWDhtBZwptcKT,6RMRNXNTg12KwIUIxFcYay,0.613,0.542,7.0,-6.29,0.0,0.025,0.132,0.0641,0.11,0.564,82.06,210778.0,4.0,40,5,4,arab_alternative jordanian_pop
|
| 73 |
+
6EGN0RcirTvE4HCrKNXGe0,2qi698G7BphxwdPUbQgZMU,5ntiX3s1kigHbz9WqQsxyN,0.526,0.499,10.0,-10.46,1.0,0.119,0.285,0.0,0.0872,0.71,170.1,268549.0,4.0,40,6,7,arab_alternative jordanian_pop
|
| 74 |
+
01g5Dl95lH5qQyjjXucOPf,2qi698G7BphxwdPUbQgZMU,0hLTpm3Xcac0uUsl1HfeQx,0.655,0.621,10.0,-7.363,0.0,0.0383,0.33,0.0,0.137,0.685,105.0,172317.0,4.0,40,3,7,arab_alternative jordanian_pop
|
| 75 |
+
19M24LvVumMVlcQIHusXyl,6dO0RkhFhjMwLtLQqNgL8r,41kBbSWRbStqfsrXeM5Cpo,0.701,0.655,9.0,-9.05,0.0,0.15,0.0872,0.0,0.181,0.805,147.0,181348.0,4.0,40,3,10,indonesian_viral_pop
|
| 76 |
+
6nIGMTqiL0cZYyNa8gzj0e,6dO0RkhFhjMwLtLQqNgL8r,1gZW7IiLxwvWx0VAR9HK3X,0.828,0.498,1.0,-10.38,0.0,0.0363,0.172,0.0,0.0727,0.439,95.0,209684.0,4.0,40,11,10,indonesian_viral_pop
|
| 77 |
+
6B1Fq1RpAW1dBTaCZ9WxQ2,2a1uAKszGY1wTHnbT0Y9Y8,3nm3ELWFVPTN7Iq6D7GWYj,0.687,0.688,0.0,-7.145,1.0,0.037,0.121,3.1e-06,0.0718,0.31,100.0,199200.0,4.0,40,3,3,unknown
|
| 78 |
+
2miXa7bxd39RSSn1VvPs7o,2a1uAKszGY1wTHnbT0Y9Y8,59al6unEUgOFKSknNugus9,0.857,0.502,5.0,-10.695,0.0,0.0356,0.11,0.0473,0.104,0.53,100.0,146400.0,4.0,40,4,3,unknown
|
| 79 |
+
2c2by2xH5vEW142S9zZD7G,0EQjOxeqpT2ebzA1NvT9Cu,5LC6AvKrSmynyr7o50k5OM,0.658,0.389,11.0,-8.734,0.0,0.0312,0.828,0.00104,0.0883,0.245,112.6,224000.0,4.0,40,3,3,arab_alternative jordanian_pop
|
| 80 |
+
4ktzD6OYjb2u2kqfecXK79,4yuZxu7joQOFtplpMAsxlf,3JNS9fh8RFw3N86GCCbZp6,0.692,0.496,10.0,-10.695,0.0,0.0683,0.153,0.334,0.42,0.488,89.94,199333.0,4.0,40,6,6,palestinian_alternative
|
| 81 |
+
5x7LMsSBWbQlLnmxF3U5PC,4yuZxu7joQOFtplpMAsxlf,2I2lamkjFbeLFLUEcH8SAc,0.73,0.487,11.0,-10.44,0.0,0.0571,0.054,0.00999,0.106,0.353,100.06,184800.0,4.0,40,9,6,palestinian_alternative
|
| 82 |
+
1DJ2pwtprG3edEU2pbVVDi,1IJJoAyxznu3orwXhlt3XO,74vATKQHUWKVc4T7uYLK3n,0.648,0.533,0.0,-8.336,0.0,0.0357,0.85,1.84e-05,0.152,0.737,148.0,211283.0,4.0,40,2,7,arab_pop jordanian_pop palestinian_pop
|
| 83 |
+
1hUZU0lCce1QzcaqWjwWiE,1IJJoAyxznu3orwXhlt3XO,1GOZ3S72ib2ZU1MjpeRy42,0.725,0.769,0.0,-5.46,1.0,0.0293,0.432,0.0,0.0545,0.749,98.0,189870.0,4.0,40,3,7,arab_pop jordanian_pop palestinian_pop
|
| 84 |
+
0y9njiG24r8Pc7iPNuY5zl,1IJJoAyxznu3orwXhlt3XO,7N0irhTBjGV5StiVTw8qTt,0.748,0.807,2.0,-4.43,0.0,0.0344,0.2,3.3e-06,0.0948,0.701,106.06,187747.0,4.0,40,5,7,arab_pop jordanian_pop palestinian_pop
|
| 85 |
+
4UcpiWGup7TKr1NkqaBrQ7,1IJJoAyxznu3orwXhlt3XO,77e5W1q40rJcSAJjt7GA1p,0.659,0.713,7.0,-6.82,1.0,0.0468,0.313,0.0,0.0991,0.849,179.9,175627.0,4.0,40,6,7,arab_pop jordanian_pop palestinian_pop
|
| 86 |
+
5aV0Vl1Fv9s9PmWklzzlvz,1IJJoAyxznu3orwXhlt3XO,0IiY9pwCRMsRdldrMpW03A,0.649,0.935,1.0,-4.766,0.0,0.0445,0.277,1.55e-06,0.0724,0.914,145.0,237453.0,4.0,40,4,7,arab_pop jordanian_pop palestinian_pop
|
| 87 |
+
54eiRWO1fHjuxWDptNftM8,1IJJoAyxznu3orwXhlt3XO,2mCEBE4YATciVhoaIWLc6Z,0.716,0.828,1.0,-5.453,0.0,0.0611,0.115,0.0,0.059,0.846,100.0,254395.0,4.0,40,2,7,arab_pop jordanian_pop palestinian_pop
|
| 88 |
+
1feYc8vSa3y6EodevhkzYB,7nQVHZnQGjMyc1HSOQW7GZ,4Aq2uHcgC4Sk13QlrzKicj,0.859,0.62,5.0,-5.06,0.0,0.0573,0.0924,0.0036,0.0908,0.628,100.0,145871.0,4.0,40,7,7,palestinian_alternative
|
| 89 |
+
33ZTgAaPHck9KIIOEnkSxC,1vKZWmYdp9BQAbtrX9ORuu,4J1k05sRPi0Qlez40Z8nXg,0.799,0.655,7.0,-4.816,1.0,0.102,0.122,0.0,0.106,0.555,100.0,189600.0,4.0,40,4,4,haryanvi_hip_hop jordanian_pop
|
| 90 |
+
4UiGACEtRM9N0PxuXzrVfQ,3faPN9ZqiY5AFpYAe8WqGE,3yqmmWNUtIMWBlFImfPhb0,0.739,0.549,3.0,-9.94,0.0,0.0499,0.487,4.5e-06,0.107,0.529,122.0,252295.0,4.0,40,4,4,arab_pop jordanian_pop
|
| 91 |
+
0MxeOx5YwpkXIlCmr6xOjP,0jIWKlfmD4Ew7HeVVrq03g,6fV0By80SOnUuqKt5wpk2A,0.736,0.597,8.0,-5.934,0.0,0.107,0.325,0.0,0.35,0.696,150.1,139289.0,4.0,40,8,9,palestinian_pop
|
| 92 |
+
62tYV2LYspoAS5vvZKB1EL,6gm05jmgIx3YvLtzl1GDas,3txVOVb4WHe4AzuvjMYrKn,0.522,0.613,9.0,-9.06,1.0,0.0979,0.722,6.14e-06,0.238,0.722,168.0,200000.0,4.0,40,2,1,reggae_maghreb
|
| 93 |
+
5LXmGPStiy83Tnsq96G9V6,0blZk3JXQG2roCiO6KCJWY,0y5vb7o8uCKsA858HIG2dM,0.54,0.504,1.0,-12.99,1.0,0.0424,0.727,0.000143,0.111,0.742,175.0,208560.0,4.0,40,2,5,jordanian_pop
|
| 94 |
+
4l7h95DV4TJimjWoZBRd9B,0blZk3JXQG2roCiO6KCJWY,3lMNn9CmmoS7oWUGUbgZ5Q,0.61,0.145,1.0,-15.02,0.0,0.0333,0.92,1.9e-06,0.114,0.184,102.4,244690.0,4.0,40,2,5,jordanian_pop
|
| 95 |
+
3zOixogOi4v75PI7bkws2O,7BhIlI9vRbaE1i1bYm81ZF,3pnLlR5wQ08LWbyb93clqe,0.652,0.658,9.0,-6.68,0.0,0.108,0.258,0.0,0.125,0.534,172.0,220905.0,4.0,40,3,1,jordanian_pop
|
| 96 |
+
3XknoC28vtiUyutxsG9ul6,409IHz2Yvi1kdUmrjein3m,3KVMPfIaR2QTJIguyhdnxh,0.697,0.881,6.0,-6.71,1.0,0.0366,0.108,0.00186,0.116,0.731,112.0,178913.0,4.0,40,5,2,palestinian_pop
|
| 97 |
+
2qSOhlYYwnlmTh5MNlxv6T,1LTJFwU5wuzqgYWzvkqBix,3jm2Mw7iAV31QfoRverhwL,0.489,0.342,1.0,-15.56,0.0,0.0306,0.202,4.37e-05,0.0757,0.22,82.1,222439.0,4.0,40,4,7,arab_electronic middle_east_hip_hop
|
| 98 |
+
7lx7KcCLJtHTCFglYQC12y,1LTJFwU5wuzqgYWzvkqBix,6W7b9RFrdBE29953myz6b7,0.376,0.398,11.0,-13.266,0.0,0.0403,0.579,5.12e-05,0.0847,0.25,138.9,167500.0,4.0,40,2,7,arab_electronic middle_east_hip_hop
|
| 99 |
+
7ys7eUYsciH8LefcobJ4hQ,7ekEnaplxNFP0jh9hiyeM8,2PbNvLR2MHgirCervbyo8n,0.864,0.734,1.0,-5.35,0.0,0.107,0.472,0.000305,0.0867,0.527,90.0,260597.0,4.0,40,2,3,middle_east_hip_hop palestinian_hip_hop
|
| 100 |
+
0KmiXlCv8005j9o340PW4e,5nxFmhSekt9Acn4tWZxGge,6fxuBrz4h4iOuW5hVoiJmc,0.593,0.871,0.0,-7.7,0.0,0.309,0.134,5.06e-05,0.271,0.728,176.0,275017.0,4.0,40,3,5,arab_alternative jordanian_pop middle_east_hip_hop palestinian_hip_hop palestinian_pop
|
| 101 |
+
0NWhRdPRI06ABKoOeRSgrb,5m8fc8h0xd4QfpJzcPI9NK,1h6ZfXJnDh0Vvlrv7mj7yh,0.479,0.837,4.0,-8.52,0.0,0.228,0.0861,8e-06,0.095,0.369,112.1,187643.0,5.0,40,2,5,arab_pop jordanian_pop
|
| 102 |
+
6gaEXyjkXtIfFcmNZSPQhL,704S90MD8gMqUNd9LsXvd1,2UYF5glGACebnFJcxzMHEO,0.756,0.657,8.0,-8.766,0.0,0.0386,0.16,0.000583,0.122,0.0859,107.94,248889.0,4.0,40,3,5,arabic_hip_hop jordanian_pop middle_east_hip_hop palestinian_hip_hop
|
| 103 |
+
3eFh5hiL65ylUoGAAI3Rl1,5VZr6vX1UPRRf9tneUEi2B,5UtCKCQtEMEgenYWqYmxIB,0.728,0.551,4.0,-9.984,0.0,0.0373,0.537,0.0,0.0818,0.451,97.94,211071.0,4.0,40,11,10,middle_east_hip_hop
|
| 104 |
+
65rWsK4Js9lGAhOQTpPTxM,0KgK0OMTh21OHyab9UDg3r,5nBnqvnnQnAsCNxX8q1Xw1,0.51,0.37,7.0,-12.96,1.0,0.138,0.801,1.07e-05,0.0929,0.452,95.06,174316.0,4.0,40,3,5,toronto_rap
|
| 105 |
+
5dueytCp1DWHJizVwQ34va,3zbimX3Z591csbDHH2Iuxc,0FIEcX7gSEX1h8PqsQbWhu,0.527,0.547,9.0,-7.05,0.0,0.0735,0.587,0.0,0.125,0.46,156.1,298823.0,4.0,40,3,5,arab_pop jordanian_pop
|
| 106 |
+
3xGfWGr12b6j86gUmhwesD,4juIELxFGt6YwXdpzGB69c,4zaWHh2zDRzOvC5ZhqOiDq,0.649,0.707,8.0,-5.934,1.0,0.0457,0.0248,0.00104,0.104,0.741,135.5,204533.0,4.0,40,6,3,indie_pop_rap
|
| 107 |
+
7uvT6cxtmmpLYED0uOaypM,4Svx0xgoS8UA2ldqxmxG4L,4KVKvjqBmoPlYMUsiW7O8v,0.681,0.793,11.0,-6.707,1.0,0.0751,0.0796,3.68e-05,0.456,0.485,99.06,166765.0,4.0,40,2,0,jordanian_pop
|
| 108 |
+
4c1JwtH7HEfIqlf0keNFGR,0x8vbV32RlTpfxsERAwena,30qPLsJugZwQXGH7iHdvkY,0.641,0.616,8.0,-9.59,1.0,0.0247,0.244,0.00353,0.131,0.496,105.0,248000.0,4.0,40,5,5,arab_alternative jordanian_pop
|
| 109 |
+
03OGe1S2a7i35BmuKbWaHk,4F84IBURUo98rz4r61KF70,2ntSwmOLAM0fMML87wtLKq,0.746,0.465,4.0,-7.586,0.0,0.0833,0.00637,0.511,0.237,0.29,123.9,232627.0,4.0,40,5,14,alternative_rock blues_rock detroit_rock garage_rock modern_blues_rock modern_rock permanent_wave punk_blues rock
|
| 110 |
+
0PdM2a6oIjqepoEfcJo0RO,6H1RjVyNruCmrBEWRbD0VZ,31oeDyCOLhgeZyktfxo0pE,0.267,0.953,1.0,-4.9,0.0,0.096,0.00211,0.0,0.283,0.568,85.0,267307.0,4.0,39,14,13,album_rock hard_rock nwobhm rock
|
| 111 |
+
0WoFs3EdGOx58yX5BtXvOa,1zxDewzd2j1ZdSBGaYcr0y,0EriQlp6zHpb1ThLZcandW,0.578,0.654,1.0,-12.42,0.0,0.0562,0.121,3.64e-06,0.0673,0.621,129.5,216467.0,4.0,39,15,13,album_rock power_pop
|
| 112 |
+
3GBApU0NuzH4hKZq4NOSdA,536BYVgOnRky0xjsPT96zl,0wNjC8d3ve2L2yaomEWUsa,0.563,0.739,6.0,-4.24,0.0,0.0416,0.00073,1.45e-05,0.0822,0.775,139.0,191707.0,4.0,40,14,13,indie_rock indietronica irish_rock modern_alternative_rock modern_rock northern_irish_indie
|
| 113 |
+
4BggEwLhGfrbrl7JBhC8EC,4iSKnRZAxkmqNok6tv10Se,0hdOk76DmEMYI6QV92mIin,0.736,0.811,9.0,-4.17,0.0,0.081,0.00132,0.000142,0.107,0.609,103.5,216733.0,4.0,39,14,11,alternative_metal funk_metal nu_metal post-grunge rap_rock
|
| 114 |
+
549Go7a66CX6k523uK9kUv,0cc6vw3VN8YlIcvr1v7tBL,2KT9tWALjIRjnaGYDYPg3k,0.599,0.931,7.0,-4.652,1.0,0.0735,0.0302,6.69e-05,0.392,0.536,140.1,270427.0,4.0,39,15,14,album_rock alternative_metal glam_metal hard_rock metal rock sleaze_rock
|
| 115 |
+
4JfuiOWlWCkjP6OKurHjSn,7Ey4PD4MYsKc5I2dolUwbH,6As5aOEQjfxLIChIB3fQRD,0.653,0.73,5.0,-10.61,1.0,0.0429,0.0115,1.02e-05,0.0776,0.894,108.7,220311.0,4.0,39,15,15,album_rock classic_rock hard_rock rock
|
Data/sc.sav
ADDED
|
Binary file (1.09 kB). View file
|
|
|
Data/streamlit.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:825f2815356f51fc0cf80bc7a3000612fab48daa925a32c0c3fe989555b2000b
|
| 3 |
+
size 186112931
|
LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Music Helix
|
| 3 |
+
emoji: 🎶
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.20.0
|
| 8 |
+
app_file: main.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
gitignore.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.cache
|
| 2 |
+
__pycache__
|
| 3 |
+
Spotify/*
|
| 4 |
+
.streamlit/
|
main.py
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from streamlit_option_menu import option_menu
|
| 3 |
+
import streamlit.components.v1 as components
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
import spotipy
|
| 7 |
+
from spotipy.oauth2 import SpotifyOAuth, SpotifyClientCredentials
|
| 8 |
+
import requests
|
| 9 |
+
from spotifysearch import *
|
| 10 |
+
from model import *
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
#Authentication - without user
|
| 14 |
+
#client_credentials_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 15 |
+
#sp = spotipy.Spotify(client_credentials_manager = client_credentials_manager)
|
| 16 |
+
|
| 17 |
+
Client_id=os.environ['Client_ID']
|
| 18 |
+
client_secret=os.environ['Client_secret']
|
| 19 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 20 |
+
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
if 'model' not in st.session_state:
|
| 28 |
+
st.session_state.model = 'Similarity Model'
|
| 29 |
+
def update_radio2():
|
| 30 |
+
st.session_state.model=st.session_state.radio2
|
| 31 |
+
if 'genre' not in st.session_state:
|
| 32 |
+
st.session_state.genre=3
|
| 33 |
+
def update_num_genre():
|
| 34 |
+
st.session_state.genre=st.session_state.num_genre
|
| 35 |
+
if 'artist' not in st.session_state:
|
| 36 |
+
st.session_state.artist=5
|
| 37 |
+
def update_same_art():
|
| 38 |
+
st.session_state.artist=st.session_state.same_art
|
| 39 |
+
if 'model2' not in st.session_state:
|
| 40 |
+
st.session_state.model2= 'Similarity Model'
|
| 41 |
+
def update_radio1():
|
| 42 |
+
st.session_state.model2 =st.session_state.radio1
|
| 43 |
+
|
| 44 |
+
if 'Region' not in st.session_state:
|
| 45 |
+
st.session_state.rg="US"
|
| 46 |
+
def update_Region():
|
| 47 |
+
st.session_state.rg=st.session_state.Region
|
| 48 |
+
if 'radio' not in st.session_state:
|
| 49 |
+
st.session_state.feature="Song"
|
| 50 |
+
def update_radio0():
|
| 51 |
+
st.session_state.feature=st.session_state.radio
|
| 52 |
+
|
| 53 |
+
if 'p_url' not in st.session_state:
|
| 54 |
+
st.session_state.p_url = 'Example: https://open.spotify.com/playlist/37i9dQZF1DX8FwnYE6PRvL?si=06ff6b38d4124af0'
|
| 55 |
+
def update_playlist_url():
|
| 56 |
+
st.session_state.p_url = st.session_state.playlist_url
|
| 57 |
+
|
| 58 |
+
if 's_url' not in st.session_state:
|
| 59 |
+
st.session_state.s_url = 'Example: https://open.spotify.com/track/5CQ30WqJwcep0pYcV4AMNc?si=ed4b04f153a24531'
|
| 60 |
+
def update_song_url():
|
| 61 |
+
st.session_state.s_url = st.session_state.song_url
|
| 62 |
+
|
| 63 |
+
if 'sn_url' not in st.session_state:
|
| 64 |
+
st.session_state.sn_url = 'In The End'
|
| 65 |
+
def update_song_name_url():
|
| 66 |
+
st.session_state.sn_url = st.session_state.songname_url
|
| 67 |
+
|
| 68 |
+
if 'a_url' not in st.session_state:
|
| 69 |
+
st.session_state.a_url = 'Example: https://open.spotify.com/artist/3RNrq3jvMZxD9ZyoOZbQOD?si=UNAsX20kRpG89bxOO8o7ew'
|
| 70 |
+
def update_artist_url():
|
| 71 |
+
st.session_state.a_url = st.session_state.artist_url
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def play_recomm():
|
| 75 |
+
if 'rs' in st.session_state:
|
| 76 |
+
del st.session_state.rs,st.session_state.err
|
| 77 |
+
try:
|
| 78 |
+
if len(pd.read_csv('Data/new_tracks.csv')) >= 200:
|
| 79 |
+
with st.spinner('Updating the dataset...'):
|
| 80 |
+
x=update_dataset()
|
| 81 |
+
st.success('{} New tracks were added to the dataset.'.format(x))
|
| 82 |
+
except:
|
| 83 |
+
st.error("The dataset update failed. ")
|
| 84 |
+
with st.spinner('Getting Recommendations...'):
|
| 85 |
+
res,err = playlist_model(st.session_state.p_url,st.session_state.model,st.session_state.genre,st.session_state.artist)
|
| 86 |
+
st.session_state.rs=res
|
| 87 |
+
st.session_state.err=err
|
| 88 |
+
if len(st.session_state.rs)>=1:
|
| 89 |
+
if st.session_state.model == 'ReModel' or st.session_state.model == 'Experimental Model':
|
| 90 |
+
st.success('Go to the Result page to view the top {} recommendations, Thanks for taking the time to use this :D'.format(len(st.session_state.rs)))
|
| 91 |
+
st.success('- RedValis'.format(len(st.session_state.rs)))
|
| 92 |
+
|
| 93 |
+
else:
|
| 94 |
+
st.success('Go to the Result page to view the Spotify recommendations')
|
| 95 |
+
st.success('- RedValis')
|
| 96 |
+
else:
|
| 97 |
+
st.error('Model failed. Check the log for more information.')
|
| 98 |
+
|
| 99 |
+
def art_recomm():
|
| 100 |
+
if 'rs' in st.session_state:
|
| 101 |
+
del st.session_state.rs,st.session_state.err
|
| 102 |
+
with st.spinner('Getting Recommendations...'):
|
| 103 |
+
res,err = top_tracks(st.session_state.a_url,st.session_state.rg)
|
| 104 |
+
st.session_state.rs=res
|
| 105 |
+
st.session_state.err=err
|
| 106 |
+
if len(st.session_state.rs)>=1:
|
| 107 |
+
st.success("Go to the Result page to view the Artist's top tracks, Thank you for taking the time to use this :D")
|
| 108 |
+
st.success("- RedValis")
|
| 109 |
+
else:
|
| 110 |
+
st.error('Model failed. Check the log for more information.')
|
| 111 |
+
|
| 112 |
+
def song_recomm():
|
| 113 |
+
if 'rs' in st.session_state:
|
| 114 |
+
del st.session_state.rs,st.session_state.err
|
| 115 |
+
with st.spinner('Getting Recommendations...'):
|
| 116 |
+
res,err = song_model(st.session_state.s_url,st.session_state.model,st.session_state.genre,st.session_state.artist)
|
| 117 |
+
st.session_state.rs=res
|
| 118 |
+
st.session_state.err=err
|
| 119 |
+
if len(st.session_state.rs)>=1:
|
| 120 |
+
if st.session_state.model == 'ReModel' or st.session_state.model == 'Experimental Model':
|
| 121 |
+
st.success('Go to the Result page to view the top {} recommendations, Thank you for taking the time to use this :D'.format(len(st.session_state.rs)))
|
| 122 |
+
st.success('- RedValis'.format(len(st.session_state.rs)))
|
| 123 |
+
else:
|
| 124 |
+
st.success('Go to the Result page to view the Spotify recommendations')
|
| 125 |
+
st.success('- RedValis')
|
| 126 |
+
else:
|
| 127 |
+
st.error('Model failed. Check the log for more information.')
|
| 128 |
+
|
| 129 |
+
def playlist_page():
|
| 130 |
+
st.subheader("User Playlist")
|
| 131 |
+
st.markdown('---')
|
| 132 |
+
playlist_uri = (st.session_state.playlist_url).split('/')[-1].split('?')[0]
|
| 133 |
+
uri_link = 'https://open.spotify.com/embed/playlist/' + playlist_uri
|
| 134 |
+
components.iframe(uri_link, height=300)
|
| 135 |
+
return
|
| 136 |
+
|
| 137 |
+
def song_page():
|
| 138 |
+
st.subheader("User Song")
|
| 139 |
+
st.markdown('---')
|
| 140 |
+
song_uri = (st.session_state.song_url).split('/')[-1].split('?')[0]
|
| 141 |
+
uri_link = 'https://open.spotify.com/embed/track/' + song_uri
|
| 142 |
+
components.iframe(uri_link, height=100)
|
| 143 |
+
|
| 144 |
+
def artist_page():
|
| 145 |
+
st.subheader("User Artist")
|
| 146 |
+
st.markdown('---')
|
| 147 |
+
artist_uri = (st.session_state.artist_url).split('/')[-1].split('?')[0]
|
| 148 |
+
uri_link = 'https://open.spotify.com/embed/artist/' + artist_uri
|
| 149 |
+
components.iframe(uri_link, height=80)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def spr_sidebar():
|
| 153 |
+
menu=option_menu(
|
| 154 |
+
menu_title=None,
|
| 155 |
+
options=['Home','Result','About','Log'],
|
| 156 |
+
icons=['house','book','info-square','terminal'],
|
| 157 |
+
menu_icon='cast',
|
| 158 |
+
default_index=0,
|
| 159 |
+
orientation='horizontal'
|
| 160 |
+
)
|
| 161 |
+
if menu=='Home':
|
| 162 |
+
st.session_state.app_mode = 'Home'
|
| 163 |
+
elif menu=='Result':
|
| 164 |
+
st.session_state.app_mode = 'Result'
|
| 165 |
+
elif menu=='About':
|
| 166 |
+
st.session_state.app_mode = 'About'
|
| 167 |
+
elif menu=='Log':
|
| 168 |
+
st.session_state.app_mode = 'Log'
|
| 169 |
+
|
| 170 |
+
def home_page():
|
| 171 |
+
st.session_state.radio=st.session_state.feature
|
| 172 |
+
st.session_state.radio2=st.session_state.model
|
| 173 |
+
st.session_state.num_genre=st.session_state.genre
|
| 174 |
+
st.session_state.same_art=st.session_state.artist
|
| 175 |
+
st.session_state.Region=st.session_state.rg
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
st.title('Helical Recommendation System')
|
| 179 |
+
col,col2,col3=st.columns([2,2,3])
|
| 180 |
+
radio=col.radio("Feature",options=("Playlist","Song","Artist Top Tracks"),key='radio',on_change=update_radio0)
|
| 181 |
+
if radio =="Artist Top Tracks":
|
| 182 |
+
radio1=col2.radio("Model",options=["Similarity Model"],key='radio1',on_change=update_radio1)
|
| 183 |
+
Region=col3.selectbox("Please Choose Region",index=58,key='Region',on_change=update_Region,options=('AD', 'AR', 'AU', 'AT', 'BE', 'BO', 'BR', 'BG', 'CA', 'CL', 'CO', 'CR', 'CY', 'CZ', 'DK', 'DO', 'EC', 'SV', 'EE', 'FI', 'FR', 'DE', 'GR', 'GT', 'HN', 'HK', 'HU', 'IS', 'ID', 'IE', 'IT', 'JP', 'LV', 'LI', 'LT', 'LU', 'MY', 'MT', 'MX', 'MC', 'NL', 'NZ', 'NI', 'NO', 'PA', 'PY', 'PE', 'PH', 'PL', 'PT', 'SG', 'ES', 'SK', 'SE', 'CH', 'TW', 'TR', 'GB', 'US', 'UY'))
|
| 184 |
+
elif radio =="Playlist" or radio =="Song" :
|
| 185 |
+
radio2=col2.radio("Model",options=("ReModel","Experimental Model","Similarity Model"),key='radio2',on_change=update_radio2)
|
| 186 |
+
if st.session_state.radio2=="ReModel" or st.session_state.radio2=="Experimental Model":
|
| 187 |
+
num_genre=col3.selectbox("choose a number of genres to focus on",options=(1,2,3,4,5,6,7),index=2,key='num_genre',on_change=update_num_genre)
|
| 188 |
+
same_art=col3.selectbox("How many recommendations by the same artist",options=(1,2,3,4,5,7,10,15),index=3,key='same_art',on_change=update_same_art)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 192 |
+
|
| 193 |
+
if radio == "Playlist" :
|
| 194 |
+
st.session_state.playlist_url = st.session_state.p_url
|
| 195 |
+
Url = st.text_input(label="Playlist Url",key='playlist_url',on_change=update_playlist_url)
|
| 196 |
+
playlist_page()
|
| 197 |
+
state =st.button('Get Recommendations')
|
| 198 |
+
with st.expander("Here's how to find any Playlist URL in Spotify"):
|
| 199 |
+
st.write("""
|
| 200 |
+
- Search for Playlist on the Spotify app
|
| 201 |
+
- Right Click on the Playlist you like
|
| 202 |
+
- Click "Share"
|
| 203 |
+
- Choose "Copy link to playlist"
|
| 204 |
+
""")
|
| 205 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 206 |
+
st.image('spotify_get_playlist_url.png')
|
| 207 |
+
if state:
|
| 208 |
+
play_recomm()
|
| 209 |
+
elif radio == "Song" :
|
| 210 |
+
st.session_state.songname_url = st.session_state.sn_url
|
| 211 |
+
Url_a = st.text_input(label="Type a songs name to get the url for",key='get_url',on_change=update_song_name_url)
|
| 212 |
+
|
| 213 |
+
from spotifysearch.client import Client
|
| 214 |
+
myclient = Client(Client_id, client_secret)
|
| 215 |
+
results = myclient.search(Url_a)
|
| 216 |
+
tracks = results.get_tracks()
|
| 217 |
+
|
| 218 |
+
track = tracks
|
| 219 |
+
|
| 220 |
+
result_length = len(tracks)
|
| 221 |
+
|
| 222 |
+
track_song_list = []
|
| 223 |
+
track_url_list = []
|
| 224 |
+
track_actual_url_list = []
|
| 225 |
+
anotherlist=[]
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
genrec = st.radio(
|
| 229 |
+
"Choose an option to search in:",
|
| 230 |
+
["5x4"])
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
if genrec == "Full":
|
| 234 |
+
|
| 235 |
+
for leupz in range(result_length):
|
| 236 |
+
thetrack = tracks[leupz]
|
| 237 |
+
st.write(thetrack.name)
|
| 238 |
+
name_desu = thetrack.name
|
| 239 |
+
track_song_list.append(name_desu)
|
| 240 |
+
|
| 241 |
+
st.write(thetrack.url)
|
| 242 |
+
urlname_desu = thetrack.name
|
| 243 |
+
track_url_list.append(urlname_desu)
|
| 244 |
+
|
| 245 |
+
song_uri = (thetrack.url).split('/')[-1].split('?')[0]
|
| 246 |
+
uri_link = 'https://open.spotify.com/embed/track/' + song_uri
|
| 247 |
+
components.iframe(uri_link, height=100)
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
st.write(result_length)
|
| 251 |
+
|
| 252 |
+
elif genrec == "5x4":
|
| 253 |
+
for leupz in range(result_length):
|
| 254 |
+
thetrack = tracks[leupz]
|
| 255 |
+
|
| 256 |
+
name_desu = thetrack.name
|
| 257 |
+
track_song_list.append(name_desu)
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
urlname_desu = thetrack.url
|
| 261 |
+
track_url_list.append(urlname_desu)
|
| 262 |
+
|
| 263 |
+
song_uri = (thetrack.url).split('/')[-1].split('?')[0]
|
| 264 |
+
uri_link = 'https://open.spotify.com/embed/track/' + song_uri
|
| 265 |
+
dem = uri_link
|
| 266 |
+
|
| 267 |
+
track_actual_url_list.append(dem)
|
| 268 |
+
notneeded_chkbox = st.checkbox('Click on this to see the results')
|
| 269 |
+
|
| 270 |
+
if notneeded_chkbox:
|
| 271 |
+
########### WARNING: MAY CAUSE SOME TO FAINT :/
|
| 272 |
+
|
| 273 |
+
st.write('Feature activated!')
|
| 274 |
+
|
| 275 |
+
pages = st.radio("Page",["1","2","3","4",], horizontal=True)
|
| 276 |
+
|
| 277 |
+
if pages == "1":
|
| 278 |
+
Le_songs = st.radio(
|
| 279 |
+
"Its time to choose...",
|
| 280 |
+
[track_song_list[0],track_song_list[1],track_song_list[2],track_song_list[3],track_song_list[4]])
|
| 281 |
+
|
| 282 |
+
if Le_songs == track_song_list[0]:
|
| 283 |
+
st.session_state.s_url = track_actual_url_list[0]
|
| 284 |
+
|
| 285 |
+
elif Le_songs == track_song_list[1]:
|
| 286 |
+
st.session_state.s_url = track_actual_url_list[1]
|
| 287 |
+
|
| 288 |
+
elif Le_songs == track_song_list[2]:
|
| 289 |
+
st.session_state.s_url = track_actual_url_list[2]
|
| 290 |
+
|
| 291 |
+
elif Le_songs == track_song_list[3]:
|
| 292 |
+
st.session_state.s_url = track_actual_url_list[3]
|
| 293 |
+
|
| 294 |
+
elif Le_songs == track_song_list[4]:
|
| 295 |
+
st.session_state.s_url = track_actual_url_list[4]
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
st.write('Previews')
|
| 299 |
+
|
| 300 |
+
components.iframe(track_actual_url_list[0], height=100)
|
| 301 |
+
components.iframe(track_actual_url_list[1], height=100)
|
| 302 |
+
components.iframe(track_actual_url_list[2], height=100)
|
| 303 |
+
components.iframe(track_actual_url_list[3], height=100)
|
| 304 |
+
components.iframe(track_actual_url_list[4], height=100)
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
if pages == "2":
|
| 308 |
+
Le_songs = st.radio(
|
| 309 |
+
"Its time to choose...",
|
| 310 |
+
[track_song_list[5],track_song_list[6],track_song_list[7],track_song_list[8],track_song_list[9]])
|
| 311 |
+
if Le_songs == track_song_list[5]:
|
| 312 |
+
st.session_state.s_url = track_actual_url_list[5]
|
| 313 |
+
|
| 314 |
+
elif Le_songs == track_song_list[6]:
|
| 315 |
+
st.session_state.s_url = track_actual_url_list[6]
|
| 316 |
+
|
| 317 |
+
elif Le_songs == track_song_list[7]:
|
| 318 |
+
st.session_state.s_url = track_actual_url_list[7]
|
| 319 |
+
|
| 320 |
+
elif Le_songs == track_song_list[8]:
|
| 321 |
+
st.session_state.s_url = track_actual_url_list[8]
|
| 322 |
+
|
| 323 |
+
elif Le_songs == track_song_list[9]:
|
| 324 |
+
st.session_state.s_url = track_actual_url_list[9]
|
| 325 |
+
|
| 326 |
+
st.write('Previews')
|
| 327 |
+
|
| 328 |
+
components.iframe(track_actual_url_list[5], height=100)
|
| 329 |
+
components.iframe(track_actual_url_list[6], height=100)
|
| 330 |
+
components.iframe(track_actual_url_list[7], height=100)
|
| 331 |
+
components.iframe(track_actual_url_list[8], height=100)
|
| 332 |
+
components.iframe(track_actual_url_list[9], height=100)
|
| 333 |
+
if pages == "3":
|
| 334 |
+
Le_songs = st.radio(
|
| 335 |
+
"Its time to choose...",
|
| 336 |
+
[track_song_list[10],track_song_list[11],track_song_list[12],track_song_list[13],track_song_list[14]])
|
| 337 |
+
|
| 338 |
+
if Le_songs == track_song_list[10]:
|
| 339 |
+
st.session_state.s_url = track_actual_url_list[10]
|
| 340 |
+
|
| 341 |
+
elif Le_songs == track_song_list[11]:
|
| 342 |
+
st.session_state.s_url = track_actual_url_list[11]
|
| 343 |
+
|
| 344 |
+
elif Le_songs == track_song_list[12]:
|
| 345 |
+
st.session_state.s_url = track_actual_url_list[12]
|
| 346 |
+
|
| 347 |
+
elif Le_songs == track_song_list[13]:
|
| 348 |
+
st.session_state.s_url = track_actual_url_list[13]
|
| 349 |
+
|
| 350 |
+
elif Le_songs == track_song_list[14]:
|
| 351 |
+
st.session_state.s_url = track_actual_url_list[14]
|
| 352 |
+
|
| 353 |
+
st.write('Previews')
|
| 354 |
+
|
| 355 |
+
components.iframe(track_actual_url_list[10], height=100)
|
| 356 |
+
components.iframe(track_actual_url_list[11], height=100)
|
| 357 |
+
components.iframe(track_actual_url_list[12], height=100)
|
| 358 |
+
components.iframe(track_actual_url_list[13], height=100)
|
| 359 |
+
components.iframe(track_actual_url_list[14], height=100)
|
| 360 |
+
if pages == "4":
|
| 361 |
+
Le_songs = st.radio(
|
| 362 |
+
"Its time to choose...",
|
| 363 |
+
[track_song_list[15],track_song_list[16],track_song_list[17],track_song_list[18],track_song_list[19]])
|
| 364 |
+
|
| 365 |
+
if Le_songs == track_song_list[15]:
|
| 366 |
+
st.session_state.s_url = track_actual_url_list[15]
|
| 367 |
+
|
| 368 |
+
elif Le_songs == track_song_list[16]:
|
| 369 |
+
st.session_state.s_url = track_actual_url_list[16]
|
| 370 |
+
|
| 371 |
+
elif Le_songs == track_song_list[17]:
|
| 372 |
+
st.session_state.s_url = track_actual_url_list[17]
|
| 373 |
+
|
| 374 |
+
elif Le_songs == track_song_list[18]:
|
| 375 |
+
st.session_state.s_url = track_actual_url_list[18]
|
| 376 |
+
|
| 377 |
+
elif Le_songs == track_song_list[19]:
|
| 378 |
+
st.session_state.s_url = track_actual_url_list[19]
|
| 379 |
+
|
| 380 |
+
st.write('Previews')
|
| 381 |
+
|
| 382 |
+
components.iframe(track_actual_url_list[15], height=100)
|
| 383 |
+
components.iframe(track_actual_url_list[16], height=100)
|
| 384 |
+
components.iframe(track_actual_url_list[17], height=100)
|
| 385 |
+
components.iframe(track_actual_url_list[18], height=100)
|
| 386 |
+
components.iframe(track_actual_url_list[19], height=100)
|
| 387 |
+
|
| 388 |
+
else:
|
| 389 |
+
st.write("""If you have clicked on an option, click on "Get recommendations" button to get recommendations""")
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
st.write(result_length)
|
| 393 |
+
|
| 394 |
+
st.session_state.song_url = st.session_state.s_url
|
| 395 |
+
Url = st.text_input(label="Song Url ",key='song_url',on_change=update_song_url)
|
| 396 |
+
|
| 397 |
+
song_page()
|
| 398 |
+
state =st.button('Get Recommendations')
|
| 399 |
+
with st.expander("Here's how to find any Song URL in Spotify"):
|
| 400 |
+
st.write("""
|
| 401 |
+
- Search for Song on the Spotify app
|
| 402 |
+
- Right Click on the Song you like
|
| 403 |
+
- Click "Share"
|
| 404 |
+
- Choose "Copy link to Song"
|
| 405 |
+
""")
|
| 406 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 407 |
+
st.image('spotify_get_song_url.png')
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
if state:
|
| 411 |
+
song_recomm()
|
| 412 |
+
elif radio == "Artist Top Tracks" :
|
| 413 |
+
st.session_state.artist_url = st.session_state.a_url
|
| 414 |
+
Url = st.text_input(label="Artist Url",key='artist_url',on_change=update_artist_url)
|
| 415 |
+
artist_page()
|
| 416 |
+
state =st.button('Get Recommendations')
|
| 417 |
+
with st.expander("Here's how to find any Artist URL in Spotify"):
|
| 418 |
+
st.write("""
|
| 419 |
+
- Search for Artist on the Spotify app
|
| 420 |
+
- Right Click on the Artist you like
|
| 421 |
+
- Click "Share"
|
| 422 |
+
- Choose "Copy link to Artist"
|
| 423 |
+
""")
|
| 424 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 425 |
+
st.image('spotify_get_artist_url.png')
|
| 426 |
+
if state:
|
| 427 |
+
art_recomm()
|
| 428 |
+
|
| 429 |
+
def result_page():
|
| 430 |
+
if 'rs' not in st.session_state:
|
| 431 |
+
st.error('Please select a model on the Home page and run Get Recommendations')
|
| 432 |
+
else:
|
| 433 |
+
st.success('Top {} recommendations'.format(len(st.session_state.rs)))
|
| 434 |
+
i=0
|
| 435 |
+
for uri in st.session_state.rs:
|
| 436 |
+
uri_link = "https://open.spotify.com/embed/track/" + uri + "?utm_source=generator&theme=0"
|
| 437 |
+
components.iframe(uri_link, height=80)
|
| 438 |
+
i+=1
|
| 439 |
+
if i%5==0:
|
| 440 |
+
time.sleep(1)
|
| 441 |
+
def Log_page():
|
| 442 |
+
log=st.checkbox('Display Output', True, key='display_output')
|
| 443 |
+
if log == True:
|
| 444 |
+
if 'err' in st.session_state:
|
| 445 |
+
st.write(st.session_state.err)
|
| 446 |
+
with open('Data/streamlit.csv') as f:
|
| 447 |
+
st.download_button('Download Dataset', f,file_name='streamlit.csv')
|
| 448 |
+
def About_page():
|
| 449 |
+
st.header('Development')
|
| 450 |
+
"""
|
| 451 |
+
Made by RedValis
|
| 452 |
+
Massive thanks to ruby "AbdelRahman" skies from github for code snippets that helped in the creation of our project
|
| 453 |
+
"""
|
| 454 |
+
st.subheader('Spotify Million Playlist Dataset')
|
| 455 |
+
"""
|
| 456 |
+
We're using the Million Playlist Dataset, which, as its name implies, consists of one million playlists.
|
| 457 |
+
contains a number of songs, and some metadata is included as well, such as the name of the playlist, duration, number of songs, number of artists, etc.
|
| 458 |
+
This allows for a great accuracy score and a larger number of songs scored according to how people organize their public playlists
|
| 459 |
+
"""
|
| 460 |
+
|
| 461 |
+
"""
|
| 462 |
+
It is created by sampling playlists from the billions of playlists that Spotify users have created over the years.
|
| 463 |
+
Playlists that meet the following criteria were selected at random:
|
| 464 |
+
- Created by a user that resides in the United States and is at least 13 years old
|
| 465 |
+
- Was a public playlist at the time the MPD was generated
|
| 466 |
+
- Contains at least 10 tracks
|
| 467 |
+
- Contains no more than 300 tracks
|
| 468 |
+
- Contains at least 3 unique artists
|
| 469 |
+
- Contains at least 2 unique albums
|
| 470 |
+
- Has no local tracks (local tracks are non-Spotify tracks that a user has on their local device
|
| 471 |
+
- Has at least one follower (not including the creator
|
| 472 |
+
- Was created after January 1, 2010 and before December 1, 2020
|
| 473 |
+
- Does not have an offensive title
|
| 474 |
+
- Does not have an adult-oriented title if the playlist was created by a user under 18 years of age
|
| 475 |
+
Information about the Dataset [here](https://www.aicrowd.com/challenges/spotify-million-playlist-dataset-challenge)
|
| 476 |
+
"""
|
| 477 |
+
st.subheader('Audio Features Explanation')
|
| 478 |
+
"""
|
| 479 |
+
This is the list of audio features that we use to determine the similarity between songs.
|
| 480 |
+
For anyone who would like to inspect the source code
|
| 481 |
+
|
| 482 |
+
| Variable | Description |
|
| 483 |
+
| :----: | :---: |
|
| 484 |
+
| Acousticness | A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic. |
|
| 485 |
+
| Danceability | Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable. |
|
| 486 |
+
| Energy | Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy. |
|
| 487 |
+
| Instrumentalness | Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly "vocal". The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0. |
|
| 488 |
+
| Key | The key the track is in. Integers map to pitches using standard Pitch Class notation. E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1. |
|
| 489 |
+
| Liveness | Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live. |
|
| 490 |
+
| Loudness | The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typically range between -60 and 0 db. |
|
| 491 |
+
| Mode | Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0. |
|
| 492 |
+
| Speechiness | Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks. |
|
| 493 |
+
| Tempo | The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration. |
|
| 494 |
+
| Time Signature | An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4". |
|
| 495 |
+
| Valence | A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry). |
|
| 496 |
+
|
| 497 |
+
Information about features: [here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-audio-features)
|
| 498 |
+
"""
|
| 499 |
+
|
| 500 |
+
def main():
|
| 501 |
+
spr_sidebar()
|
| 502 |
+
if st.session_state.app_mode == 'Home':
|
| 503 |
+
home_page()
|
| 504 |
+
if st.session_state.app_mode == 'Result':
|
| 505 |
+
result_page()
|
| 506 |
+
if st.session_state.app_mode == 'About' :
|
| 507 |
+
About_page()
|
| 508 |
+
if st.session_state.app_mode == 'Log':
|
| 509 |
+
Log_page()
|
| 510 |
+
# Run main()
|
| 511 |
+
#if __name__ == '__main__': this doesnt allow reletive imports >:()
|
| 512 |
+
main()
|
model.py
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import spotipy
|
| 3 |
+
from spotipy.oauth2 import SpotifyOAuth, SpotifyClientCredentials
|
| 4 |
+
import yaml
|
| 5 |
+
import re
|
| 6 |
+
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 7 |
+
from sklearn.metrics.pairwise import cosine_similarity
|
| 8 |
+
from sklearn.preprocessing import MinMaxScaler
|
| 9 |
+
import pickle
|
| 10 |
+
import streamlit as st
|
| 11 |
+
import os
|
| 12 |
+
|
| 13 |
+
def playlist_model(url, model, max_gen=3, same_art=5):
|
| 14 |
+
log = []
|
| 15 |
+
Fresult = []
|
| 16 |
+
try:
|
| 17 |
+
log.append('Start logging')
|
| 18 |
+
uri = url.split('/')[-1].split('?')[0]
|
| 19 |
+
try:
|
| 20 |
+
log.append('spotify local method')
|
| 21 |
+
stream = open("Spotify/Spotify.yaml")
|
| 22 |
+
spotify_details = yaml.safe_load(stream)
|
| 23 |
+
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
| 24 |
+
except:
|
| 25 |
+
log.append('spotify .streamlit method')
|
| 26 |
+
try:
|
| 27 |
+
Client_id=st.secrets["Client_ID"]
|
| 28 |
+
client_secret=st.secrets["Client_secret"]
|
| 29 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 30 |
+
except:
|
| 31 |
+
log.append('spotify hug method')
|
| 32 |
+
Client_id=os.environ['Client_ID']
|
| 33 |
+
client_secret=os.environ['Client_secret']
|
| 34 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 35 |
+
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 36 |
+
|
| 37 |
+
if model == 'Similarity Model':
|
| 38 |
+
def get_IDs(user, playlist_id):
|
| 39 |
+
try:
|
| 40 |
+
log.append('start playlist extraction')
|
| 41 |
+
track_ids = []
|
| 42 |
+
playlist = sp.user_playlist(user, playlist_id)
|
| 43 |
+
for item in playlist['tracks']['items']:
|
| 44 |
+
track = item['track']
|
| 45 |
+
track_ids.append(track['id'])
|
| 46 |
+
return track_ids
|
| 47 |
+
except Exception as e:
|
| 48 |
+
log.append('Failed to load the playlist')
|
| 49 |
+
log.append(e)
|
| 50 |
+
|
| 51 |
+
track_ids = get_IDs('Ruby', uri)
|
| 52 |
+
track_ids_uni = list(set(track_ids))
|
| 53 |
+
log.append('Starting Similarity Model')
|
| 54 |
+
Spotifyresult = pd.DataFrame()
|
| 55 |
+
for i in range(len(track_ids_uni)-5):
|
| 56 |
+
if len(Spotifyresult) >= 50:
|
| 57 |
+
break
|
| 58 |
+
try:
|
| 59 |
+
ff = sp.recommendations(seed_tracks=list(track_ids_uni[i:i+5]), limit=5)
|
| 60 |
+
except Exception as e:
|
| 61 |
+
log.append(e)
|
| 62 |
+
continue
|
| 63 |
+
for z in range(5):
|
| 64 |
+
result = pd.DataFrame([z+(5*i)+1])
|
| 65 |
+
result['uri'] = ff['tracks'][z]['id']
|
| 66 |
+
Spotifyresult = pd.concat([Spotifyresult, result], axis=0)
|
| 67 |
+
Spotifyresult.drop_duplicates(subset=['uri'], inplace=True,keep='first')
|
| 68 |
+
Fresult = Spotifyresult.uri[:50]
|
| 69 |
+
|
| 70 |
+
log.append('Model run successfully')
|
| 71 |
+
return Fresult, log
|
| 72 |
+
|
| 73 |
+
lendf=len(pd.read_csv('Data/streamlit.csv',usecols=['track_uri']))
|
| 74 |
+
dtypes = {'track_uri': 'object', 'artist_uri': 'object', 'album_uri': 'object', 'danceability': 'float16', 'energy': 'float16', 'key': 'float16',
|
| 75 |
+
'loudness': 'float16', 'mode': 'float16', 'speechiness': 'float16', 'acousticness': 'float16', 'instrumentalness': 'float16',
|
| 76 |
+
'liveness': 'float16', 'valence': 'float16', 'tempo': 'float16', 'duration_ms': 'float32', 'time_signature': 'float16',
|
| 77 |
+
'Track_release_date': 'int8', 'Track_pop': 'int8', 'Artist_pop': 'int8', 'Artist_genres': 'object'}
|
| 78 |
+
col_name= ['track_uri', 'artist_uri', 'album_uri', 'danceability', 'energy', 'key',
|
| 79 |
+
'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness',
|
| 80 |
+
'liveness', 'valence', 'tempo', 'duration_ms', 'time_signature',
|
| 81 |
+
'Track_release_date', 'Track_pop', 'Artist_pop', 'Artist_genres']
|
| 82 |
+
|
| 83 |
+
try:
|
| 84 |
+
def get_IDs(user, playlist_id):
|
| 85 |
+
log.append('start playlist extraction')
|
| 86 |
+
track_ids = []
|
| 87 |
+
artist_id = []
|
| 88 |
+
playlist = sp.user_playlist(user, playlist_id)
|
| 89 |
+
for item in playlist['tracks']['items']:
|
| 90 |
+
track = item['track']
|
| 91 |
+
track_ids.append(track['id'])
|
| 92 |
+
artist = item['track']['artists']
|
| 93 |
+
artist_id.append(artist[0]['id'])
|
| 94 |
+
return track_ids, artist_id
|
| 95 |
+
except Exception as e:
|
| 96 |
+
log.append('Failed to load the playlist')
|
| 97 |
+
log.append(e)
|
| 98 |
+
|
| 99 |
+
track_ids, artist_id = get_IDs('Ruby', uri)
|
| 100 |
+
log.append("Number of Track : {}".format(len(track_ids)))
|
| 101 |
+
|
| 102 |
+
artist_id_uni = list(set(artist_id))
|
| 103 |
+
track_ids_uni = list(set(track_ids))
|
| 104 |
+
log.append("Number of unique Artists : {}".format(len(artist_id_uni)))
|
| 105 |
+
log.append("Number of unique Tracks : {}".format(len(track_ids_uni)))
|
| 106 |
+
|
| 107 |
+
def extract(track_ids_uni, artist_id_uni):
|
| 108 |
+
err = []
|
| 109 |
+
err.append('Start audio features extraction')
|
| 110 |
+
audio_features = pd.DataFrame()
|
| 111 |
+
for i in range(0, len(track_ids_uni), 25):
|
| 112 |
+
try:
|
| 113 |
+
track_feature = sp.audio_features(track_ids_uni[i:i+25])
|
| 114 |
+
track_df = pd.DataFrame(track_feature)
|
| 115 |
+
audio_features = pd.concat([audio_features, track_df], axis=0)
|
| 116 |
+
except Exception as e:
|
| 117 |
+
err.append(e)
|
| 118 |
+
continue
|
| 119 |
+
err.append('Start track features extraction')
|
| 120 |
+
track_ = pd.DataFrame()
|
| 121 |
+
for i in range(0, len(track_ids_uni), 25):
|
| 122 |
+
try:
|
| 123 |
+
track_features = sp.tracks(track_ids_uni[i:i+25])
|
| 124 |
+
for x in range(25):
|
| 125 |
+
track_pop = pd.DataFrame([track_ids_uni[i+x]], columns=['Track_uri'])
|
| 126 |
+
track_pop['Track_release_date'] = track_features['tracks'][x]['album']['release_date']
|
| 127 |
+
track_pop['Track_pop'] = track_features['tracks'][x]["popularity"]
|
| 128 |
+
track_pop['Artist_uri'] = track_features['tracks'][x]['artists'][0]['id']
|
| 129 |
+
track_pop['Album_uri'] = track_features['tracks'][x]['album']['id']
|
| 130 |
+
track_ = pd.concat([track_, track_pop], axis=0)
|
| 131 |
+
except Exception as e:
|
| 132 |
+
err.append(e)
|
| 133 |
+
continue
|
| 134 |
+
err.append('Start artist features extraction')
|
| 135 |
+
artist_ = pd.DataFrame()
|
| 136 |
+
for i in range(0, len(artist_id_uni), 25):
|
| 137 |
+
try:
|
| 138 |
+
artist_features = sp.artists(artist_id_uni[i:i+25])
|
| 139 |
+
for x in range(25):
|
| 140 |
+
artist_df = pd.DataFrame([artist_id_uni[i+x]], columns=['Artist_uri'])
|
| 141 |
+
artist_pop = artist_features['artists'][x]["popularity"]
|
| 142 |
+
artist_genres = artist_features['artists'][x]["genres"]
|
| 143 |
+
artist_df["Artist_pop"] = artist_pop
|
| 144 |
+
if artist_genres:
|
| 145 |
+
artist_df["genres"] = " ".join([re.sub(' ', '_', i) for i in artist_genres])
|
| 146 |
+
else:
|
| 147 |
+
artist_df["genres"] = "unknown"
|
| 148 |
+
artist_ = pd.concat([artist_, artist_df], axis=0)
|
| 149 |
+
except Exception as e:
|
| 150 |
+
err.append(e)
|
| 151 |
+
continue
|
| 152 |
+
try:
|
| 153 |
+
test = pd.DataFrame(
|
| 154 |
+
track_, columns=['Track_uri', 'Artist_uri', 'Album_uri'])
|
| 155 |
+
|
| 156 |
+
test.rename(columns={'Track_uri': 'track_uri',
|
| 157 |
+
'Artist_uri': 'artist_uri', 'Album_uri': 'album_uri'}, inplace=True)
|
| 158 |
+
|
| 159 |
+
audio_features.drop(
|
| 160 |
+
columns=['type', 'uri', 'track_href', 'analysis_url'], axis=1, inplace=True)
|
| 161 |
+
|
| 162 |
+
test = pd.merge(test, audio_features,
|
| 163 |
+
left_on="track_uri", right_on="id", how='outer')
|
| 164 |
+
test = pd.merge(test, track_, left_on="track_uri",
|
| 165 |
+
right_on="Track_uri", how='outer')
|
| 166 |
+
test = pd.merge(test, artist_, left_on="artist_uri",
|
| 167 |
+
right_on="Artist_uri", how='outer')
|
| 168 |
+
|
| 169 |
+
test.rename(columns={'genres': 'Artist_genres'}, inplace=True)
|
| 170 |
+
|
| 171 |
+
test.drop(columns=['Track_uri', 'Artist_uri_x',
|
| 172 |
+
'Artist_uri_y', 'Album_uri', 'id'], axis=1, inplace=True)
|
| 173 |
+
|
| 174 |
+
test.dropna(axis=0, inplace=True)
|
| 175 |
+
test['Track_pop'] = test['Track_pop'].apply(lambda x: int(x/5))
|
| 176 |
+
test['Artist_pop'] = test['Artist_pop'].apply(lambda x: int(x/5))
|
| 177 |
+
test['Track_release_date'] = test['Track_release_date'].apply(lambda x: x.split('-')[0])
|
| 178 |
+
test['Track_release_date'] = test['Track_release_date'].astype('int16')
|
| 179 |
+
test['Track_release_date'] = test['Track_release_date'].apply(lambda x: int(x/50))
|
| 180 |
+
|
| 181 |
+
test[['danceability', 'energy', 'key', 'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness', 'liveness', 'valence', 'tempo', 'time_signature']] = test[[
|
| 182 |
+
'danceability', 'energy', 'key', 'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness', 'liveness', 'valence', 'tempo', 'time_signature']].astype('float16')
|
| 183 |
+
test[['duration_ms']] = test[['duration_ms']].astype('float32')
|
| 184 |
+
test[['Track_release_date', 'Track_pop', 'Artist_pop']] = test[[
|
| 185 |
+
'Track_release_date', 'Track_pop', 'Artist_pop']].astype('int8')
|
| 186 |
+
except Exception as e:
|
| 187 |
+
err.append(e)
|
| 188 |
+
err.append('Finish extraction')
|
| 189 |
+
return test, err
|
| 190 |
+
test, err = extract(track_ids_uni, artist_id_uni)
|
| 191 |
+
|
| 192 |
+
for i in err:
|
| 193 |
+
log.append(i)
|
| 194 |
+
del err
|
| 195 |
+
grow = test.copy()
|
| 196 |
+
test['Artist_genres'] = test['Artist_genres'].apply(lambda x: x.split(" "))
|
| 197 |
+
tfidf = TfidfVectorizer(max_features=max_gen)
|
| 198 |
+
tfidf_matrix = tfidf.fit_transform(test['Artist_genres'].apply(lambda x: " ".join(x)))
|
| 199 |
+
genre_df = pd.DataFrame(tfidf_matrix.toarray())
|
| 200 |
+
genre_df.columns = ['genre' + "|" +i for i in tfidf.get_feature_names_out()]
|
| 201 |
+
genre_df = genre_df.astype('float16')
|
| 202 |
+
test.drop(columns=['Artist_genres'], axis=1, inplace=True)
|
| 203 |
+
test = pd.concat([test.reset_index(drop=True),genre_df.reset_index(drop=True)], axis=1)
|
| 204 |
+
Fresult = pd.DataFrame()
|
| 205 |
+
x = 1
|
| 206 |
+
for i in range(int(lendf/2), lendf+1, int(lendf/2)):
|
| 207 |
+
try:
|
| 208 |
+
df = pd.read_csv('Data/streamlit.csv',names= col_name,dtype=dtypes,skiprows=x,nrows=i)
|
| 209 |
+
log.append('reading data frame chunks from {} to {}'.format(x,i))
|
| 210 |
+
except Exception as e:
|
| 211 |
+
log.append('Failed to load grow')
|
| 212 |
+
log.append(e)
|
| 213 |
+
grow = grow[~grow['track_uri'].isin(df['track_uri'].values)]
|
| 214 |
+
df = df[~df['track_uri'].isin(test['track_uri'].values)]
|
| 215 |
+
df['Artist_genres'] = df['Artist_genres'].apply(lambda x: x.split(" "))
|
| 216 |
+
tfidf_matrix = tfidf.transform(df['Artist_genres'].apply(lambda x: " ".join(x)))
|
| 217 |
+
genre_df = pd.DataFrame(tfidf_matrix.toarray())
|
| 218 |
+
genre_df.columns = ['genre' + "|" +i for i in tfidf.get_feature_names_out()]
|
| 219 |
+
genre_df = genre_df.astype('float16')
|
| 220 |
+
df.drop(columns=['Artist_genres'], axis=1, inplace=True)
|
| 221 |
+
df = pd.concat([df.reset_index(drop=True),
|
| 222 |
+
genre_df.reset_index(drop=True)], axis=1)
|
| 223 |
+
del genre_df
|
| 224 |
+
try:
|
| 225 |
+
df.drop(columns=['genre|unknown'], axis=1, inplace=True)
|
| 226 |
+
test.drop(columns=['genre|unknown'], axis=1, inplace=True)
|
| 227 |
+
except:
|
| 228 |
+
log.append('genre|unknown not found')
|
| 229 |
+
log.append('Scaling the data .....')
|
| 230 |
+
if x == 1:
|
| 231 |
+
sc = pickle.load(open('Data/sc.sav','rb'))
|
| 232 |
+
df.iloc[:, 3:19] = sc.transform(df.iloc[:, 3:19])
|
| 233 |
+
test.iloc[:, 3:19] = sc.transform(test.iloc[:, 3:19])
|
| 234 |
+
log.append("Creating playlist vector")
|
| 235 |
+
playvec = pd.DataFrame(test.sum(axis=0)).T
|
| 236 |
+
else:
|
| 237 |
+
df.iloc[:, 3:19] = sc.transform(df.iloc[:, 3:19])
|
| 238 |
+
x = i
|
| 239 |
+
if model == 'ReModel':
|
| 240 |
+
df['sim']=cosine_similarity(df.drop(['track_uri', 'artist_uri', 'album_uri'], axis = 1),playvec.drop(['track_uri', 'artist_uri', 'album_uri'], axis = 1))
|
| 241 |
+
df['sim2']=cosine_similarity(df.iloc[:,16:-1],playvec.iloc[:,16:])
|
| 242 |
+
df['sim3']=cosine_similarity(df.iloc[:,19:-2],playvec.iloc[:,19:])
|
| 243 |
+
df = df.sort_values(['sim3','sim2','sim'],ascending = False,kind='stable').groupby('artist_uri').head(same_art).head(50)
|
| 244 |
+
Fresult = pd.concat([Fresult, df], axis=0)
|
| 245 |
+
Fresult = Fresult.sort_values(['sim3', 'sim2', 'sim'],ascending=False,kind='stable')
|
| 246 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 247 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).head(50)
|
| 248 |
+
elif model == 'Experimental Model':
|
| 249 |
+
df['sim'] = cosine_similarity(df.iloc[:, 3:16], playvec.iloc[:, 3:16])
|
| 250 |
+
df['sim2'] = cosine_similarity(df.loc[:, df.columns.str.startswith('T') | df.columns.str.startswith('A')], playvec.loc[:, playvec.columns.str.startswith('T') | playvec.columns.str.startswith('A')])
|
| 251 |
+
df['sim3'] = cosine_similarity(df.loc[:, df.columns.str.startswith('genre')], playvec.loc[:, playvec.columns.str.startswith('genre')])
|
| 252 |
+
df['sim4'] = (df['sim']+df['sim2']+df['sim3'])/3
|
| 253 |
+
df = df.sort_values(['sim4'], ascending=False,kind='stable').groupby('artist_uri').head(same_art).head(50)
|
| 254 |
+
Fresult = pd.concat([Fresult, df], axis=0)
|
| 255 |
+
Fresult = Fresult.sort_values(['sim4'], ascending=False,kind='stable')
|
| 256 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 257 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).head(50)
|
| 258 |
+
del test
|
| 259 |
+
try:
|
| 260 |
+
del df
|
| 261 |
+
log.append('Getting Result')
|
| 262 |
+
except:
|
| 263 |
+
log.append('Getting Result')
|
| 264 |
+
if model == 'ReModel':
|
| 265 |
+
Fresult = Fresult.sort_values(['sim3', 'sim2', 'sim'],ascending=False,kind='stable')
|
| 266 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 267 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).track_uri.head(50)
|
| 268 |
+
elif model == 'Experimental Model':
|
| 269 |
+
Fresult = Fresult.sort_values(['sim4'], ascending=False,kind='stable')
|
| 270 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 271 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).track_uri.head(50)
|
| 272 |
+
log.append('{} New Tracks Found'.format(len(grow)))
|
| 273 |
+
if(len(grow)>=1):
|
| 274 |
+
try:
|
| 275 |
+
new=pd.read_csv('Data/new_tracks.csv',dtype=dtypes)
|
| 276 |
+
new=pd.concat([new, grow], axis=0)
|
| 277 |
+
new=new[new.Track_pop >0]
|
| 278 |
+
new.drop_duplicates(subset=['track_uri'], inplace=True,keep='last')
|
| 279 |
+
new.to_csv('Data/new_tracks.csv',index=False)
|
| 280 |
+
except:
|
| 281 |
+
grow.to_csv('Data/new_tracks.csv', index=False)
|
| 282 |
+
log.append('Model run successfully')
|
| 283 |
+
except Exception as e:
|
| 284 |
+
log.append("Model Failed")
|
| 285 |
+
log.append(e)
|
| 286 |
+
return Fresult, log
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def top_tracks(url,region):
|
| 291 |
+
log = []
|
| 292 |
+
Fresult = []
|
| 293 |
+
uri = url.split('/')[-1].split('?')[0]
|
| 294 |
+
try:
|
| 295 |
+
log.append('spotify local method')
|
| 296 |
+
stream = open("Spotify/Spotify.yaml")
|
| 297 |
+
spotify_details = yaml.safe_load(stream)
|
| 298 |
+
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
| 299 |
+
except:
|
| 300 |
+
log.append('spotify .streamlit method')
|
| 301 |
+
try:
|
| 302 |
+
Client_id=st.secrets["Client_ID"]
|
| 303 |
+
client_secret=st.secrets["Client_secret"]
|
| 304 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 305 |
+
except:
|
| 306 |
+
log.append('spotify hug method')
|
| 307 |
+
Client_id=os.environ['Client_ID']
|
| 308 |
+
client_secret=os.environ['Client_secret']
|
| 309 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 310 |
+
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 311 |
+
try:
|
| 312 |
+
log.append('Starting Similarity Model')
|
| 313 |
+
top=sp.artist_top_tracks(uri,country=region)
|
| 314 |
+
for i in range(10) :
|
| 315 |
+
Fresult.append(top['tracks'][i]['id'])
|
| 316 |
+
log.append('Model run successfully')
|
| 317 |
+
except Exception as e:
|
| 318 |
+
log.append("Model Failed")
|
| 319 |
+
log.append(e)
|
| 320 |
+
return Fresult,log
|
| 321 |
+
|
| 322 |
+
def song_model(url, model, max_gen=3, same_art=5):
|
| 323 |
+
log = []
|
| 324 |
+
Fresult = []
|
| 325 |
+
try:
|
| 326 |
+
log.append('Start logging')
|
| 327 |
+
uri = url.split('/')[-1].split('?')[0]
|
| 328 |
+
try:
|
| 329 |
+
log.append('spotify local method')
|
| 330 |
+
stream = open("Spotify/Spotify.yaml")
|
| 331 |
+
spotify_details = yaml.safe_load(stream)
|
| 332 |
+
auth_manager = SpotifyClientCredentials(client_id=spotify_details['Client_id'], client_secret=spotify_details['client_secret'])
|
| 333 |
+
except:
|
| 334 |
+
log.append('spotify .streamlit method')
|
| 335 |
+
try:
|
| 336 |
+
Client_id=st.secrets["Client_ID"]
|
| 337 |
+
client_secret=st.secrets["Client_secret"]
|
| 338 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 339 |
+
except:
|
| 340 |
+
log.append('spotify hug method')
|
| 341 |
+
Client_id=os.environ['Client_ID']
|
| 342 |
+
client_secret=os.environ['Client_secret']
|
| 343 |
+
auth_manager = SpotifyClientCredentials(client_id=Client_id, client_secret=client_secret)
|
| 344 |
+
sp = spotipy.client.Spotify(auth_manager=auth_manager)
|
| 345 |
+
|
| 346 |
+
if model == 'Similarity Model':
|
| 347 |
+
log.append('Starting Similarity Model')
|
| 348 |
+
aa=sp.recommendations(seed_tracks=[uri], limit=25)
|
| 349 |
+
for i in range(25):
|
| 350 |
+
Fresult.append(aa['tracks'][i]['id'])
|
| 351 |
+
log.append('Model run successfully')
|
| 352 |
+
return Fresult, log
|
| 353 |
+
lendf=len(pd.read_csv('Data/streamlit.csv',usecols=['track_uri']))
|
| 354 |
+
dtypes = {'track_uri': 'object', 'artist_uri': 'object', 'album_uri': 'object', 'danceability': 'float16', 'energy': 'float16', 'key': 'float16',
|
| 355 |
+
'loudness': 'float16', 'mode': 'float16', 'speechiness': 'float16', 'acousticness': 'float16', 'instrumentalness': 'float16',
|
| 356 |
+
'liveness': 'float16', 'valence': 'float16', 'tempo': 'float16', 'duration_ms': 'float32', 'time_signature': 'float16',
|
| 357 |
+
'Track_release_date': 'int8', 'Track_pop': 'int8', 'Artist_pop': 'int8', 'Artist_genres': 'object'}
|
| 358 |
+
col_name= ['track_uri', 'artist_uri', 'album_uri', 'danceability', 'energy', 'key',
|
| 359 |
+
'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness',
|
| 360 |
+
'liveness', 'valence', 'tempo', 'duration_ms', 'time_signature',
|
| 361 |
+
'Track_release_date', 'Track_pop', 'Artist_pop', 'Artist_genres']
|
| 362 |
+
log.append('Start audio features extraction')
|
| 363 |
+
audio_features = pd.DataFrame(sp.audio_features([uri]))
|
| 364 |
+
log.append('Start track features extraction')
|
| 365 |
+
track_ = pd.DataFrame()
|
| 366 |
+
track_features = sp.tracks([uri])
|
| 367 |
+
track_pop = pd.DataFrame([uri], columns=['Track_uri'])
|
| 368 |
+
track_pop['Track_release_date'] = track_features['tracks'][0]['album']['release_date']
|
| 369 |
+
track_pop['Track_pop'] = track_features['tracks'][0]["popularity"]
|
| 370 |
+
track_pop['Artist_uri'] = track_features['tracks'][0]['artists'][0]['id']
|
| 371 |
+
track_pop['Album_uri'] = track_features['tracks'][0]['album']['id']
|
| 372 |
+
track_ = pd.concat([track_, track_pop], axis=0)
|
| 373 |
+
log.append('Start artist features extraction')
|
| 374 |
+
artist_id_uni=list(track_['Artist_uri'])
|
| 375 |
+
artist_ = pd.DataFrame()
|
| 376 |
+
artist_features = sp.artists(artist_id_uni)
|
| 377 |
+
artist_df = pd.DataFrame(artist_id_uni, columns=['Artist_uri'])
|
| 378 |
+
artist_pop = artist_features['artists'][0]["popularity"]
|
| 379 |
+
artist_genres = artist_features['artists'][0]["genres"]
|
| 380 |
+
artist_df["Artist_pop"] = artist_pop
|
| 381 |
+
if artist_genres:
|
| 382 |
+
artist_df["genres"] = " ".join([re.sub(' ', '_', i) for i in artist_genres])
|
| 383 |
+
else:
|
| 384 |
+
artist_df["genres"] = "unknown"
|
| 385 |
+
artist_ = pd.concat([artist_, artist_df], axis=0)
|
| 386 |
+
try:
|
| 387 |
+
test = pd.DataFrame(track_, columns=['Track_uri', 'Artist_uri', 'Album_uri'])
|
| 388 |
+
test.rename(columns={'Track_uri': 'track_uri','Artist_uri': 'artist_uri', 'Album_uri': 'album_uri'}, inplace=True)
|
| 389 |
+
audio_features.drop(columns=['type', 'uri', 'track_href', 'analysis_url'], axis=1, inplace=True)
|
| 390 |
+
test = pd.merge(test, audio_features,left_on="track_uri", right_on="id", how='outer')
|
| 391 |
+
test = pd.merge(test, track_, left_on="track_uri",right_on="Track_uri", how='outer')
|
| 392 |
+
test = pd.merge(test, artist_, left_on="artist_uri",right_on="Artist_uri", how='outer')
|
| 393 |
+
test.rename(columns={'genres': 'Artist_genres'}, inplace=True)
|
| 394 |
+
test.drop(columns=['Track_uri', 'Artist_uri_x','Artist_uri_y', 'Album_uri', 'id'], axis=1, inplace=True)
|
| 395 |
+
test.dropna(axis=0, inplace=True)
|
| 396 |
+
test['Track_pop'] = test['Track_pop'].apply(lambda x: int(x/5))
|
| 397 |
+
test['Artist_pop'] = test['Artist_pop'].apply(lambda x: int(x/5))
|
| 398 |
+
test['Track_release_date'] = test['Track_release_date'].apply(lambda x: x.split('-')[0])
|
| 399 |
+
test['Track_release_date'] = test['Track_release_date'].astype('int16')
|
| 400 |
+
test['Track_release_date'] = test['Track_release_date'].apply(lambda x: int(x/50))
|
| 401 |
+
test[['danceability', 'energy', 'key', 'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness', 'liveness', 'valence', 'tempo', 'time_signature']] = test[['danceability', 'energy', 'key', 'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness', 'liveness', 'valence', 'tempo', 'time_signature']].astype('float16')
|
| 402 |
+
test[['duration_ms']] = test[['duration_ms']].astype('float32')
|
| 403 |
+
test[['Track_release_date', 'Track_pop', 'Artist_pop']] = test[['Track_release_date', 'Track_pop', 'Artist_pop']].astype('int8')
|
| 404 |
+
except Exception as e:
|
| 405 |
+
log.append(e)
|
| 406 |
+
log.append('Finish extraction')
|
| 407 |
+
grow = test.copy()
|
| 408 |
+
test['Artist_genres'] = test['Artist_genres'].apply(lambda x: x.split(" "))
|
| 409 |
+
tfidf = TfidfVectorizer(max_features=max_gen)
|
| 410 |
+
tfidf_matrix = tfidf.fit_transform(test['Artist_genres'].apply(lambda x: " ".join(x)))
|
| 411 |
+
genre_df = pd.DataFrame(tfidf_matrix.toarray())
|
| 412 |
+
genre_df.columns = ['genre' + "|" +i for i in tfidf.get_feature_names_out()]
|
| 413 |
+
genre_df = genre_df.astype('float16')
|
| 414 |
+
test.drop(columns=['Artist_genres'], axis=1, inplace=True)
|
| 415 |
+
test = pd.concat([test.reset_index(drop=True),genre_df.reset_index(drop=True)], axis=1)
|
| 416 |
+
Fresult = pd.DataFrame()
|
| 417 |
+
x = 1
|
| 418 |
+
for i in range(int(lendf/2), lendf+1, int(lendf/2)):
|
| 419 |
+
try:
|
| 420 |
+
df = pd.read_csv('Data/streamlit.csv',names= col_name,dtype=dtypes,skiprows=x,nrows=i)
|
| 421 |
+
log.append('reading data frame chunks from {} to {}'.format(x,i))
|
| 422 |
+
except Exception as e:
|
| 423 |
+
log.append('Failed to load grow')
|
| 424 |
+
log.append(e)
|
| 425 |
+
grow = grow[~grow['track_uri'].isin(df['track_uri'].values)]
|
| 426 |
+
df = df[~df['track_uri'].isin(test['track_uri'].values)]
|
| 427 |
+
df['Artist_genres'] = df['Artist_genres'].apply(lambda x: x.split(" "))
|
| 428 |
+
tfidf_matrix = tfidf.transform(df['Artist_genres'].apply(lambda x: " ".join(x)))
|
| 429 |
+
genre_df = pd.DataFrame(tfidf_matrix.toarray())
|
| 430 |
+
genre_df.columns = ['genre' + "|" +i for i in tfidf.get_feature_names_out()]
|
| 431 |
+
genre_df = genre_df.astype('float16')
|
| 432 |
+
df.drop(columns=['Artist_genres'], axis=1, inplace=True)
|
| 433 |
+
df = pd.concat([df.reset_index(drop=True),
|
| 434 |
+
genre_df.reset_index(drop=True)], axis=1)
|
| 435 |
+
del genre_df
|
| 436 |
+
try:
|
| 437 |
+
df.drop(columns=['genre|unknown'], axis=1, inplace=True)
|
| 438 |
+
test.drop(columns=['genre|unknown'], axis=1, inplace=True)
|
| 439 |
+
except:
|
| 440 |
+
log.append('genre|unknown not found')
|
| 441 |
+
log.append('Scaling the data .....')
|
| 442 |
+
if x == 1:
|
| 443 |
+
sc = pickle.load(open('Data/sc.sav','rb'))
|
| 444 |
+
df.iloc[:, 3:19] = sc.transform(df.iloc[:, 3:19])
|
| 445 |
+
test.iloc[:, 3:19] = sc.transform(test.iloc[:, 3:19])
|
| 446 |
+
log.append("Creating playlist vector")
|
| 447 |
+
playvec = pd.DataFrame(test.sum(axis=0)).T
|
| 448 |
+
else:
|
| 449 |
+
df.iloc[:, 3:19] = sc.transform(df.iloc[:, 3:19])
|
| 450 |
+
x = i
|
| 451 |
+
if model == 'ReModel':
|
| 452 |
+
df['sim']=cosine_similarity(df.drop(['track_uri', 'artist_uri', 'album_uri'], axis = 1),playvec.drop(['track_uri', 'artist_uri', 'album_uri'], axis = 1))
|
| 453 |
+
df['sim2']=cosine_similarity(df.iloc[:,16:-1],playvec.iloc[:,16:])
|
| 454 |
+
df['sim3']=cosine_similarity(df.iloc[:,19:-2],playvec.iloc[:,19:])
|
| 455 |
+
df = df.sort_values(['sim3','sim2','sim'],ascending = False,kind='stable').groupby('artist_uri').head(same_art).head(50)
|
| 456 |
+
Fresult = pd.concat([Fresult, df], axis=0)
|
| 457 |
+
Fresult = Fresult.sort_values(['sim3', 'sim2', 'sim'],ascending=False,kind='stable')
|
| 458 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 459 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).head(50)
|
| 460 |
+
elif model == 'Experimental Model':
|
| 461 |
+
df['sim'] = cosine_similarity(df.iloc[:, 3:16], playvec.iloc[:, 3:16])
|
| 462 |
+
df['sim2'] = cosine_similarity(df.loc[:, df.columns.str.startswith('T') | df.columns.str.startswith('A')], playvec.loc[:, playvec.columns.str.startswith('T') | playvec.columns.str.startswith('A')])
|
| 463 |
+
df['sim3'] = cosine_similarity(df.loc[:, df.columns.str.startswith('genre')], playvec.loc[:, playvec.columns.str.startswith('genre')])
|
| 464 |
+
df['sim4'] = (df['sim']+df['sim2']+df['sim3'])/3
|
| 465 |
+
df = df.sort_values(['sim4'], ascending=False,kind='stable').groupby('artist_uri').head(same_art).head(50)
|
| 466 |
+
Fresult = pd.concat([Fresult, df], axis=0)
|
| 467 |
+
Fresult = Fresult.sort_values(['sim4'], ascending=False,kind='stable')
|
| 468 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 469 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).head(50)
|
| 470 |
+
del test
|
| 471 |
+
try:
|
| 472 |
+
del df
|
| 473 |
+
log.append('Getting Result')
|
| 474 |
+
except:
|
| 475 |
+
log.append('Getting Result')
|
| 476 |
+
if model == 'ReModel':
|
| 477 |
+
Fresult = Fresult.sort_values(['sim3', 'sim2', 'sim'],ascending=False,kind='stable')
|
| 478 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 479 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).track_uri.head(50)
|
| 480 |
+
elif model == 'Experimental Model':
|
| 481 |
+
Fresult = Fresult.sort_values(['sim4'], ascending=False,kind='stable')
|
| 482 |
+
Fresult.drop_duplicates(subset=['track_uri'], inplace=True,keep='first')
|
| 483 |
+
Fresult = Fresult.groupby('artist_uri').head(same_art).track_uri.head(50)
|
| 484 |
+
log.append('{} New Tracks Found'.format(len(grow)))
|
| 485 |
+
if(len(grow)>=1):
|
| 486 |
+
try:
|
| 487 |
+
new=pd.read_csv('Data/new_tracks.csv',dtype=dtypes)
|
| 488 |
+
new=pd.concat([new, grow], axis=0)
|
| 489 |
+
new=new[new.Track_pop >0]
|
| 490 |
+
new.drop_duplicates(subset=['track_uri'], inplace=True,keep='last')
|
| 491 |
+
new.to_csv('Data/new_tracks.csv',index=False)
|
| 492 |
+
except:
|
| 493 |
+
grow.to_csv('Data/new_tracks.csv', index=False)
|
| 494 |
+
log.append('Model run successfully')
|
| 495 |
+
except Exception as e:
|
| 496 |
+
log.append("Model Failed")
|
| 497 |
+
log.append(e)
|
| 498 |
+
return Fresult, log
|
| 499 |
+
|
| 500 |
+
def update_dataset():
|
| 501 |
+
col_name= ['track_uri', 'artist_uri', 'album_uri', 'danceability', 'energy', 'key',
|
| 502 |
+
'loudness', 'mode', 'speechiness', 'acousticness', 'instrumentalness',
|
| 503 |
+
'liveness', 'valence', 'tempo', 'duration_ms', 'time_signature',
|
| 504 |
+
'Track_release_date', 'Track_pop', 'Artist_pop', 'Artist_genres']
|
| 505 |
+
dtypes = {'track_uri': 'object', 'artist_uri': 'object', 'album_uri': 'object', 'danceability': 'float16', 'energy': 'float16', 'key': 'float16',
|
| 506 |
+
'loudness': 'float16', 'mode': 'float16', 'speechiness': 'float16', 'acousticness': 'float16', 'instrumentalness': 'float16',
|
| 507 |
+
'liveness': 'float16', 'valence': 'float16', 'tempo': 'float16', 'duration_ms': 'float32', 'time_signature': 'float16',
|
| 508 |
+
'Track_release_date': 'int8', 'Track_pop': 'int8', 'Artist_pop': 'int8', 'Artist_genres': 'object'}
|
| 509 |
+
df = pd.read_csv('Data/streamlit.csv',dtype=dtypes)
|
| 510 |
+
grow = pd.read_csv('Data/new_tracks.csv',dtype=dtypes)
|
| 511 |
+
cur = len(df)
|
| 512 |
+
df=pd.concat([df,grow],axis=0)
|
| 513 |
+
grow=pd.DataFrame(columns=col_name)
|
| 514 |
+
grow.to_csv('Data/new_tracks.csv',index=False)
|
| 515 |
+
df=df[df.Track_pop >0]
|
| 516 |
+
df.drop_duplicates(subset=['track_uri'],inplace=True,keep='last')
|
| 517 |
+
df.dropna(axis=0,inplace=True)
|
| 518 |
+
df.to_csv('Data/streamlit.csv',index=False)
|
| 519 |
+
return (len(df)-cur)
|
| 520 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==1.4.4
|
| 2 |
+
PyYAML==6.0
|
| 3 |
+
scikit_learn==1.1.3
|
| 4 |
+
spotipy==2.20.0
|
| 5 |
+
streamlit==1.14.0
|
| 6 |
+
streamlit_option_menu==0.3.2
|
| 7 |
+
altair<5
|
spotify_get_artist_url.png
ADDED
|
spotify_get_playlist_url.png
ADDED
|
spotify_get_song_url.png
ADDED
|
spotifysearch/__init__.py
ADDED
|
File without changes
|
spotifysearch/calls.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# THIS FILE IS RESPONSABLE FOR API CALLS
|
| 3 |
+
|
| 4 |
+
from . import urlbuilder
|
| 5 |
+
from requests import get, post
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def call_acess_token(credentials):
|
| 9 |
+
endpoint = 'https://accounts.spotify.com/api/token'
|
| 10 |
+
data = {
|
| 11 |
+
'grant_type':'client_credentials'
|
| 12 |
+
}
|
| 13 |
+
headers = {
|
| 14 |
+
'Authorization':f'Basic {credentials}'
|
| 15 |
+
}
|
| 16 |
+
return post(url=endpoint, data=data, headers=headers)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def call_search(acess_token, args):
|
| 20 |
+
endpoint = urlbuilder.search_endpoint(*args)
|
| 21 |
+
headers = {
|
| 22 |
+
'Authorization':f'Bearer {acess_token}'
|
| 23 |
+
}
|
| 24 |
+
return get(url=endpoint, headers=headers)
|
spotifysearch/classes.py
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# THIS FILE IS RESPONSABLE FOR MANY CLASS DECLARATIONS
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import math
|
| 6 |
+
from base64 import b64encode
|
| 7 |
+
from urllib.request import urlretrieve
|
| 8 |
+
from . import constructor
|
| 9 |
+
from . import calls
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# AUTHENTICATION AND TOKENS
|
| 13 |
+
class Authenticator:
|
| 14 |
+
|
| 15 |
+
def __init__(self, client_id:str, client_secret:str):
|
| 16 |
+
self.credentials = self.encode_credentials(client_id, client_secret)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def encode_credentials(self, client_id, client_secret):
|
| 20 |
+
credentials = f'{client_id}:{client_secret}'
|
| 21 |
+
encoded_credentials = b64encode(credentials.encode('utf-8'))
|
| 22 |
+
return str(encoded_credentials, 'utf-8')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def get_acess_token(self):
|
| 26 |
+
response = calls.call_acess_token(self.credentials)
|
| 27 |
+
return response.json()['access_token']
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# OBJECTS
|
| 31 |
+
|
| 32 |
+
# Base class for all classes
|
| 33 |
+
class Base:
|
| 34 |
+
|
| 35 |
+
def __init__(self, data, type, name, url, id):
|
| 36 |
+
self.data = data
|
| 37 |
+
self.type = type
|
| 38 |
+
self.name = name
|
| 39 |
+
self.url = url
|
| 40 |
+
self.id = id
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def export_json(self, path:str):
|
| 44 |
+
file = open(path, 'w')
|
| 45 |
+
json.dump(self.data, file, indent=4)
|
| 46 |
+
file.close()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# Base class for track-like objects
|
| 50 |
+
class TrackBase(Base):
|
| 51 |
+
|
| 52 |
+
def __init__(self, data, type, name, url, id, explicit, duration_ms):
|
| 53 |
+
super().__init__(data, type, name, url, id)
|
| 54 |
+
self.explicit = explicit
|
| 55 |
+
self.duration_ms = duration_ms
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def get_formatted_duration(self) -> dict:
|
| 59 |
+
|
| 60 |
+
duration_in_seconds = self.duration_ms / 1000
|
| 61 |
+
hours = 0
|
| 62 |
+
mins = math.floor(duration_in_seconds // 60)
|
| 63 |
+
|
| 64 |
+
if mins >= 60:
|
| 65 |
+
hours = math.floor(mins // 60)
|
| 66 |
+
mins = math.floor(mins % 60)
|
| 67 |
+
|
| 68 |
+
secs = math.floor(duration_in_seconds % 60)
|
| 69 |
+
|
| 70 |
+
return {'hours':hours, 'minutes':mins, 'seconds':secs}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def get_string_duration(self) -> str:
|
| 74 |
+
|
| 75 |
+
duration = self.get_formatted_duration()
|
| 76 |
+
format = self.__format_duration
|
| 77 |
+
|
| 78 |
+
hours = format(str(duration['hours']))
|
| 79 |
+
mins = format(str(duration['minutes']))
|
| 80 |
+
secs = format(str(duration['seconds']))
|
| 81 |
+
|
| 82 |
+
if int(hours):
|
| 83 |
+
return f'{hours}:{mins}:{secs}'
|
| 84 |
+
else:
|
| 85 |
+
return f'{mins}:{secs}'
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def __format_duration(self, value:str):
|
| 89 |
+
if len(value) < 2:
|
| 90 |
+
return ('0' + value)
|
| 91 |
+
else: return value
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
class Artist(Base):
|
| 95 |
+
|
| 96 |
+
def __init__(self, data:dict, type:str, name:str, url:str, id:str):
|
| 97 |
+
super().__init__(data, type, name, url, id)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class AlbumCover:
|
| 101 |
+
|
| 102 |
+
def __init__(self, width, height, url):
|
| 103 |
+
self.width = width
|
| 104 |
+
self.height = height
|
| 105 |
+
self.url = url
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def export_image(self, path):
|
| 109 |
+
urlretrieve(self.url, path)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
class Album(Base):
|
| 113 |
+
|
| 114 |
+
def __init__(self, data:dict, type:str, name:str, url:str, id:str,
|
| 115 |
+
images:list, artists:list, available_markets:list, release_date:str, total_tracks:int):
|
| 116 |
+
|
| 117 |
+
super().__init__(data, type, name, url, id)
|
| 118 |
+
self.images = images
|
| 119 |
+
self.artists = artists
|
| 120 |
+
self.available_markets = available_markets
|
| 121 |
+
self.release_date = release_date
|
| 122 |
+
self.total_tracks = total_tracks
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class TrackPreview:
|
| 126 |
+
|
| 127 |
+
def __init__(self, url):
|
| 128 |
+
self.url = url
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def export_audio(self, path):
|
| 132 |
+
urlretrieve(self.url, path)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class Track(TrackBase):
|
| 136 |
+
|
| 137 |
+
def __init__(self, data:dict, type:str, name:str, url:str, id:str, explicit:bool,
|
| 138 |
+
duration_ms:int, preview:TrackPreview, artists:list, album:Album, available_markets:list,
|
| 139 |
+
disc_number:int, popularity:int):
|
| 140 |
+
|
| 141 |
+
super().__init__(data, type, name, url, id, explicit, duration_ms)
|
| 142 |
+
self.preview = preview
|
| 143 |
+
self.artists = artists
|
| 144 |
+
self.album = album
|
| 145 |
+
self.available_markets = available_markets
|
| 146 |
+
self.disc_number = disc_number
|
| 147 |
+
self.popularity = popularity
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
class Episode(TrackBase):
|
| 151 |
+
|
| 152 |
+
def __init__(self, data:dict, type:str, name:str, url:str, id:str,
|
| 153 |
+
explicit:bool, duration_ms:int, preview:str, description:str, html_description:str,
|
| 154 |
+
images:list, language:str, languages:list, release_date:str):
|
| 155 |
+
|
| 156 |
+
super().__init__(data, type, name, url, id, explicit, duration_ms)
|
| 157 |
+
self.preview = preview
|
| 158 |
+
self.description = description
|
| 159 |
+
self.html_description = html_description
|
| 160 |
+
self.images = images
|
| 161 |
+
self.language = language
|
| 162 |
+
self.languages = languages
|
| 163 |
+
self.release_date = release_date
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
# CLIENT OBJECTS
|
| 167 |
+
class Results(Base):
|
| 168 |
+
|
| 169 |
+
def __init__(self, data):
|
| 170 |
+
self.data = data
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def __get_items(self, type):
|
| 174 |
+
|
| 175 |
+
if type == 'artist':
|
| 176 |
+
try:
|
| 177 |
+
data = self.data['artists']['items']
|
| 178 |
+
func = constructor.artist
|
| 179 |
+
except KeyError:
|
| 180 |
+
return []
|
| 181 |
+
|
| 182 |
+
elif type == 'track':
|
| 183 |
+
try:
|
| 184 |
+
data = self.data['tracks']['items']
|
| 185 |
+
func = constructor.track
|
| 186 |
+
except KeyError:
|
| 187 |
+
return []
|
| 188 |
+
|
| 189 |
+
elif type == 'album':
|
| 190 |
+
try:
|
| 191 |
+
data = self.data['albums']['items']
|
| 192 |
+
func = constructor.album
|
| 193 |
+
except KeyError:
|
| 194 |
+
return []
|
| 195 |
+
|
| 196 |
+
elif type == 'episode':
|
| 197 |
+
try:
|
| 198 |
+
data = self.data['episodes']['items']
|
| 199 |
+
func = constructor.episode
|
| 200 |
+
except KeyError:
|
| 201 |
+
return []
|
| 202 |
+
|
| 203 |
+
return [func(item) for item in data]
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def get_tracks(self) -> list:
|
| 207 |
+
return self.__get_items('track')
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def get_artists(self) -> list:
|
| 211 |
+
return self.__get_items('artist')
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
def get_albums(self) -> list:
|
| 215 |
+
return self.__get_items('album')
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def get_episodes(self) -> list:
|
| 219 |
+
return self.__get_items('episode')
|
spotifysearch/client.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# THIS FILE IS RESPONSABLE FOR DEALING WITH THE CLIENT
|
| 3 |
+
|
| 4 |
+
from .classes import Authenticator, Results
|
| 5 |
+
from . import calls
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Client:
|
| 9 |
+
|
| 10 |
+
def __init__(self, client_id, client_secret):
|
| 11 |
+
self.auth = Authenticator(client_id, client_secret)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def search(self, keywords:str, *, types:list = ['track'], filters:dict = {},
|
| 15 |
+
market:str = None, limit:int = None, offset:int = None) -> Results:
|
| 16 |
+
access_token = self.auth.get_acess_token()
|
| 17 |
+
args = (keywords, types, filters, market, limit, offset)
|
| 18 |
+
response = calls.call_search(access_token, args)
|
| 19 |
+
return Results(response.json())
|
spotifysearch/constructor.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# THIS FILE IS RESPONSABLE FOR THE CONSTRUCTION OF MANY OBJECTS
|
| 3 |
+
|
| 4 |
+
from . import classes
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def get_available_markets(data):
|
| 8 |
+
try:
|
| 9 |
+
return data['available_markets']
|
| 10 |
+
except KeyError:
|
| 11 |
+
return None
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# BASE ARGUMENTS FOR ALL CLASSES
|
| 15 |
+
def base_arguments(data):
|
| 16 |
+
arguments = dict(
|
| 17 |
+
data = data,
|
| 18 |
+
type = data['type'],
|
| 19 |
+
name = data['name'],
|
| 20 |
+
url = data['external_urls']['spotify'],
|
| 21 |
+
id = data['id']
|
| 22 |
+
)
|
| 23 |
+
return arguments
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# BASE ARGUMENTS FOR TRACK-LIKE CLASSES
|
| 27 |
+
def track_base_arguments(data):
|
| 28 |
+
arguments = dict(
|
| 29 |
+
explicit = data['explicit'],
|
| 30 |
+
duration_ms = data['duration_ms']
|
| 31 |
+
)
|
| 32 |
+
return arguments
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def artist(data):
|
| 36 |
+
return classes.Artist(**base_arguments(data))
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def track(data):
|
| 40 |
+
base = base_arguments(data)
|
| 41 |
+
track_base = track_base_arguments(data)
|
| 42 |
+
|
| 43 |
+
arguments = dict(
|
| 44 |
+
preview = data['preview_url'],
|
| 45 |
+
artists = [artist(artist_data) for artist_data in data['artists']],
|
| 46 |
+
album = album(data['album']),
|
| 47 |
+
available_markets = get_available_markets(data),
|
| 48 |
+
disc_number = data['disc_number'],
|
| 49 |
+
popularity = data['popularity']
|
| 50 |
+
)
|
| 51 |
+
return classes.Track(**{**base, **track_base, **arguments})
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def album(data):
|
| 55 |
+
base = base_arguments(data)
|
| 56 |
+
|
| 57 |
+
arguments = dict(
|
| 58 |
+
images = [classes.AlbumCover(image['width'], image['height'], image['url']) for image in data['images']],
|
| 59 |
+
artists = [artist(artist_data) for artist_data in data['artists']],
|
| 60 |
+
available_markets = get_available_markets(data),
|
| 61 |
+
release_date = data['release_date'],
|
| 62 |
+
total_tracks = data['total_tracks']
|
| 63 |
+
)
|
| 64 |
+
return classes.Album(**{**base, **arguments})
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def episode(data):
|
| 68 |
+
base = base_arguments(data)
|
| 69 |
+
track_base = track_base_arguments(data)
|
| 70 |
+
|
| 71 |
+
arguments = dict(
|
| 72 |
+
preview = data['audio_preview_url'],
|
| 73 |
+
description = data['description'],
|
| 74 |
+
html_description = data['html_description'],
|
| 75 |
+
images = data['images'],
|
| 76 |
+
language = data['language'],
|
| 77 |
+
languages = data['languages'],
|
| 78 |
+
release_date = data['release_date']
|
| 79 |
+
)
|
| 80 |
+
return classes.Episode(**{**base, **track_base, **arguments})
|
spotifysearch/urlbuilder.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# THIS FILE IS RESPONSABLE FOR BUILDING DYNAMIC URLS
|
| 3 |
+
|
| 4 |
+
def search_endpoint(keywords:str, allowed_types:list,
|
| 5 |
+
filters:dict, market:str, limit:int, offset:int):
|
| 6 |
+
endpoint = 'https://api.spotify.com/v1/search?'
|
| 7 |
+
|
| 8 |
+
# FORMAT QUERRY ITEMS AND FILTERS
|
| 9 |
+
querry_items = keywords.split(' ')
|
| 10 |
+
for filter, value in filters.items():
|
| 11 |
+
value = value.replace(' ', '%20')
|
| 12 |
+
item = f'{filter}:{value}'
|
| 13 |
+
querry_items.append(item)
|
| 14 |
+
|
| 15 |
+
# REQUIRED ARGUMENTS
|
| 16 |
+
querry = 'q=' + '%20'.join(querry_items)
|
| 17 |
+
types = 'type=' + ','.join(allowed_types)
|
| 18 |
+
arguments = [querry, types]
|
| 19 |
+
|
| 20 |
+
# OPTIONAL ARGUMENTS
|
| 21 |
+
if market:
|
| 22 |
+
arguments.append(f'market={market}')
|
| 23 |
+
if limit:
|
| 24 |
+
arguments.append(f'limit={limit}')
|
| 25 |
+
if offset:
|
| 26 |
+
arguments.append(f'offset={offset}')
|
| 27 |
+
|
| 28 |
+
return endpoint + '&'.join(arguments)
|