}
};
private DataSource getDataSource() {
try {
final SQLiteDataSource ds = new SQLiteDataSource();
String pluginDir = PMS.getConfiguration().getPluginDirectory();
File config = new File(pluginDir + "/" + "banshee.cfg");
String filePath = null;
if (config.exists()) {
Properties props = new Properties();
InputStream in = null;
try {
in = new FileInputStream(config);
props.load(in);
String type = props.getProperty("type");
if (type.equals("Banshee")) {
filePath = props.getProperty("db");
}
} finally {
in.close();
}
} else {
String home = System.getProperty("user.home");
filePath = String.format("%s/.config/banshee-1/banshee.db",
home);
}
filePath = String.format("jdbc:sqlite:%s", filePath);
if (null != filePath) {
ds.setUrl(filePath);
return ds;
}
} catch (Exception e) {
log.error("Could not create datasource", e);
return null;