All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rocks.voss.Application Maven / Gradle / Ivy

There is a newer version: 3.7
Show newest version
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;
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy