rocks.voss.Application Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toniebox-api Show documentation
Show all versions of toniebox-api Show documentation
API to handle request for the Toniebox
package rocks.voss;
import org.apache.commons.lang3.StringUtils;
import rocks.voss.toniebox.beans.Tonie;
import rocks.voss.toniebox.TonieHandler;
import rocks.voss.toniebox.beans.toniebox.TonieChapterBean;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;
public class Application {
public static void main(String[] args) throws IOException {
String resourceName = "toniebox.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Properties props = new Properties();
try(InputStream resourceStream = loader.getResourceAsStream(resourceName)) {
props.load(resourceStream);
}
TonieHandler tonieHandler = new TonieHandler(props.getProperty("username"), props.getProperty("password"));
List tonies = tonieHandler.getTonies();
for (Tonie tonie : tonies) {
System.out.println(tonie);
if (StringUtils.equals(tonie.getName(), "TEST TONIE")) {
for (TonieChapterBean bean : tonieHandler.getTonieDetails(tonie).getData().getChapters()) {
System.out.println(bean.getTitle());
}
// tonieHandler.uploadFile(tonie, "Tonie Musik", "/Users/voss/Public/test/test.mp3");
return;
}
}
}
}