Added tracks to db, beginning to get playlist creation
This commit is contained in:
@@ -56,3 +56,14 @@ pub fn read_artist_mbid(path: &Path) -> Result<Option<String>, lofty::error::Lof
|
||||
|
||||
Ok(tag.get_string(ItemKey::MusicBrainzArtistId).map(String::from))
|
||||
}
|
||||
|
||||
/// Extract the MusicBrainz recording ID from a music file.
|
||||
pub fn read_track_mbid(path: &Path) -> Result<Option<String>, lofty::error::LoftyError> {
|
||||
let tagged_file = lofty::read_from_path(path)?;
|
||||
|
||||
let Some(tag) = tagged_file.primary_tag().or_else(|| tagged_file.first_tag()) else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(tag.get_string(ItemKey::MusicBrainzRecordingId).map(String::from))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user