Newer
Older
padparadscha / ruby / read_oto.rb
@honosuke honosuke on 20 Nov 2018 653 bytes cleanliness commit
#!/usr/bin/ruby
# -*- coding: utf-8 -*-

require 'json'

def readOto(f)
  # ファイル名を与える
  File.open(f) do |g|
    oto = Hash.new
    aoto = Array.new
    
    while line = g.gets
      if /^(_\S+)=(.+)\,(\S+)\,(\S+)\,(\S+)\,(\S+)\,(\S+)/ =~ line
        fname = $1 #file name
        nname =  $2 #note alias
        lblank = $3 #left blank
        kotei = $4 #kotei hanni
        rblank = $5 #right blank
        notetop = $6 #senkou hassei
        overwrap = $7
        aoto = [$1,$3.to_f,$4.to_f,$5.to_f,$6.to_f,$7.to_f]
        oto[$2] = aoto     
      end
      
    end
    
    return oto
  end
end


#p  a = readOto('./oto.ini')