Album status
This commit is contained in:
parent
67b6899f9f
commit
da97b4d4fc
|
@ -81,7 +81,7 @@ class ArtistController < ApplicationController
|
||||||
|
|
||||||
@artist[:albums] = []
|
@artist[:albums] = []
|
||||||
artist.albums.each do |album|
|
artist.albums.each do |album|
|
||||||
if @@default_album_types.include? album.album_type
|
if @@default_album_types.include? album.album_type and album.status == 1
|
||||||
tmp_album = {id: album.id, name: album.name, year: album.year, pic: album.pic_url}
|
tmp_album = {id: album.id, name: album.name, year: album.year, pic: album.pic_url}
|
||||||
album_tracks = []
|
album_tracks = []
|
||||||
bonus_tracks = []
|
bonus_tracks = []
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ImportController < ApplicationController
|
||||||
album.album_type = brainz_release_group.type
|
album.album_type = brainz_release_group.type
|
||||||
album.pic_url = album_image
|
album.pic_url = album_image
|
||||||
album.has_pic = (album_image != '' and not album_image.nil?)
|
album.has_pic = (album_image != '' and not album_image.nil?)
|
||||||
|
album.status = 0
|
||||||
dry_run ? ap(album) : album.save
|
dry_run ? ap(album) : album.save
|
||||||
# Tracks from the first release
|
# Tracks from the first release
|
||||||
tracks_hashed = []
|
tracks_hashed = []
|
||||||
|
@ -72,6 +73,8 @@ class ImportController < ApplicationController
|
||||||
dry_run ? ap(track) : track.save
|
dry_run ? ap(track) : track.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
album.status = 1
|
||||||
|
album.save unless dry_run
|
||||||
end
|
end
|
||||||
|
|
||||||
artist.status = 1
|
artist.status = 1
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddStatusToAlbums < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :albums, :status, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20110630052149) do
|
ActiveRecord::Schema.define(:version => 20110914163231) do
|
||||||
|
|
||||||
create_table "albums", :force => true do |t|
|
create_table "albums", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20110630052149) do
|
||||||
t.string "album_type"
|
t.string "album_type"
|
||||||
t.string "mbid"
|
t.string "mbid"
|
||||||
t.integer "has_pic"
|
t.integer "has_pic"
|
||||||
|
t.integer "status"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "artists", :force => true do |t|
|
create_table "artists", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue