Import minor fixes
This commit is contained in:
parent
b69c9cdbe0
commit
78cc2d343c
|
@ -44,9 +44,9 @@ class ImportController < ApplicationController
|
||||||
releases_mb_data = releases_mb_xml.scan(/<release\sid=\"([a-f0-9-]+?)\">.*?<status>([a-zA-Z]+?)<\/status>.*?<date>([0-9-]+?)<\/date>.*?<country>([A-Z]+?)<\/country>/m)
|
releases_mb_data = releases_mb_xml.scan(/<release\sid=\"([a-f0-9-]+?)\">.*?<status>([a-zA-Z]+?)<\/status>.*?<date>([0-9-]+?)<\/date>.*?<country>([A-Z]+?)<\/country>/m)
|
||||||
releases_mb_data.each do |item|
|
releases_mb_data.each do |item|
|
||||||
if item[2].length == 4
|
if item[2].length == 4
|
||||||
item[2] += '-01-01'
|
item[2] += '-12-28'
|
||||||
elsif item[2].length == 7
|
elsif item[2].length == 7
|
||||||
item[2] += '-01'
|
item[2] += '-28'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,9 +92,11 @@ class ImportController < ApplicationController
|
||||||
# Creating hashed array for matching
|
# Creating hashed array for matching
|
||||||
mb_main_tracks_hashed = []
|
mb_main_tracks_hashed = []
|
||||||
mb_tracks.each do |mb_track|
|
mb_tracks.each do |mb_track|
|
||||||
mb_main_tracks_hashed << mb_track[2].downcase.scan(/[a-z0-9]*/).join
|
unless mb_main_tracks_hashed.include? mb_track[2].downcase.scan(/[a-z0-9]*/).join
|
||||||
mb_track << main_release[3] # Release country
|
mb_main_tracks_hashed << mb_track[2].downcase.scan(/[a-z0-9]*/).join
|
||||||
mb_track << 0 # Bonus flag
|
mb_track << main_release[3] # Release country
|
||||||
|
mb_track << 0 # Bonus flag
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Searching for tracks in other releases
|
# Searching for tracks in other releases
|
||||||
|
@ -115,16 +117,18 @@ class ImportController < ApplicationController
|
||||||
|
|
||||||
# Saving tracks
|
# Saving tracks
|
||||||
mb_tracks.each do |mb_track|
|
mb_tracks.each do |mb_track|
|
||||||
track = Track.new
|
unless mb_track[2] == '[silence]' or mb_track[2] == '[untitled]'
|
||||||
track.name = mb_track[2]
|
track = Track.new
|
||||||
track.album_id = album.id
|
track.name = mb_track[2]
|
||||||
track.position = mb_track[0]
|
track.album_id = album.id
|
||||||
track.length = mb_track[3]
|
track.position = mb_track[0]
|
||||||
track.country = mb_track[4]
|
track.length = mb_track[3]
|
||||||
track.bonus = mb_track[5]
|
track.country = mb_track[4]
|
||||||
track.live = mb_track[2].downcase.include? 'live'
|
track.bonus = mb_track[5]
|
||||||
track.acoustic = mb_track[2].downcase.include? 'acoustic'
|
track.live = mb_track[2].downcase.include? 'live'
|
||||||
track.save
|
track.acoustic = mb_track[2].downcase.include? 'acoustic'
|
||||||
|
track.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end # unless mb_main_tracks.empty?
|
end # unless mb_main_tracks.empty?
|
||||||
|
|
Loading…
Reference in New Issue