(&self, songs: Vec<Song>)
| 1086 | |
| 1087 | #[tracing::instrument(level = "debug", skip(self))] |
| 1088 | pub fn update_songs(&self, songs: Vec<Song>) -> Result<()> { |
| 1089 | trace!("Updating songs"); |
| 1090 | let mut conn = self.pool.get().unwrap(); |
| 1091 | |
| 1092 | for song in songs { |
| 1093 | if let Some(album) = song.album { |
| 1094 | self.update_album(album)?; |
| 1095 | } |
| 1096 | |
| 1097 | if let Some(artist) = song.artists { |
| 1098 | for a in artist { |
| 1099 | self.update_artist(a)?; |
| 1100 | } |
| 1101 | } |
| 1102 | update(allsongs) |
| 1103 | .filter(schema::allsongs::_id.eq(song.song._id.clone())) |
| 1104 | .set(song.song) |
| 1105 | .execute(&mut conn)?; |
| 1106 | } |
| 1107 | info!("Updated songs"); |
| 1108 | Ok(()) |
| 1109 | } |
| 1110 | |
| 1111 | #[tracing::instrument(level = "debug", skip(self))] |
| 1112 | pub fn update_lyrics(&self, id: String, lyrics: String) -> Result<()> { |
no test coverage detected