Import dry run
This commit is contained in:
parent
391288d861
commit
655e30f995
|
@ -10,7 +10,6 @@ class Session
|
|||
if params[key]?
|
||||
_params[key] = params[key]
|
||||
@vk_params = _params
|
||||
false
|
||||
|
||||
setUser: (user) ->
|
||||
@user = user
|
||||
|
|
|
@ -11,7 +11,7 @@ class ImportController < ApplicationController
|
|||
@@brainz_login = 'magnolia_fan'
|
||||
@@brainz_password = '111111'
|
||||
|
||||
def self.importArtist name
|
||||
def self.importArtist name, dry_run = false
|
||||
|
||||
# Initializing gems
|
||||
brainz = MusicBrainz::Client.new(@@brainz_login, @@brainz_password, @@user_agent)
|
||||
|
@ -121,7 +121,8 @@ class ImportController < ApplicationController
|
|||
album.mbid = mb_album['id']
|
||||
album.album_type = mb_album['type']
|
||||
album.pic_url = album_image
|
||||
album.save
|
||||
album.save unless dry_run
|
||||
ap album if dry_run
|
||||
|
||||
# Creating hashed array for matching
|
||||
mb_main_tracks_hashed = []
|
||||
|
@ -175,7 +176,7 @@ class ImportController < ApplicationController
|
|||
track.live = mb_track['recording']['title'].downcase.include? 'live'
|
||||
track.acoustic = mb_track['recording']['title'].downcase.include? 'acoustic'
|
||||
track.mbid = mb_track['recording']['id']
|
||||
track.save
|
||||
track.save unless dry_run
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -199,7 +200,8 @@ class ImportController < ApplicationController
|
|||
artist.status = 2
|
||||
end
|
||||
|
||||
artist.save
|
||||
artist.save unless dry_run
|
||||
ap artist if dry_run
|
||||
|
||||
end # def self.importArtist name
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ namespace :db do
|
|||
desc 'Imports test data from MusicBrainz database'
|
||||
task :import => :environment do
|
||||
|
||||
ati = ['Ashes Divide']
|
||||
ati = ['Vampire Weekend']
|
||||
ati.each do |name|
|
||||
ImportController.importArtist(name)
|
||||
#ap res = ArtistController.musicBrainzExactSearch(name)
|
||||
ImportController.importArtist(name, true)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,7 +13,6 @@ Session = (function() {
|
|||
}
|
||||
}
|
||||
this.vk_params = _params;
|
||||
false;
|
||||
}
|
||||
Session.prototype.setUser = function(user) {
|
||||
this.user = user;
|
||||
|
|
Loading…
Reference in New Issue