Class: Shoutcast::Station
Overview
Defines a shoutcast station.
See Stationlist
Instance Attribute Summary collapse
-
#tunein ⇒ Object
URL ready to tune in.
Class Method Summary collapse
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Compare by
listeners
andid
. -
#to_s ⇒ Object
String representation of this station.
-
#type ⇒ Object
Get last part of
media_type
.
Methods included from Xml
Instance Attribute Details
#tunein ⇒ Object
URL ready to tune in.
106 107 108 |
# File 'lib/shoutcast_api.rb', line 106 def tunein @tunein end |
Class Method Details
.header ⇒ Object
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_s ⇒ Object
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 |
#type ⇒ Object
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 |