Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CSong Class Referencefinal

Class to store and read song information from CMusicDatabase. More...

#include <Song.h>

Inheritance diagram for CSong:
ISerializable

Public Member Functions

 CSong ()
 
 CSong (CFileItem &item)
 
void Clear ()
 
void MergeScrapedSong (const CSong &source, bool override)
 
void Serialize (CVariant &value) const override
 
bool operator< (const CSong &song) const
 
const std::vector< std::string > GetArtist () const
 Get artist names from the vector of artistcredits objects.
 
const std::string GetArtistSort () const
 Get artist sort name string.
 
const std::vector< std::string > GetMusicBrainzArtistID () const
 Get artist MusicBrainz IDs from the vector of artistcredits objects.
 
const std::string GetArtistString () const
 Get artist names from the artist description string (if it exists) or concatenated from the vector of artistcredits objects.
 
const std::vector< intGetArtistIDArray () const
 Get song artist IDs (for json rpc) from the vector of artistcredits objects.
 
const std::vector< std::string > GetAlbumArtist () const
 Get album artist names associated with song from tag data Note for initial album processing only, normalised album artist data belongs to album and is stored in album artist credits.
 
const std::string GetAlbumArtistSort () const
 Get album artist sort name string.
 
const std::string GetDiscSubtitle () const
 Get disc subtitle string where one exists.
 
const std::string GetComposerSort () const
 Get composer sort name string.
 
const VECMUSICROLESGetContributors () const
 Get the full list of artist names and the role each played for those that contributed to the recording. Given in music file tags other than ARTIST or ALBUMARTIST, e.g. COMPOSER or CONDUCTOR etc.
 
void AppendArtistRole (const CMusicRole &musicRole)
 
void SetAlbumArtist (const std::vector< std::string > &albumartists)
 Set album artist vector. Album artist is held local to song until album created for initial processing only. Normalised album artist data belongs to album and is stored in album artist credits.
 
bool HasArtistCredits () const
 Whether this song has any artists in artist credits vector Tests if artist credits has been populated yet, during processing there can be artists in the artist description but not yet in the credits.
 
bool HasContributors () const
 Whether this song has any artists in music roles (contributors) vector Tests if contributors has been populated yet, there may be none.
 
bool HasArt () const
 whether this song has art associated with it Tests both the strThumb and embeddedArt members.
 
bool ArtMatches (const CSong &right) const
 whether the art from this song matches the art from another Tests both the strThumb and embeddedArt members.
 
void SetArtistCredits (const std::vector< std::string > &names, const std::vector< std::string > &hints, const std::vector< std::string > &mbids)
 Set artist credits using the arrays of tag values. If strArtistSort (as from ARTISTSORT tag) is already set then individual artist sort names are also processed.
 

Public Attributes

int idSong
 
int idAlbum
 
std::string strFileName
 
std::string strTitle
 
std::string strArtistSort
 
std::string strArtistDesc
 
VECARTISTCREDITS artistCredits
 
std::string strAlbum
 
std::vector< std::string > genre
 
std::string strThumb
 
EmbeddedArtInfo embeddedArt
 
std::string strMusicBrainzTrackID
 
std::string strComment
 
std::string strMood
 
std::string strCueSheet
 
float rating
 
int userrating
 
int votes
 
int iTrack
 
int iDuration
 
std::string strOrigReleaseDate
 
std::string strReleaseDate
 
std::string strDiscSubtitle
 
int iTimesPlayed
 
CDateTime lastPlayed
 
CDateTime dateAdded
 
CDateTime dateUpdated
 
CDateTime dateNew
 
int iStartOffset
 
int iEndOffset
 
bool bCompilation
 
int iBPM
 
int iSampleRate
 
int iBitRate
 
int iChannels
 
std::string strRecordLabel
 
std::string strAlbumType
 
std::string songVideoURL
 
ReplayGain replayGain
 

Additional Inherited Members

- Protected Member Functions inherited from ISerializable
 ~ISerializable ()=default
 

Detailed Description

Class to store and read song information from CMusicDatabase.

See also
CAlbum, CMusicDatabase

Constructor & Destructor Documentation

◆ CSong() [1/2]

CSong::CSong ( )

◆ CSong() [2/2]

CSong::CSong ( CFileItem & item)
explicit

Member Function Documentation

◆ AppendArtistRole()

void CSong::AppendArtistRole ( const CMusicRole & musicRole)

◆ ArtMatches()

bool CSong::ArtMatches ( const CSong & right) const

whether the art from this song matches the art from another Tests both the strThumb and embeddedArt members.

◆ Clear()

void CSong::Clear ( )

◆ GetAlbumArtist()

const std::vector< std::string > CSong::GetAlbumArtist ( ) const
inline

Get album artist names associated with song from tag data Note for initial album processing only, normalised album artist data belongs to album and is stored in album artist credits.

Returns
album artist names as a vector of strings

◆ GetAlbumArtistSort()

const std::string CSong::GetAlbumArtistSort ( ) const
inline

Get album artist sort name string.

Returns
album artist sort name as a single string

◆ GetArtist()

const std::vector< std::string > CSong::GetArtist ( ) const

Get artist names from the vector of artistcredits objects.

Returns
artist names as a vector of strings

◆ GetArtistIDArray()

const std::vector< int > CSong::GetArtistIDArray ( ) const

