localhots / musicbrainz Goto Github PK
View Code? Open in Web Editor NEWMusicBrainz Web Service client
Home Page: https://musicbrainz.org/doc/MusicBrainz_API
License: MIT License
MusicBrainz Web Service client
Home Page: https://musicbrainz.org/doc/MusicBrainz_API
License: MIT License
When using the musicbrainz gem in a Rails (3.2.8) application, I'm getting a Encoding::UndefinedConversionError when the CachingProxy writes a response to disk.
This only happens within the Rails application - I haven't been able to replicate it from elsewhere.
I've been able to get around the problem by making the CachingProxy write the file in binary mode (i.e. File.open(file_path, 'wb') ...), but because I'm unable to replicate the issue outside of Rails I'm not sure whether this is the best approach.
Any ideas?
e.g. from the Rails console
Loading development environment (Rails 3.2.8)
irb(main):001:0> MusicBrainz::Artist.find("7cfaac66-62e5-4fcd-af1b-9d3aa8f68e8b")
Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client_modules/caching_proxy.rb:26:in `write'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client_modules/caching_proxy.rb:26:in `puts'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client_modules/caching_proxy.rb:26:in `block in get_contents'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client_modules/caching_proxy.rb:25:in `open'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client_modules/caching_proxy.rb:25:in `get_contents'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client.rb:29:in `contents_of'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/client.rb:12:in `load'
from /Users/sinclp01/Documents/Code/musicbrainz/lib/musicbrainz/models/artist.rb:25:in `find'
from (irb):1
from /Users/sinclp01/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /Users/sinclp01/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /Users/sinclp01/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
It looks like you started to replace the Test::Unit by RSpec tests here?
Does this mean that you plan to use only RSpec tests in the future?
I need to know your decision cause I will do a contribution some day. Maybe I can also migrate those unit tests to RSpec with my contribution.
Kind regards
Mathias
The Readme states that MusicBrainz::Track
is deprecated and to use MusicBrainz::Recording
, but MusicBrainz::Recording
is not defined in version 0.7.7 (latest).
MusicBrainz::Track.search
returns nil, even when the search is valid, every time as well.
I'm getting the following error when trying to fetch release groups for an artist:
> MusicBrainz::Artist.find("309c62ba-7a22-4277-9f67-4a162526d18a").release_groups
ArgumentError: invalid date
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/date.rb:809:in `civil'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/base_model.rb:56:in `validate_type'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/base_model.rb:14:in `block in field'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/base_model.rb:31:in `block in initialize'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/base_model.rb:30:in `each'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/base_model.rb:30:in `initialize'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/client.rb:29:in `new'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/client.rb:29:in `block in load'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/client.rb:29:in `map'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/client.rb:29:in `load'
from /data/sensei/shared/bundle/ruby/1.9.1/bundler/gems/musicbrainz-abd67818d352/lib/musicbrainz/models/artist.rb:12:in `release_groups'
from (irb):7
from /data/sensei/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /data/sensei/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /data/sensei/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Sometimes, once in a while (especially when my Sidekiq worker works in the background), I get the error below:
Errno::ENOENT: Errno::ENOENT: No such file or directory @ dir_s_mkdir - tmp
My code: MusicBrainz::Artist.find(mbid)
Stack trace:
39: File "[GEM_ROOT]/gems/musicbrainz-0.7.6/lib/musicbrainz/models/artist.rb" line 21 in find
40: File "[GEM_ROOT]/gems/musicbrainz-0.7.6/lib/musicbrainz/client.rb" line 19 in load
41: File "[GEM_ROOT]/gems/musicbrainz-0.7.6/lib/musicbrainz/client_modules/caching_proxy.rb" line 29 in get_contents
42: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 208 in mkdir_p
43: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 208 in each
44: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 222 in block in mkdir_p
45: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 222 in reverse_each
46: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 224 in block (2 levels) in mkdir_p
47: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 250 in fu_mkdir
48: File "/opt/rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb" line 250 in mkdir
Any idea what's wrong? Is this because my tasks run concurrent, or is the error somewhere else on my side?
It should be way easier to parse and a lot faster
Here's the documentation: http://wiki.musicbrainz.org/Development/JSON_Web_Service
When are you planning to release a new version? The current version (0.7.7) doesn't include some required features (like find by discid).
Hello there,
I'm playing around with the gem. A little that i dont know if its the caching problem or not.
madonna = MusicBrainz::Artist.find('79239441-bfd5-4981-a70c-55c3f15c1287')
puts madonna.urls.inspect
{:fanpage=>"http://www.minsane.com.br/", :wikipedia=>"http://en.wikipedia.org/wiki/Madonna_(entertainer)", :lyrics=>"http://www.lyricstatus.com/madonna-lyrics", :musicmoz=>"http://musicmoz.org/Bands_and_Artists/M/Madonna/", :other_databases=>"http://rateyourmusic.com/artist/madonna", :soundcloud=>"http://soundcloud.com/madonna", :viaf=>"http://viaf.org/viaf/59270244", :allmusic=>"http://www.allmusic.com/artist/mn0000237205", :bbc_music_page=>"http://www.bbc.co.uk/music/artists/79239441-bfd5-4981-a70c-55c3f15c1287", :discogs=>"http://www.discogs.com/artist/Madonna", :social_network=>"https://www.facebook.com/madonna", :imdb=>"http://www.imdb.com/name/nm0000187/", :official_homepage=>"http://www.madonna.com/", :discography=>"http://www.madonnarecords.com/", :myspace=>"http://www.myspace.com/madonna", :secondhandsongs=>"http://www.secondhandsongs.com/artist/84", :wikidata=>"http://www.wikidata.org/wiki/Q1744", :youtube=>"http://www.youtube.com/user/madonna"}
But visit this original musicbrainz page of madonna. there is g+ link
Any idea?
thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.