pianod2
multisource multiuser scriptable networked music player
Classes | Typedefs | Enumerations | Functions | Variables
MusicLibrary Namespace Reference

Memory-based index/database of music library contents. More...

Classes

class  Foundation
 
class  Playlist
 A PianodPlaylist for music libraries. More...
 
class  TransientPlaylist
 
class  Artist
 A PianodArtist that contains a vector of albums. More...
 
class  Album
 A PianodAlbum that contains a vector of songs. More...
 
class  Song
 A PianodSong made of inbred data structures. More...
 
class  ThingieContainer
 Customized hash tables for music library. More...
 
class  Allocator
 
class  Library
 
class  LibraryParameters
 
class  NameAggregator
 Make a list of unique strings. More...
 

Typedefs

using BiasType = double
 

Enumerations

enum class  ScanFrequency { NEVER , NEXTSTARTUP , EVERYSTARTUP , DAILY }
 

Functions

static BiasType compute_biases (const RetainedList< Song * > &candidates, std::vector< BiasType > &biases, const std::vector< UserData::Ratings * > &users_ratings, const std::vector< UserData::OverplayedList * > &overplay_ratings, const LibraryParameters &settings, const bool album_mode)
 Calculate bias values for some songs. More...
 
static RetainedList< Song * > get_biased_selections (const RetainedList< Song * > &candidates, const std::vector< BiasType > &biases, const BiasType total_bias, const SongList::size_type requested_count)
 Pick some songs from a biased list at random. More...
 
static bool isCompilationAlbum (const Parsnip::Data &album)
 
std::string persistentId (MusicThingie::Type item_type, const std::string &key)
 Use an item's type and a string key generate a id string. More...
 

Variables

Allocator< Artist, Foundationartist_allocate
 
Allocator< Album, Artistalbum_allocate
 
Allocator< Song, Albumsong_allocate
 
Allocator< Playlist, Foundationplaylist_allocate
 
static const int BIAS_MINIMUM = 1
 
static const int BIAS_MAXIMUM = 100
 
static const int BIAS_NEUTRAL = 1
 Neutral biasing factor for choosing songs. More...
 
const LookupTable< MusicLibrary::ScanFrequencyRescanModes ({ {"never", ScanFrequency::NEXTSTARTUP}, {"once", ScanFrequency::NEXTSTARTUP}, {"always", ScanFrequency::EVERYSTARTUP}, {"periodically", ScanFrequency::DAILY} })
 
static const std::string noPlaylistName = "Bibliotheque"
 

Detailed Description

Memory-based index/database of music library contents.

Element and attribute keys for ratings.

Typedef Documentation

◆ BiasType

using MusicLibrary::BiasType = typedef double

Enumeration Type Documentation

◆ ScanFrequency

Enumerator
NEVER 
NEXTSTARTUP 
EVERYSTARTUP 
DAILY 

Function Documentation

◆ compute_biases()

static BiasType MusicLibrary::compute_biases ( const RetainedList< Song * > &  candidates,
std::vector< BiasType > &  biases,
const std::vector< UserData::Ratings * > &  users_ratings,
const std::vector< UserData::OverplayedList * > &  overplay_ratings,
const LibraryParameters settings,
const bool  album_mode 
)
static

Calculate bias values for some songs.

Parameters
candidatesThe list of songs for which to compute biases.
[out]biasesOn return, the computed biases.
users_ratingsUsers' song ratings to consider.
overplay_ratingsUsers' overplay ratings to consider.
settingsLibrary parameters, for biasing levels.
album_modeIf true, compute/adjust probabilities for album selection, and avoid biasing in favor of albums with more tracks.
Returns
The amount of bias in the biases table.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_biased_selections()

static RetainedList<Song *> MusicLibrary::get_biased_selections ( const RetainedList< Song * > &  candidates,
const std::vector< BiasType > &  biases,
const BiasType  total_bias,
const SongList::size_type  requested_count 
)
static

Pick some songs from a biased list at random.

  • A random number is chosen such that 0 <= n < total_bias.
  • We then search the bias values to find the index with range containing n.
  • The corresponding song is the next contestant.
    Parameters
    candidatesThe songs to pick from.
    biasesThe biases, in index locations matching candidates.
    total_biasThe total range of bias from which to choose.
    requested_countThe number of songs to pick.
    Returns
    The songs picked. At least 1 song will be returned.
    Warning
    May return fewer songs than requested, especially if request_count ≅ candidates.size().
Here is the caller graph for this function:

◆ isCompilationAlbum()

static bool MusicLibrary::isCompilationAlbum ( const Parsnip::Data album)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ persistentId()

std::string MusicLibrary::persistentId ( MusicThingie::Type  item_type,
const std::string &  key 
)
inline

Use an item's type and a string key generate a id string.

Returns
ID, consisting of a letter for the type, then a hashed value from the string.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ album_allocate

Allocator< Album, Artist > MusicLibrary::album_allocate

◆ artist_allocate

Allocator< Artist, Foundation > MusicLibrary::artist_allocate

◆ BIAS_MAXIMUM

const int MusicLibrary::BIAS_MAXIMUM = 100
static

◆ BIAS_MINIMUM

const int MusicLibrary::BIAS_MINIMUM = 1
static

◆ BIAS_NEUTRAL

const int MusicLibrary::BIAS_NEUTRAL = 1
static

Neutral biasing factor for choosing songs.

◆ noPlaylistName

const std::string MusicLibrary::noPlaylistName = "Bibliotheque"
static

◆ playlist_allocate

Allocator< Playlist, Foundation > MusicLibrary::playlist_allocate

◆ RescanModes

const LookupTable< ScanFrequency > MusicLibrary::RescanModes ( { {"never", ScanFrequency::NEXTSTARTUP}, {"once", ScanFrequency::NEXTSTARTUP}, {"always", ScanFrequency::EVERYSTARTUP}, {"periodically", ScanFrequency::DAILY} }  )

◆ song_allocate

Allocator< Song, Album > MusicLibrary::song_allocate