25 lines
1004 B
Ruby
25 lines
1004 B
Ruby
module JamRuby
|
|
class IcecastRelay < ActiveRecord::Base
|
|
|
|
has_and_belongs_to_many :servers, :class_name => "JamRuby::IcecastServer", :join_table => "icecast_server_relays"
|
|
|
|
validates :port, presence: true, numericality: {only_integer: true}, length: {in: 1..65535}
|
|
validates :mount, presence: true
|
|
validates :server, presence: true
|
|
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
|
|
end
|
|
end
|
|
end |