2012-04-04, 13:39
I would like to tighten up the SongRating functionality in GUIDialogSongInfo. Currently, song rating doesn't pay attention to whether or not the song is in the users library database. If the song is not in the db, the SongRatings changes are lost. This gives the user the false impression they are actually setting a rating for their song.
I've thought of two ideas so far, but could use some input to determine the best solution overall.
a) Detect that the song is not in the library and therefore hide the ratings and up/down buttons.
Can someone point me to existing code that hides xbmc interface items based upon criteria?
b) Detect that the song is not in the library and therefore pop a dialog when the user tries to change the song rating.
Can someone point me to existing code that pops an xbmc messagebox?
For both ideas, I need to be able to determine if the song is in the library db. Can someone point me to the proper way to detect if a song is in the music library database?
Additionally, this code comment makes me wonder if the functionality I'm hoping to fix is resolved by opening the database for write.
I've thought of two ideas so far, but could use some input to determine the best solution overall.
a) Detect that the song is not in the library and therefore hide the ratings and up/down buttons.
Can someone point me to existing code that hides xbmc interface items based upon criteria?
b) Detect that the song is not in the library and therefore pop a dialog when the user tries to change the song rating.
Can someone point me to existing code that pops an xbmc messagebox?
For both ideas, I need to be able to determine if the song is in the library db. Can someone point me to the proper way to detect if a song is in the music library database?
Additionally, this code comment makes me wonder if the functionality I'm hoping to fix is resolved by opening the database for write.
Code:
CMusicDatabase db;
if (db.Open()) // OpenForWrite() ?
{
db.SetSongRating(m_song->GetPath(), m_song->GetMusicInfoTag()->GetRating());
db.Close();
}