Breaking News
Home / Java / Java Snippets / How to parse ShoutCast/IceCast Stream Metadata in Java?

How to parse ShoutCast/IceCast Stream Metadata in Java?

Snippet
StreamScraper is a java library that can be used to harvest streaming metadata (current song title, genre, current listener count, etc.) from SHOUTcast/IceCast servers.
Usage

  1. import java.net.URI;
  2. import java.util.List;
  3. import net.moraleboost.streamscraper.Stream;
  4. import net.moraleboost.streamscraper.Scraper;
  5. import net.moraleboost.streamscraper.scraper.IceCastScraper;
  6.  
  7. public class
  8.  
  9. Harvester{
  10.    public static void main(String[] args)throws Exception
  11.    {
  12.         Scraper scraper =newIceCastScraper();    
  13.    List<Stream> streams = scraper.scrape(new URI("http://host:port/"));
  14.        for(Stream stream: streams){
  15.             System.out.println("Song Title: "+ stream.getCurrentSong());              
  16.             System.out.println("URI: "+ stream.getUri());    
  17.        }
  18.   }
  19. }

This library can be downloaded from the Google Code project located at the below url.
http://code.google.com/p/streamscraper/
<!>[pb_builder]

Check Also

How to progamatically get the Java version?

Snippet The key here is to use the system property java.version and get minor and …

Advertisment ad adsense adlogger