Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ICY meta data in python with streamscrobbler #14

Closed
jovanbulck opened this issue Oct 17, 2015 · 1 comment
Closed

Handle ICY meta data in python with streamscrobbler #14

jovanbulck opened this issue Oct 17, 2015 · 1 comment

Comments

@jovanbulck
Copy link
Contributor

You might want to consider handling ICY meta data yourself, instead of getting them from the stdout of mplayer. Advantages include:

  • more control over the finer grained ICY meta data: as far as I can tell, the data is now matched with a regex on the output of mplayer, whereas the raw ICY data seems to be broad casted with some kind of predefined structure.
  • more meta data: mplayer only displays the stream title. There seems to be other interesting meta data (e.g. icy-name, icy-genre, icy-description, ...)
  • independence from mplayer: imagine you want to plug in another media player back-end some day...

This link explains how the SHOUTcast protocol broadcasts the ICY messages and this link provides a rather low-level proof-of-concept python program.

Interestingly, this project provides a python library that does the job. I modified the example program of their README a bit:

from streamscrobbler import streamscrobbler
streamscrobbler = streamscrobbler()

streamurl = "http://mp3.streampower.be/radio1-high"
stationinfo = streamscrobbler.getServerInfo(streamurl)

print "the stationinfo is: ", stationinfo

##metadata is the bitrate and current song
metadata = stationinfo.get("metadata")

print "the metadata is: ", metadata

## status is the integer to tell if the server is up or down, 0 means down, 1 up, 2 means up but also got metadata.
status = stationinfo.get("status")

print "the status is:", status
@GijsTimmers GijsTimmers changed the title Handle ICY meta data in python Handle ICY meta data in python with streamscrobbler Oct 19, 2015
@GijsTimmers
Copy link
Owner

Done. 337a9da

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants