-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails with unicode in file paths. #11
Comments
Hi there! Can you please give some more information about which errors you get? Testing with
My best guess it that there is genuinely a problem with your tags. |
Hey there, thanks for answering! I made sure the tags are properly applied. I changed them once in iTunes and after it didn't work there, I updated them using Mp3Tag.
After I replaced the two letters with normal ascii chars, they got recognized.
As you seem to have developed use std::path::{Path, PathBuf};
use walkdir::{WalkDir, DirEntry};
pub struct Track {
pub name: String,
pub artist: String,
pub album: String,
pub year: u32,
pub path: PathBuf,
pub audio_properties: Option<AudioProperties>,
}
pub struct AudioProperties {
pub bitrate: i32,
pub vbr: bool,
}
pub fn collect<'a, P: AsRef<Path>>(path: P) -> Vec<Track> {
let mut tracks = Vec::default();
for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
let entry: DirEntry = entry;
if entry.file_type().is_dir() {
continue;
}
let path = entry.path();
let file = match taglib::File::new(&path) {
Ok(f) => f,
Err(e) => {
eprintln!("Failed to open file {:?}", e);
continue;
},
};
match file.tag() {
Ok(t) => {
let track = Track {
name: t.title().unwrap_or_default(),
artist: t.artist().unwrap_or_default(),
album: t.album().unwrap_or_default(),
year: t.year().unwrap_or_default(),
path: PathBuf::from(&path),
audio_properties: None,
};
tracks.push(track);
},
Err(e) => {
// This part is reached twice, once for each file. The error printed out is NoAvailableTag
println!("No available tags for {:?}", &path);
eprintln!("{:?}", e);
}
}
}
return tracks;
} Edit 1: The thing that speaks against this is that just by changing the file name, the file gets opened up and taglib does recognize the tags and my rust code above doesn't print the Edit 2:
Edit 3: Based on that I would just assume that the bindings do something wrong. This is the crate that the author wrote himself. |
Hello :) I was wondering if there is any news regarding this issue? I just ran into the same thing. It works fine if I remove the offending character (Ä and some other accented ones) from the filename (while leaving them in the tags). I also tried katatsuki, the library behind seiri which was mentioned above, and that one did work. |
As far as I am concerned, I am not that familiar with C/++ and their internals so I am not sure as to why this bug happens. I just switched to the library used by seiri which I had no problems so far with. |
I just ran a quick scan over my music library and noticed that two of my songs aren't picked up by taglib. It Throws an error when calling the
tag()
method with the messageNoAvailableTag
.The files in question had the following unicode characters in their file path: Ä, ü and ß.
After some googling I came across this SO post stating that taglib actually should support unicode file paths. Maybe this line needs to actually be of type wchar_t (which is basically an i32) or something similar. I do not work that often in C 😄
Have a great weekend~
The text was updated successfully, but these errors were encountered: