|
|
@ -24,6 +24,8 @@ import org.libresonic.player.domain.Genre; |
|
|
|
import org.libresonic.player.domain.MediaFile; |
|
|
|
import org.libresonic.player.domain.MediaFile; |
|
|
|
import org.libresonic.player.domain.MusicFolder; |
|
|
|
import org.libresonic.player.domain.MusicFolder; |
|
|
|
import org.libresonic.player.domain.RandomSearchCriteria; |
|
|
|
import org.libresonic.player.domain.RandomSearchCriteria; |
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.jdbc.core.RowMapper; |
|
|
|
import org.springframework.jdbc.core.RowMapper; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
@ -40,6 +42,7 @@ import static org.libresonic.player.domain.MediaFile.MediaType.*; |
|
|
|
* @author Sindre Mehus |
|
|
|
* @author Sindre Mehus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class MediaFileDao extends AbstractDao { |
|
|
|
public class MediaFileDao extends AbstractDao { |
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(MediaFileDao.class); |
|
|
|
private static final String INSERT_COLUMNS = "path, folder, type, format, title, album, artist, album_artist, disc_number, " + |
|
|
|
private static final String INSERT_COLUMNS = "path, folder, type, format, title, album, artist, album_artist, disc_number, " + |
|
|
|
"track_number, year, genre, bit_rate, variable_bit_rate, duration_seconds, file_size, width, height, cover_art_path, " + |
|
|
|
"track_number, year, genre, bit_rate, variable_bit_rate, duration_seconds, file_size, width, height, cover_art_path, " + |
|
|
|
"parent_path, play_count, last_played, comment, created, changed, last_scanned, children_last_updated, present, version"; |
|
|
|
"parent_path, play_count, last_played, comment, created, changed, last_scanned, children_last_updated, present, version"; |
|
|
@ -131,6 +134,7 @@ public class MediaFileDao extends AbstractDao { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public void createOrUpdateMediaFile(MediaFile file) { |
|
|
|
public void createOrUpdateMediaFile(MediaFile file) { |
|
|
|
|
|
|
|
logger.trace("Creating/Updating new media file at {}", file.getPath()); |
|
|
|
String sql = "update media_file set " + |
|
|
|
String sql = "update media_file set " + |
|
|
|
"folder=?," + |
|
|
|
"folder=?," + |
|
|
|
"type=?," + |
|
|
|
"type=?," + |
|
|
|