Discogs artist search
This commit is contained in:
@@ -8,11 +8,11 @@ class ApplicationController < ActionController::Base
|
||||
def index; end
|
||||
|
||||
def greetings
|
||||
render :partial => 'greetings'
|
||||
render_compact_partial :greetings
|
||||
end
|
||||
|
||||
def about
|
||||
render :partial => 'about'
|
||||
render_compact_partial :about
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -33,7 +33,7 @@ protected
|
||||
def session_key
|
||||
if cookies[:beathaven_sid].nil?
|
||||
cookies[:beathaven_sid] = {
|
||||
:value => Digest::SHA1.hexdigest(Beathaven::Application.config.secret_token+Time.now.to_f.to_s+Random.rand().to_s),
|
||||
:value => Session.generate_key,
|
||||
:expire => 42.years.from_now.utc
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require 'musicbrainz'
|
||||
|
||||
class ArtistController < ApplicationController
|
||||
def data
|
||||
# Bad params
|
||||
@@ -9,7 +7,7 @@ class ArtistController < ApplicationController
|
||||
|
||||
# Searching for artist
|
||||
artist_name = get_artist_name_from_query
|
||||
@artist = Artist.find_by_name(artist_name, include: {artist_links: {}, albums: {tracks: {}}})
|
||||
@artist = Artist.find_by_name(artist_name, include: { artist_links: {}, albums: { tracks: {}}})
|
||||
|
||||
# Artist not found in DB
|
||||
unless @artist
|
||||
@@ -38,7 +36,7 @@ class ArtistController < ApplicationController
|
||||
status: @artist.status_str,
|
||||
artist: @artist,
|
||||
html: render_compact_partial(:page)
|
||||
}, include: {albums: {include: {tracks: {}}}}
|
||||
}, include: { albums: { include: { tracks: {}}}}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -49,6 +49,10 @@ class ImportController < ApplicationController
|
||||
).save
|
||||
end
|
||||
|
||||
if brainz_artist.urls[:discogs].nil?
|
||||
brainz_artist.urls[:discogs] = Discogs.search_for_artist(artist.name)
|
||||
end
|
||||
|
||||
unless brainz_artist.urls[:discogs].nil?
|
||||
Discogs.get_master_albums(brainz_artist.urls[:discogs]).each do |info|
|
||||
begin
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
class Session < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
def self.generate_key
|
||||
Digest::SHA1.hexdigest(Beathaven::Application.config.secret_token + Time.now.to_f.to_s + Random.rand().to_s)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user