diff --git a/src/db_operations.rs b/src/db_operations.rs index 3726ee1..c60dcb9 100644 --- a/src/db_operations.rs +++ b/src/db_operations.rs @@ -11,8 +11,8 @@ pub enum DatabaseCreationError { } pub struct DatabaseRequest { - search_type: SearchType, - search_tag: PartialTag, + pub search_type: SearchType, + pub search_tag: PartialTag, } pub enum SearchType { @@ -21,11 +21,11 @@ pub enum SearchType { } pub struct PartialTag { - path: Option, - title: Option, - artist: Option, - album: Option, - album_artist: Option, + pub path: Option, + pub title: Option, + pub artist: Option, + pub album: Option, + pub album_artist: Option, } impl Default for PartialTag { @@ -147,7 +147,7 @@ impl DBObject { pub fn save_tag(self: &Self, tag: &ItemTag) -> Result<(), DatabaseCreationError> { self.conn.execute( - "INSERT INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )", + "INSERT OR IGNORE INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )", params![tag.path, tag.title, tag.artist, tag.album, tag.album_artist], )?; Ok(())