Created
September 23, 2017 12:49
-
-
Save confact/d46050c0abacd0d4b6782098260a5677 to your computer and use it in GitHub Desktop.
Getting current playing songs from html pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_song | |
@get_song ||= if @server == 'SHOUTcast' | |
if Gem::Version.new(@version) > Gem::Version.new('2.0') | |
data = hash_get_song_page | |
data['SHOUTCASTSERVER']['SONGTITLE'] || '' | |
else | |
get_song_page.split(',').last.gsub('</body></html>', '') | |
end | |
elsif @server == 'Icecast' | |
data = hash_get_song_page | |
data['playlist']['trackList']['track']['title'] || '' | |
else | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment