Different approach for matching title filters

This commit is contained in:
Bill Thiede 2020-02-05 16:50:15 -08:00
parent e3f96f34c9
commit 7fb8a08118

View File

@ -111,15 +111,13 @@ fn list_albums(
.iter_shared_albums_with_all_fields() .iter_shared_albums_with_all_fields()
{ {
let a = album?; let a = album?;
if let Some(title_filter) = &title_filter { match (&title_filter, &a.title) {
match &a.title { // Print everything when no filter or title.
Some(title) => { (None, None) => {}
if !title_filter.is_match(&title) { // skip when filter given but the media item doesn't have a title (it can't match)
continue; (_, None) => continue,
} // skip when the media item doesn't match the filter
} (Some(title_filter), Some(title)) if !title_filter.is_match(&title) => continue,
None => continue,
}
} }
println!( println!(
"album: {} {} ({} items)", "album: {} {} ({} items)",