Skip to content

Instantly share code, notes, and snippets.

@OrazioCW
Created November 27, 2014 15:55
Show Gist options
  • Save OrazioCW/4461c4fc19bbf6f4bea3 to your computer and use it in GitHub Desktop.
Save OrazioCW/4461c4fc19bbf6f4bea3 to your computer and use it in GitHub Desktop.
wait_until :timeout => $maxRequestsWaitingTime do
@rsyslog_messages = @rsyslog_server.getRSyslogLog({:date => $time, :request => message_type})
if @rsyslog_messages.size < numb_of_messages
sleep 3
false
else
raise 'Number of streamInfo requests exceeded the number of played tracks' unless !(@rsyslog_messages.size > numb_of_messages+1)
@rsyslog_messages.pop(@rsyslog_messages.size - numb_of_messages) unless !(@rsyslog_messages.size > numb_of_messages)
# This checks is needed to exit the wait_until
(@rsyslog_messages.size != numb_of_messages)?false:true
end
end
# This is a special case (play only one track)
if @rsyslog_messages.size == 1
@identifier = @rsyslog_messages[0]['STREAMUNIQUE']
@identifier_type = 'streamUnique'
@track_id = @rsyslog_messages[0]['TRACK']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment