Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Song ratings
#31
(09-23-2021, 08:18 AM)cprogrammer Wrote: It will not be difficult to support ratings. I use this in my setup and mpd supports this by enabling this in mpd.conf. The moment you put the sticker_file entry in mpd.conf, a sqlite table is created with the schema as below. You are free to use this sticker database for anything and not just rating.


Code:
$ grep sticker /etc/mpd.conf
sticker_file /var/lib/mpd/MDrive/data/sticker.db

$ sqlite3 /var/lib/mpd/MDrive/data/sticker.db
sqlite> .schema
CREATE TABLE sticker(  type VARCHAR NOT NULL,   uri VARCHAR NOT NULL,   name VARCHAR NOT NULL,   value VARCHAR NOT NULL);
CREATE UNIQUE INDEX sticker_value ON sticker(type, uri, name);
CREATE INDEX rating        on sticker(value);



Now to implement rating one can use the mpc sticker command. Let us say i have a song with a URI 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac'

The first command below will set the rating to 5. The second command will get the rating

Code:
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' set rating 5
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' get rating
rating=5

Now let us say I want to implement play counts and let us decide we will name this field as PlayCount. So this is what I will do


Code:
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' set PlayCount 1
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' get PlayCount
PlayCount=1
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' set PlayCount 4
$ mpc sticker 'Lobo 1971-2006 (flac)/1973 - Calumet - Rhino/15 - How Can I Tell Her (Early Version).flac' get PlayCount
PlayCount=4

The database is so flexible that you don't even require to pre-populate it. I have written a C program (called mpdev_update) using sqlite api to pre-populate this sqlite database and it takes less than 5 seconds to update around 60,000 songs first time. I'm also using a concept called 'karma'. All songs start with a karma of 50. When I don't like a song and I skip the song  and don't listen to more than 85% of the song, I decrease the karma of a song. When I play the same song multiple times, I increase the karma of a song. Over a period of time I have build a database of all my songs with play counts, last played, rating and karma and I use a simple shell which uses sqlite3 command to query this database an auto-generate various playlists just like itunes 'smart playlists'.

I would very much love to have this feature in moode. That will allow me to use moode from my smart phone to be able to rate songs. At the moment I am forced to use a laptop with cantata to be able to rate songs. Though Cantata is an excellent mpd player, it is no longer being maintained. Currently I use rompr on the smart phone to rate songs. But rompr doesn't use the sticker db. It uses it's own MySQL db. So what I do is have a daemon which updates rating from the MySQL db back to the sticker db (only records that change).

I also use a daemon that I wrote which connects to mpd on 6600 and uses the IDLE command and it updates an sqlite database for last played, playcount, etc and also scrobbles tracks to last.fm and libre.fm - MPD Event Watcher

EDIT: I forgot to add a feature of sticker db. A good thing about sticker is that mpd removes entries from the sticker db when you delete a song.

Added to the TODO list for post 7.4.0 release.

Are the items below the UI elements that need to be visible for each track?

1. Song rating
- Number or row of Star icons?
- Range?

2. Play count
- Number or row of tick marks indicating popularity?
- Range

I see there is also a mechanism for uploading titles to last.fm/libre.fm. Are these services still popular?

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#32
(09-23-2021, 11:06 AM)Tim Curtis Wrote: Added to the TODO list for post 7.4.0 release.

Are the items below the UI elements that need to be visible for each track?

1. Song rating
- Number or row of Star icons?
- Range?

2. Play count
- Number or row of tick marks indicating popularity?
- Range

I see there is also a mechanism for uploading titles to last.fm/libre.fm. Are these services still popular?
  • Yes. The rating should be shown for all songs in the playlist. Using that, one will be able to quickly remove or reorder the playlist as per the listener's taste.
  • Using star icons is most common. We can have a row of 5 stars with ability to mark half a star. That would allow people to rate songs from 1 to 10. But even without having the ability to mark half a star is fine (in which case song will have rating from 1 to 5)
  • For play count, showing a number appears to be more intuitive and helpful. We can have a limit. anything > 99 will show as > 99. Else we will not be able to limit the width of the play count in the UI and we could probably mess the UI. But since I don't have a idea how the programming works in the UI, I'm not sure what is the right thing to do here. Or it could be some image that is shown indicating that the song has been played often.
  • last.fm is a social thing. I personally don't care for it, but I have enabled it just for the heck of it. But when you start scrobbling, the stats it shows on the site reveal what kind of music you listen more often, etc. I'm not sure how many would really want this service.
Reply
#33
Different strokes for different folks.

My desire is for the tracking of ratings and play counts to be optional and for the display of tracks in UI Playback and Library screens to be unchanged if I don't enable the option.


As an aside, I'd never had a use for the MPD sticker database. Since it is a separate sqlite table and not part of the MPD "database" is it automagically updated during an MPD library update operation or must this be done separately? 

Regards,
Kent
Reply
#34
Of cause it would be optional.

It looks like adds and updates to the sticker db are manual but deletes are handled by MPD. I think thats the way it has to work.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#35
I'd really love having these options available! "karma" is brilliant, and having song ratings and play counts would be a blessing for the way I play my music library.

I've checked on my 7.6.1 installation, seems like the sticker db is there already (as "sticker.sql").

Has this capability been implemented, and if affirmative how could we access it?

Warm thanks in advance to Both of you @Tim Curtis and  @cprogrammer!!!
Reply


Forum Jump: