Thread Rating:
  • 0 Vote(s) - 0 Average
Song Ratings for non-library items
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.

CMusicDatabase db;
if (db.Open())      // OpenForWrite() ?
  db.SetSongRating(m_song->GetPath(), m_song->GetMusicInfoTag()->GetRating());
IMO everything local should be in the database, though I'm not sure if this makes all that much sense for some items (in particular for add-on songs).

It seems to me that we could store the tag info in the database regardless - the trick is making sure the items that aren't in the users' database (eg add-on items) don't show up in listings from the library. There needs to be a disconnect between "in the database" and "in the user's library". This *may* already exist - I'm not sure (IIRC we store information about songs that come in from album info lookups, while those songs may not be in the user's library).

Best thing is to start by analysing your database and the queries used to retrieve items/playcount etc. There may be a way to do it so that we store it without affecting anything else.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Song Ratings for non-library items00