Get song artist IDs (for json rpc) from the vector of artistcredits objects.

Returns
album artist IDs as a vector of integers

◆ GetArtistSort()

const std::string CSong::GetArtistSort ( ) const

Get artist sort name string.

Returns
artist sort name as a single string

◆ GetArtistString()

const std::string CSong::GetArtistString ( ) const

Get artist names from the artist description string (if it exists) or concatenated from the vector of artistcredits objects.

Returns
artist names as a single string

◆ GetComposerSort()

const std::string CSong::GetComposerSort ( ) const
inline

Get composer sort name string.

Returns
composer sort name as a single string

◆ GetContributors()

const VECMUSICROLES & CSong::GetContributors ( ) const
inline

Get the full list of artist names and the role each played for those that contributed to the recording. Given in music file tags other than ARTIST or ALBUMARTIST, e.g. COMPOSER or CONDUCTOR etc.

Returns
a vector of all contributing artist names and their roles

◆ GetDiscSubtitle()

const std::string CSong::GetDiscSubtitle ( ) const

Get disc subtitle string where one exists.

Returns
disc subtitle as a single string

◆ GetMusicBrainzArtistID()

const std::vector< std::string > CSong::GetMusicBrainzArtistID ( ) const

Get artist MusicBrainz IDs from the vector of artistcredits objects.

Returns
artist MusicBrainz IDs as a vector of strings

◆ HasArt()

bool CSong::HasArt ( ) const

whether this song has art associated with it Tests both the strThumb and embeddedArt members.

◆ HasArtistCredits()

bool CSong::HasArtistCredits ( ) const
inline

Whether this song has any artists in artist credits vector Tests if artist credits has been populated yet, during processing there can be artists in the artist description but not yet in the credits.

◆ HasContributors()

bool CSong::HasContributors ( ) const
inline

Whether this song has any artists in music roles (contributors) vector Tests if contributors has been populated yet, there may be none.

◆ MergeScrapedSong()

void CSong::MergeScrapedSong ( const CSong & source,
bool override )

◆ operator<()

bool CSong::operator< ( const CSong & song) const
inline

◆ Serialize()

void CSong::Serialize ( CVariant & value) const
overridevirtual

Implements ISerializable.

◆ SetAlbumArtist()

void CSong::SetAlbumArtist ( const std::vector< std::string > & albumartists)
inline

Set album artist vector. Album artist is held local to song until album created for initial processing only. Normalised album artist data belongs to album and is stored in album artist credits.

Parameters
albumartist names as a vector of strings

◆ SetArtistCredits()

void CSong::SetArtistCredits ( const std::vector< std::string > & names,
const std::vector< std::string > & hints,
const std::vector< std::string > & mbids )

Set artist credits using the arrays of tag values. If strArtistSort (as from ARTISTSORT tag) is already set then individual artist sort names are also processed.

Parameters
namesString vector of artist names (as from ARTIST tag)
hintsString vector of artist name hints (as from ARTISTS tag)
mbidsString vector of artist Musicbrainz IDs (as from MUSICBRAINZARTISTID tag)

Member Data Documentation

◆ artistCredits

VECARTISTCREDITS CSong::artistCredits

◆ bCompilation

bool CSong::bCompilation

◆ dateAdded

CDateTime CSong::dateAdded

◆ dateNew

CDateTime CSong::dateNew

◆ dateUpdated

CDateTime CSong::dateUpdated

◆ embeddedArt

EmbeddedArtInfo CSong::embeddedArt

◆ genre

std::vector<std::string> CSong::genre

◆ iBitRate

int CSong::iBitRate

◆ iBPM

int CSong::iBPM

◆ iChannels

int CSong::iChannels

◆ idAlbum

int CSong::idAlbum

◆ idSong

int CSong::idSong

◆ iDuration

int CSong::iDuration

◆ iEndOffset

int CSong::iEndOffset

◆ iSampleRate

int CSong::iSampleRate

◆ iStartOffset

int CSong::iStartOffset

◆ iTimesPlayed

int CSong::iTimesPlayed

◆ iTrack

int CSong::iTrack

◆ lastPlayed

CDateTime CSong::lastPlayed

◆ rating

float CSong::rating

◆ replayGain

ReplayGain CSong::replayGain

◆ songVideoURL

std::string CSong::songVideoURL

◆ strAlbum

std::string CSong::strAlbum

◆ strAlbumType

std::string CSong::strAlbumType

◆ strArtistDesc

std::string CSong::strArtistDesc

◆ strArtistSort

std::string CSong::strArtistSort

◆ strComment

std::string CSong::strComment

◆ strCueSheet

std::string CSong::strCueSheet

◆ strDiscSubtitle

std::string CSong::strDiscSubtitle

◆ strFileName

std::string CSong::strFileName

◆ strMood

std::string CSong::strMood

◆ strMusicBrainzTrackID

std::string CSong::strMusicBrainzTrackID

◆ strOrigReleaseDate

std::string CSong::strOrigReleaseDate

◆ strRecordLabel

std::string CSong::strRecordLabel

◆ strReleaseDate

std::string CSong::strReleaseDate

◆ strThumb

std::string CSong::strThumb

◆ strTitle

std::string CSong::strTitle

◆ userrating

int CSong::userrating

◆ votes

int CSong::votes

The documentation for this class was generated from the following files: