Garmin Log Renaming.rb
# Getting date of MotionX file. This could be written better: the break is bad. 
Getting date of MotionX file. This could be written better: the break is bad.
Getting date of MotionX file . This could be written better : the break is bad .
def motionXdate(fx)
  arrLines=IO.readlines(fx) 
  puts "#{lineNum}. MotionX file processing"
  ln = 3 
  while ln<20 
    puts "#{lineNum}. ln: #{ln}. #{arrLines[ln]}"
    if arrLines[ln] =~ /<time>(.*?)<\/time>/ 
      timeLine = arrLines[ln].strip 
      dotDate = timeLine[6..15].gsub("-",".")
      return dotDate
      break
    end
    ln += 1
  end 
end
def motionXdate ( fx ) arrLines = IO . readlines ( fx ) puts "#{lineNum}. MotionX file processing" ln = 3 while ln < 20 puts "#{lineNum}. ln: #{ln}. #{arrLines[ln]}" if arrLines [ ln ] =~ / <time>(.*?)< \/ time> / timeLine = arrLines [ ln ] . strip dotDate = timeLine [ 6 .. 15 ] . gsub ( "-" , "." ) return dotDate break end ln += 1 end end
Getting date of MotionX file.
Getting date of MotionX file .
# p.131 Thomas # don't need the first lines for looking for <time> # if don't find in 20 lines something wrong # Problems parsing MotionX which seems to have added some space # while
fx
<not_specific>