Skip to content
master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

RadioBrowser4j

Java CI Maven Central ReleaseDate javadoc License

A Java API for the RadioBrowser internet radio station online repository.

The library is useful for applications wanting to retrieve internet radio station URLs, streams and meta information.

How to use

Maven for JDK targets

First step is to include the dependency in your Maven or Gradle project. For Maven, you need this dependency:

<dependency>
    <groupId>de.sfuhrm</groupId>
    <artifactId>radiobrowser4j</artifactId>
    <version>2.2.3</version>
</dependency>

After adding this dependency, you can start by creating one instance and using it

// 5000ms timeout, user agent is Demo agent/1.0
RadioBrowser browser = new RadioBrowser(5000, "Demo agent/1.0");
// print the first 64 stations in station name order
browser.listStations(ListParameter.create().order(FieldName.name))
    .limit(64)
    .forEach(s -> System.out.printf("%s: %s%n",
        s.getName(),
        s.getUrl()
));

You can take a look at the javadoc documentation to get the full concepts of the API.

Gradle for Android targets

Some adjustments are necessary to the packaging of your app build.gradle:

...

android {
...
    packagingOptions {
        exclude 'META-INF/NOTICE.md'
        exclude 'META-INF/LICENSE.md'
        exclude 'META-INF/NOTICE.markdown'
    }
}

dependencies {
...

    implementation 'de.sfuhrm:radiobrowser4j:2.2.3';
}

Add the following statements to the Proguard config if you are obfuscating your build:

-keep class org.glassfish.hk2.utilities.** { *; } -keep class org.glassfish.jersey.** { *; } -keep class org.jvnet.hk2.internal.** { *; } -keep class de.sfuhrm.radiobrowser4j.** { *; }

More examples

The library was extracted from an internet radio player and recorder program in Java, radiorecorder. You can take a look at real-life usage patterns there.

How it is tested

The API is tested using the WireMock REST testing framework. Mocked web requests/responses are located in the test resources.

Version history

  • v2.2.3:
    • Add proxy support for EndpointDiscovery also.
    • Update Jersey dependency to 3.0.4.
    • Fix multiple typos, rework some Javadoc.
  • v2.2.2:
    • Support for HTTP proxy usage.
  • v2.2.1:
    • Update log4j2 test dependency.
  • v2.2.0:
    • Update multiple dependencies.
  • v2.1.0:
    • Switch Jersey JAX-RS 2.3.3 -> 3.0.1.
    • Updated lombok/junit/log4j2 dependencies.
  • v2.0.5:
    • Android support!
  • v2.0.4:
    • Updated dependencies.
  • v2.0.3:
    • Updated dependencies.
  • v2.0.2:
    • Minor code improvements.
    • Updated dependencies.
  • v2.0.0:
    • Support new radiobrowser API.
    • Clients will have to do minor changes to calling the library.
  • v1.3.0:
    • Use new API DNS names.
    • Update maven plugins / dependencies.
  • v1.2.1:
    • Made building with JDK 11 possible.
    • JDK 10/11 building in TravisCI.
    • Updated dependencies.
  • v1.2.0:
    • Minor code improvements.
    • Updated many dependencies, for example Jersey JAX-RS.
  • v1.1.0:
    • Added stream API calls.
    • Added tags list version to Station.
    • ListParameter for list order control.
    • editStation call in RadioBrowser.
  • v1.0.0: First maven release.

License

Copyright 2017-2022 Stephan Fuhrmann

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and