Skip to main content

find_works

Function find_works 

Source
pub fn find_works(directory: &str, paths: &[PathBuf]) -> Vec<CorpusWork>
Expand description

The works a directory’s files make, in the order their files first come: music21’s DirectoryInformation.findWorks. A file is placed after the first place the directory’s name appears in its path; a file whose format is not known is left out.

use std::path::PathBuf;
use music21::corpus::work::find_works;

let paths = [
    PathBuf::from("/c/schoenberg/opus19/movement2.mxl"),
    PathBuf::from("/c/schoenberg/opus19/movement6.mxl"),
];
let works = find_works("schoenberg", &paths);
assert_eq!(works[0].title, "Opus 19");
assert_eq!(works[0].files[1].path, "schoenberg/opus19/movement6.mxl");
assert_eq!(works[0].files[1].title, "Movement 6");