calliope.select

Select tracks for a playlist based on a set of constraints.

This module was inspired by the 2008 paper Music playlist generation by adapted simulated annealing (S. Pauws, W. Verhaegh, M. Vossen).

See calliope.select.constraints for details of the constraints.

Package Contents

Functions

constraint_from_string(text)

select(playlist, constraints)

Select music from input playlist according to a set of constraints.

exception calliope.select.SelectError

Bases: Exception

Exception returned from calliope.select module.

Initialize self. See help(type(self)) for accurate signature.

exception calliope.select.ConstraintStringParseError

Bases: SelectError

Error returned by constraint_from_string().

Initialize self. See help(type(self)) for accurate signature.

calliope.select.constraint_from_string(text)
Parameters

text (str) –

Return type

constraints.Constraint

calliope.select.select(playlist, constraints)

Select music from input playlist according to a set of constraints.

A simple constraint solving algorithm is used to produce a playlist. This involves some random choices, which may produce different results each time the function is called unless the same random seed is used.

See also: cpe select.

Parameters
  • playlist (calliope.playlist.Playlist) – input songs (order isn’t important)

  • constraints ([select.constraints]) – one or more Constraint instances

Returns

A playlist that satisfies the constraints.

Return type

calliope.playlist.Playlist