Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
MUSIC_UTILS Namespace Reference

Classes

class  CSetArtJob
 
class  CSetSongRatingJob
 

Enumerations

enum class  QueuePosition { POSITION_BEGIN , POSITION_END }
 

Functions

void UpdateArtJob (const std::shared_ptr< CFileItem > &pItem, const std::string &strType, const std::string &strArt)
 Helper function to asynchronously update art in the music database and then refresh the album & artist art of the currently playing song. For the song, album or artist this adds a job to the queue to update the art table modifying, adding or deleting that type of art. Changes to album or artist art are then passed to the currently playing song (if there is one).
 
void AddHardCodedAndExtendedArtTypes (std::vector< std::string > &artTypes, const CMusicInfoTag &tag)
 
void AddCurrentArtTypes (std::vector< std::string > &artTypes, const CMusicInfoTag &tag, CMusicDatabase &db)
 
void AddMediaTypeArtTypes (std::vector< std::string > &artTypes, const CMusicInfoTag &tag, CMusicDatabase &db)
 
void AddAvailableArtTypes (std::vector< std::string > &artTypes, const CMusicInfoTag &tag, CMusicDatabase &db)
 
bool FillArtTypesList (CFileItem &musicitem, CFileItemList &artlist)
 Helper function to build a list of art types for a music library item. This fetches the possible types of art for a song, album or artist, and the current art URL (if the item has art of that type), for display on a dialog.
 
std::string ShowSelectArtTypeDialog (CFileItemList &artitems)
 Show a dialog to allow the selection of type of art from a list. Input is a fileitem list, with each item having an "arttype" property e.g. "thumb", current art URL (if art exists), and label. One of these art types can be selected, or a new art type added. The new art type is added as a new item in the list, as well as returned as the selected art type.
 
int ShowSelectRatingDialog (int iSelected)
 Show a dialog to allow the selection of user rating.
 
void UpdateSongRatingJob (const std::shared_ptr< CFileItem > &pItem, int userrating)
 Helper function to asynchronously update the user rating of a song.
 
std::vector< std::string > GetArtTypesToScan (const MediaType &mediaType)
 Get the types of art for an artist or album that are to be automatically fetched from local files during scanning.
 
bool IsValidArtType (const std::string &potentialArtType)
 Validate string is acceptable as the name of an additional art type.
 
bool IsAutoPlayNextItem (const CFileItem &item)
 Check whether auto play next item is set for the given item.
 
void PlayItem (const std::shared_ptr< CFileItem > &item, const std::string &player, ContentUtils::PlayMode mode=ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM)
 Start playback of the given item. If the item is a folder, build a playlist with all items contained in the folder and start playback of the playlist. If item is a single music item, start playback directly, without adding it to the music playlist first.
 
void QueueItem (const std::shared_ptr< CFileItem > &item, QueuePosition pos)
 Queue the given item in the currently active playlist. If none is active, put the item into the music playlist. Start playback of the playlist, if player is not already playing.
 
bool GetItemsForPlayList (const std::shared_ptr< CFileItem > &item, CFileItemList &queuedItems)
 For a given item, get the items to put in a playlist. If the item is a folder, all subitems will be added recursively to the returned item list. If the item is a playlist, the playlist will be loaded and contained items will be added to the returned item list. Shows a busy dialog if action takes certain amount of time to give the user visual feedback.
 
bool IsItemPlayable (const CFileItem &item)
 Check whether the given item can be played by the app playlist player as one or more songs.
 

Enumeration Type Documentation

◆ QueuePosition

enum class MUSIC_UTILS::QueuePosition
strong
Enumerator
POSITION_BEGIN 
POSITION_END 

Function Documentation

◆ AddAvailableArtTypes()

void MUSIC_UTILS::AddAvailableArtTypes ( std::vector< std::string > & artTypes,
const CMusicInfoTag & tag,
CMusicDatabase & db )

◆ AddCurrentArtTypes()

void MUSIC_UTILS::AddCurrentArtTypes ( std::vector< std::string > & artTypes,
const CMusicInfoTag & tag,
CMusicDatabase & db )

◆ AddHardCodedAndExtendedArtTypes()

void MUSIC_UTILS::AddHardCodedAndExtendedArtTypes ( std::vector< std::string > & artTypes,
const CMusicInfoTag & tag )

◆ AddMediaTypeArtTypes()

void MUSIC_UTILS::AddMediaTypeArtTypes ( std::vector< std::string > & artTypes,
const CMusicInfoTag & tag,
CMusicDatabase & db )

◆ FillArtTypesList()

bool MUSIC_UTILS::FillArtTypesList ( CFileItem & musicitem,
CFileItemList & artlist )

Helper function to build a list of art types for a music library item. This fetches the possible types of art for a song, album or artist, and the current art URL (if the item has art of that type), for display on a dialog.

