jldupont
jldupont

Reputation: 96716

banshee: How would I set the rating for a specific track on Banshee through DBus?

I'd like to set the 'rating' of a specific track (i.e. not only the one currently playing) on Banshee through the DBus interface?

Upvotes: 1

Views: 742

Answers (3)

Frozen_byte
Frozen_byte

Reputation: 272

Sadly the developer have not implemented a GET method, so there is no common way to execute "rate current track 1 star up/down"-command, much less than a specific track. Does anyone has written a script which provide this feature? Yet, I haven't found any solution to modify the D-Bus Property via command line. Finally here is my Workaround for rate the current played Track.

#!/bin/bash

#read current TrackRating
R=$(qdbus org.mpris.MediaPlayer2.banshee /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep 'userRating' | tr -d '/xesam:userRating: ')

case $R in 
 '' )    R=0 ;;
 '0.2' ) R=1 ;;
 '0.4' ) R=2 ;;
 '0.6' ) R=3 ;;
 '0.8' ) R=4 ;;
 '1'   ) R=5 ;;
esac

case $1 in
 'inc' )    [ $R -lt 5 ] 
            banshee --set-rating=$(($R+1)) ;;
 'dec' )    [ $R -gt 0 ]
            banshee --set-rating=$(($R-1)) ;;
 'res' ) banshee --set-rating=3 ;;
 'min' ) banshee --set-rating=0 ;;
 'max' ) banshee --set-rating=5 ;;
esac

Options:

  • inc -> increase rating by one if possible
  • dec -> decrease rating by one if possible
  • res -> reset rating to three stars
  • min -> set rating to zero stars
  • max -> set rating to five stars

As far Banshee will not provide manipulating data of a specific Track this is my best bet.

Upvotes: 1

guerda
guerda

Reputation: 24049

Banshee does support rating via commandline since last year.

banshee --set-rating={1;2;3;4;5}

See the bug report for more options: Add item rating to DBus interface

Upvotes: 2

tm_lv
tm_lv

Reputation: 6487

Banshee does not expose rating functions via DBus.

You can quickly view all functions that it exposes, using applications like d-feet[1]. Make sure that an instance of the application you are interested in (like Banshee in this case) is running.

There is a bug report already requesting to add rating functionality[2] to DBus interface. You might want to subscribe to it.

  1. https://fedorahosted.org/d-feet/
  2. https://bugzilla.gnome.org/show_bug.cgi?id=579754

Upvotes: 2

Related Questions