dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit ea6984c5267fa239dbbe14fb1e6e17a7884d43d9
parent 658d6f24be18330a2c561ff422f94e950f32c0e4
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sun, 10 Nov 2024 19:42:40 +0100

libspotify: bugfixes

Diffstat:
Mscripts/libspotify.rb | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/scripts/libspotify.rb b/scripts/libspotify.rb @@ -14,10 +14,6 @@ class Hash self[meth.to_s] end - - def respond_to_missing? - true - end end # Client to access Spotify @@ -151,11 +147,16 @@ class SpotifyClient total = artists.size print "Processing 0/#{total}" releases = artists.each.with_index.reduce([]) do |acc, (artist, i)| - print "\rProcessing #{i + 1}/#{total}" - response = api_call_get "artists/#{artist.id}/albums", { limit: 50, include_groups: 'album,single,appears_on' } - albums = response.items - albums.each { |album| album['release_date'] = album.release_date.split('-').size == 1 ? Date.iso8601("#{album.release_date}-01") : Date.iso8601(album.release_date) } - acc + albums + begin + print "\rProcessing #{i + 1}/#{total}" + response = api_call_get "artists/#{artist.id}/albums", { limit: 50, include_groups: 'album,single,appears_on' } + albums = response.items + albums.each { |album| album['release_date'] = album.release_date.split('-').size == 1 ? Date.iso8601("#{album.release_date}-01") : Date.iso8601(album.release_date) } + acc + albums + rescue Exception => e + puts "Could not process artist #{artist}: #{e}" + acc + end end.reject { |album| album.album_type == 'compilation' } print "\n"