Parameters
musicitema music CFileItem (song, album or artist)
artitems[out] a fileitem list, each item having "arttype" property e.g. "thumb", current art URL (if art exists), and localized label (for common arttypes)
Returns
true if art types are retrieved, false if none is found.
See also
ShowSelectArtTypeDialog

◆ GetArtTypesToScan()

std::vector< std::string > MUSIC_UTILS::GetArtTypesToScan ( const MediaType & mediaType)

Get the types of art for an artist or album that are to be automatically fetched from local files during scanning.

Parameters
mediaType[in] artist or album
Returns
vector of art types that are to be fetched during scanning

◆ GetItemsForPlayList()

bool MUSIC_UTILS::GetItemsForPlayList ( const std::shared_ptr< CFileItem > & item,
CFileItemList & queuedItems )

For a given item, get the items to put in a playlist. If the item is a folder, all subitems will be added recursively to the returned item list. If the item is a playlist, the playlist will be loaded and contained items will be added to the returned item list. Shows a busy dialog if action takes certain amount of time to give the user visual feedback.

Parameters
item[in] the item to add to the playlist
queuedItems[out] the items that can be put in a play list
Returns
true on success, false otherwise

◆ IsAutoPlayNextItem()

bool MUSIC_UTILS::IsAutoPlayNextItem ( const CFileItem & item)

Check whether auto play next item is set for the given item.

Parameters
item[in] the item to check
Returns
True if auto play next item is active, false otherwise.

◆ IsItemPlayable()

bool MUSIC_UTILS::IsItemPlayable ( const CFileItem & item)

Check whether the given item can be played by the app playlist player as one or more songs.

Parameters
itemThe item to check
Returns
True if playable, false otherwise.

◆ IsValidArtType()

bool MUSIC_UTILS::IsValidArtType ( const std::string & potentialArtType)

Validate string is acceptable as the name of an additional art type.

  • limited length, and ascii alphanumberic characters only
    Parameters
    potentialArtType[in] potential art type name
    Returns
    true if the art type is valid

◆ PlayItem()

void MUSIC_UTILS::PlayItem ( const std::shared_ptr< CFileItem > & item,
const std::string & player,
ContentUtils::PlayMode mode = ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM )

Start playback of the given item. If the item is a folder, build a playlist with all items contained in the folder and start playback of the playlist. If item is a single music item, start playback directly, without adding it to the music playlist first.

Parameters
item[in] the item to play
player[in] the player to use, empty for default player
mode[in] queue all successors and play them after item

◆ QueueItem()

void MUSIC_UTILS::QueueItem ( const std::shared_ptr< CFileItem > & item,
QueuePosition pos )

Queue the given item in the currently active playlist. If none is active, put the item into the music playlist. Start playback of the playlist, if player is not already playing.

Parameters
item[in] the item to queue
pos[in] whether to place the item and the begin or the end of the queue

◆ ShowSelectArtTypeDialog()

std::string MUSIC_UTILS::ShowSelectArtTypeDialog ( CFileItemList & artitems)

Show a dialog to allow the selection of type of art from a list. Input is a fileitem list, with each item having an "arttype" property e.g. "thumb", current art URL (if art exists), and label. One of these art types can be selected, or a new art type added. The new art type is added as a new item in the list, as well as returned as the selected art type.

Parameters
artitems[in/out] a fileitem list to display
Returns
the selected art type e.g. "fanart" or empty string when cancelled.
See also
FillArtTypesList

◆ ShowSelectRatingDialog()

int MUSIC_UTILS::ShowSelectRatingDialog ( int iSelected)

Show a dialog to allow the selection of user rating.

Parameters
iSelectedthe rating to show initially
Returns
the selected rating, 0 (no rating), 1 to 10 or -1 no rating selected

◆ UpdateArtJob()

void MUSIC_UTILS::UpdateArtJob ( const std::shared_ptr< CFileItem > & pItem,
const std::string & strType,
const std::string & strArt )

Helper function to asynchronously update art in the music database and then refresh the album & artist art of the currently playing song. For the song, album or artist this adds a job to the queue to update the art table modifying, adding or deleting that type of art. Changes to album or artist art are then passed to the currently playing song (if there is one).

Parameters
itema shared pointer to a music CFileItem (song, album or artist)
strTypethe type of art e.g. "fanart" or "thumb" etc.
strArtart URL, when empty the entry for that type of art is deleted.

◆ UpdateSongRatingJob()

void MUSIC_UTILS::UpdateSongRatingJob ( const std::shared_ptr< CFileItem > & pItem,
int userrating )

Helper function to asynchronously update the user rating of a song.

Parameters
pItempointer to song item being rated
userratingthe userrating 0 = no rating, 1 to 10