
net.kemitix.itunes.medialibrary.AlbumTrackDao Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of itunes-medialibrary Show documentation
Show all versions of itunes-medialibrary Show documentation
Java library for reading/writing to the iTunes MediaLibrary SQLite database
The newest version!
package net.kemitix.itunes.medialibrary;
import java.io.File;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
@Repository
public class AlbumTrackDao extends LibraryDao {
private final String sql;
@Autowired
public AlbumTrackDao(
JdbcTemplate jdbcTemplate,
RowMapper rowMapper,
@Qualifier("album tracks") String sql) {
super(jdbcTemplate, rowMapper);
this.sql = sql;
}
@Override
String getSelectAllSql() {
return sql;
}
@Override
String getSelectByIdSql() {
return sql + " where item_pid = ?";
}
String getSelectByFileSql() {
return sql + " where location = ?";
}
public AlbumTrack find(File file) {
try {
return getJdbcTemplate()
.queryForObject(getSelectByFileSql(), getRowMapper(), file.getName());
} catch (EmptyResultDataAccessException ex) {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy