Helper Utilities

Various utilities that you might enjoy while using libmunin.

class munin.helper.AudioFileWalker(base_path, extensions=['mpc', 'mp4', 'mp3', 'flac', 'wav', 'ogg', 'm4a', 'wma'])[source]

File Iterator that yields all files with a specific ending.

There ist a list of default extensions in munin.helpers.ALLOWED_FORMATS with the most common formats.

This class implements __iter__, so you just can start using it.

  • base_path – Recursively seach files in this path.
  • extensions – An iterable of extensions that are allowed.

munin.helper.pairup(provider, distance_function, weight)[source]

Convienience function for easy mask building.

Every distance function needs to know the provider that processed the value. This is needed to implement the compress functionality. In order to stop you from writing code like this:

>>> prov = Provider()
>>> dfunc = DistanceFunction(prov)
>>> # Somehwere down:
>>> {'artist': (prov, dfunc, 0.5)}

You can just write:

>>> {'artist': pairup(Provider(), DistanceFunction(), 0.5)}

This function will set the provider in the DistanceFunction for you.

munin.helper.float_cmp(a, b)

Itertools recipes:

Copied from the standard documentation:

munin.helper.grouper(iterable, n, fillvalue=None)[source]

Collect data into fixed-length chunks or blocks

Related Topics

This Page

Useful links: