Class: Shoutcast::Station

Inherits:
Object
  • Object
show all
Includes:
Xml
Defined in:
lib/shoutcast_api.rb

Overview

Defines a shoutcast station.

See Stationlist

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Xml

included

Instance Attribute Details

#tuneinObject

URL ready to tune in.



106
107
108
# File 'lib/shoutcast_api.rb', line 106

def tunein
  @tunein
end

Class Method Details

.headerObject



127
128
129
# File 'lib/shoutcast_api.rb', line 127

def self.header
  "%11s %3s %-40s %7s %50s" % %w(id bit station-name listen. title)
end

Instance Method Details

#<=>(other) ⇒ Object

Compare by listeners and id



132
133
134
135
136
# File 'lib/shoutcast_api.rb', line 132

def <=>(other)
  result = listeners <=> other.listeners
  result = id <=> other.id  if result.zero?
  result
end

#to_sObject

String representation of this station



123
124
125
# File 'lib/shoutcast_api.rb', line 123

def to_s
  "#%10d %3d %40s %7d %50s" % [ id, bitrate, name[0...40], listeners, current_title[0...50] ]
end

#typeObject

Get last part of media_type. Example: mpeg for audio/mpeg



118
119
120
# File 'lib/shoutcast_api.rb', line 118

def type
  media_type.split('/').last || media_type
end