music21.metadata.caching¶
Functions¶
-
music21.metadata.caching.
cacheMetadata
(corpusNames=('local', 'core', 'virtual'), useMultiprocessing=True, verbose=False)¶ Cache metadata from corpora in corpusNames as local cache files:
Call as
metadata.cacheMetadata()
JobProcessor¶
-
class
music21.metadata.caching.
JobProcessor
¶ Processes metadata-caching jobs, either serially (e.g. single-threaded) or in parallel, as a generator.
Yields a dictionary of:
- MetadataEntry instances
- failed file paths
- the last processed file path
- the number of remaining jobs
>>> jobs = [] >>> for corpusPath in corpus.getMonteverdiMadrigals()[:3]: ... job = metadata.caching.MetadataCachingJob( ... corpusPath, ... useCorpus=True, ... ) ... jobs.append(job) >>> jobGenerator = metadata.caching.JobProcessor.process_serial(jobs) >>> for result in jobGenerator: ... print(result['remainingJobs']) ... 2 1 0
JobProcessor
methods
-
static
JobProcessor.
process_parallel
(jobs, processCount=None)¶ Process jobs in parallel, with processCount processes.
If processCount is none, use 1 fewer process than the number of available cores.
jobs is a list of
MetadataCachingJob
objects.
-
static
JobProcessor.
process_serial
(jobs)¶ Process jobs serially.
MetadataCachingJob¶
-
class
music21.metadata.caching.
MetadataCachingJob
(filePath, jobNumber=0, useCorpus=True)¶ Parses one corpus path, and attempts to extract metadata from it:
>>> from music21 import metadata >>> job = metadata.caching.MetadataCachingJob( ... 'bach/bwv66.6', ... useCorpus=True, ... ) >>> job.run() ((<music21.metadata.bundles.MetadataEntry: bach_bwv66_6>,), ()) >>> results = job.getResults() >>> errors = job.getErrors()
TODO: error list, nut just numbers needs to be reported back up.
MetadataCachingJob
read-only properties
-
MetadataCachingJob.
cleanFilePath
¶
MetadataCachingJob
methods
-
MetadataCachingJob.
getErrors
()¶
-
MetadataCachingJob.
getResults
()¶
-
MetadataCachingJob.
parseFilePath
()¶
-
MetadataCachingJob.
parseNonOpus
(parsedObject)¶
-
MetadataCachingJob.
parseOpus
(parsedObject)¶
-
MetadataCachingJob.
parseOpusScore
(score, scoreNumber)¶
-
MetadataCachingJob.
run
()¶
WorkerProcess¶
-
class
music21.metadata.caching.
WorkerProcess
(job_queue, result_queue)¶ A worker process for use by the multithreaded metadata-caching job processor.
WorkerProcess
methods
-
WorkerProcess.
run
()¶