Simple examples

Random playlist

The simplest option is to shuffle your local music collection and then select songs until the desired duration is reached. See examples/random-playlist.sh:

# Generate a random playlist from local music collection that lasts for
# $duration.

cpe_local_database=${cpe_local_database-cpe tracker}
duration=${duration-1hour}

$cpe_local_database tracks | \
    cpe shuffle - | \
    cpe select - --constraint=type:playlist-duration,vmin:$duration,vmax:$duration | \
    cpe export -