2014-01-07 20:29:40 +00:00
|
|
|
module JamRuby
|
|
|
|
|
class IcecastRelay < ActiveRecord::Base
|
|
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
has_and_belongs_to_many :servers, :class_name => "JamRuby::IcecastServer", :join_table => "icecast_server_relays"
|
2014-01-10 21:02:52 +00:00
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
validates :port, presence: true, numericality: {only_integer: true}, length: {in: 1..65535}
|
2014-01-14 21:22:05 +00:00
|
|
|
validates :mount, presence: true
|
|
|
|
|
validates :server, presence: true
|
2014-01-17 04:51:19 +00:00
|
|
|
validates :relay_shoutcast_metadata, :inclusion => {:in => [true, false]}
|
|
|
|
|
validates :on_demand, presence: true, :inclusion => {:in => [true, false]}
|
|
|
|
|
|
|
|
|
|
def dumpXml (builder)
|
|
|
|
|
builder.tag! 'relay' do |listen|
|
|
|
|
|
listen.tag! 'server', server
|
|
|
|
|
listen.tag! 'port', port
|
|
|
|
|
listen.tag! 'mount', mount
|
|
|
|
|
listen.tag! 'local-mount', local_mount if local_mount
|
|
|
|
|
listen.tag! 'username', username if username
|
|
|
|
|
listen.tag! 'password', password if password
|
|
|
|
|
listen.tag! 'relay-shoutcast-metadata', relay_shoutcast_metadata ? 1 : 0
|
|
|
|
|
listen.tag! 'on-demand', on_demand ? 1 : 0
|
|
|
|
|
end
|
2014-01-10 21:02:52 +00:00
|
|
|
end
|
2014-01-07 20:29:40 +00:00
|
|
|
end
|
|
|
|
|
end
|