parent
cc6da7127a
commit
34b6887a79
|
|
@ -13,7 +13,7 @@ namespace :mobile do
|
|||
end
|
||||
|
||||
unless File.exists?(tmp_fname)
|
||||
puts "*** ERROR: download failed: `#{cmd}`"
|
||||
$stderr.puts "*** ERROR: download failed: `#{cmd}`"
|
||||
return
|
||||
end
|
||||
|
||||
|
|
@ -52,6 +52,8 @@ namespace :mobile do
|
|||
artist: {},
|
||||
}
|
||||
}
|
||||
|
||||
indices = jtx_json[:jtx_indices]
|
||||
|
||||
CSV.foreach(tmp_fname) do |row|
|
||||
jtartist = row[0]
|
||||
|
|
@ -66,12 +68,12 @@ namespace :mobile do
|
|||
artist: jtartist,
|
||||
genre: jt.genres.map(&:description).join(', '),
|
||||
id: jt.id,
|
||||
key: jt.id,
|
||||
name: jtname,
|
||||
plan_code: jt.plan_code,
|
||||
year: jt.year
|
||||
}
|
||||
# jtx_json[:jtx_data] << jtdata
|
||||
indices = jtx_json[:jtx_indices]
|
||||
|
||||
first_char = jtartist[0].upcase
|
||||
if (1..9) === first_char.to_i || '0' == first_char
|
||||
|
|
@ -90,6 +92,20 @@ namespace :mobile do
|
|||
idx_artist << jtdata
|
||||
end
|
||||
|
||||
alphanum = indices[:alphanum]
|
||||
songs = []
|
||||
alphanum.keys.sort.each do |key|
|
||||
songs << { key: key, data: alphanum[key] }
|
||||
end
|
||||
indices[:alphanum] = songs
|
||||
|
||||
artists = indices[:artist]
|
||||
artists_new = []
|
||||
artists.keys.sort.each do |key|
|
||||
artists_new << { key: key, data: artists[key] }
|
||||
end
|
||||
indices[:artist] = artists_new
|
||||
|
||||
File.open("#{Rails.root}/tmp/jtx_indices.json", 'w') do |ff|
|
||||
ff.write jtx_json.to_json
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue