Обновить autobudilnik.rb

This commit is contained in:
anon47 2024-02-13 10:39:33 -07:00
parent dba5ed8983
commit b50535b79a

View File

@ -93,6 +93,7 @@ suffix = waittimestr.delete('0-9')
case suffix case suffix
when '' when ''
waittime = waittimestr.to_i waittime = waittimestr.to_i
waittimestr += 's'
when 'd' when 'd'
waittime = waittimestr.to_i * 86400 waittime = waittimestr.to_i * 86400
when 'm' when 'm'
@ -105,12 +106,12 @@ else
raise "'#{suffix}' suffix is not found" raise "'#{suffix}' suffix is not found"
end end
if waittime > 17 if waittime > 18
puts 'waittime:' + waittimestr puts 'waittime:' + waittimestr
waittime = waittime - 18 # 30 x 0.6 = 18 waittime = waittime - 18 # 30 x 0.6 = 18
else else
puts "18 seconds is the minimum\nwaittime:18" puts "19 seconds is the minimum\nwaittime:19s"
waittime = 0 waittime = 1
end end
nexttime = Time.new + waittime nexttime = Time.new + waittime
@ -160,7 +161,7 @@ while true
sleep(0.6) #НУЖНО УБАВИТЬ С ВЭЙТТАЙМА sleep(0.6) #НУЖНО УБАВИТЬ С ВЭЙТТАЙМА
a2.call(175) a2.call(175)
} }
puts "turn on audio" puts "starts audio"
system('zadacha1.bat ' + audiofilepath) system('zadacha1.bat ' + audiofilepath)
end end
sleep(3.4) sleep(3.4)