Merge pull request #60 from agersant/index
More readable profile markers
This commit is contained in:
commit
e2c9e64bf7
1 changed files with 16 additions and 6 deletions
|
@ -99,8 +99,15 @@ impl IndexUpdater {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "profile-index", flame)]
|
|
||||||
fn populate_directory(&mut self, parent: Option<&Path>, path: &Path) -> Result<()> {
|
fn populate_directory(&mut self, parent: Option<&Path>, path: &Path) -> Result<()> {
|
||||||
|
|
||||||
|
#[cfg(feature = "profile-index")]
|
||||||
|
let _guard = flame::start_guard(format!("dir: {}",
|
||||||
|
path.file_name().map(|s| {
|
||||||
|
s.to_string_lossy().into_owned()
|
||||||
|
}).unwrap_or("Unknown".to_owned())
|
||||||
|
));
|
||||||
|
|
||||||
// Find artwork
|
// Find artwork
|
||||||
let artwork = {
|
let artwork = {
|
||||||
#[cfg(feature = "profile-index")]
|
#[cfg(feature = "profile-index")]
|
||||||
|
@ -140,8 +147,7 @@ impl IndexUpdater {
|
||||||
|
|
||||||
// Insert content
|
// Insert content
|
||||||
for file in fs::read_dir(path)? {
|
for file in fs::read_dir(path)? {
|
||||||
#[cfg(feature = "profile-index")]
|
|
||||||
let _guard = flame::start_guard("directory-entry");
|
|
||||||
let file_path = match file {
|
let file_path = match file {
|
||||||
Ok(ref f) => f.path(),
|
Ok(ref f) => f.path(),
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -150,6 +156,13 @@ impl IndexUpdater {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "profile-index")]
|
||||||
|
let _guard = flame::start_guard(format!("file: {}",
|
||||||
|
file_path.as_path().file_name().map(|s| {
|
||||||
|
s.to_string_lossy().into_owned()
|
||||||
|
}).unwrap_or("Unknown".to_owned())
|
||||||
|
));
|
||||||
|
|
||||||
if file_path.is_dir() {
|
if file_path.is_dir() {
|
||||||
sub_directories.push(file_path.to_path_buf());
|
sub_directories.push(file_path.to_path_buf());
|
||||||
continue;
|
continue;
|
||||||
|
@ -158,9 +171,6 @@ impl IndexUpdater {
|
||||||
if let Some(file_path_string) = file_path.to_str() {
|
if let Some(file_path_string) = file_path.to_str() {
|
||||||
if let Some(tags) = metadata::read(file_path.as_path()) {
|
if let Some(tags) = metadata::read(file_path.as_path()) {
|
||||||
|
|
||||||
#[cfg(feature = "profile-index")]
|
|
||||||
let _guard = flame::start_guard("process_song");
|
|
||||||
|
|
||||||
if tags.year.is_some() {
|
if tags.year.is_some() {
|
||||||
inconsistent_directory_year |=
|
inconsistent_directory_year |=
|
||||||
directory_year.is_some() && directory_year != tags.year;
|
directory_year.is_some() && directory_year != tags.year;
|
||||||
|
|
Loading…
Add table
Reference in a new issue