Je voudrais la possibilité d'obtenir/définir la note associée à une piste spécifique à travers un Python. Comment puis-je y parvenir?Rhythmbox: comment accéder au champ 'rating' d'une piste via un script Python?
2
A
Répondre
3
Vous pouvez utiliser l'interface D-Bus de Rhythmbox. J'ai écrit un petit script qui peut obtenir/définir la note et affiche une notification, tous agissant sur la chanson en cours de lecture.
Le script est ici: http://kaizer.se/wiki/code/rhrating.py
Addendum un: Je vous promets que j'écris plus beau Python quand il est pas un script jetable!
Addendum deux: Le manque chaîne d'utilisation est ./rhrating.py [NEWRATING 0..5]
Addendum trois: Si je filtre le script et retirer les parties qui définissent exactement la cote d'une chanson à l'emplacement du système de fichiers uri
, il est ceci:
import dbus
bus = dbus.Bus()
service_name = "org.gnome.Rhythmbox"
sobj_name = "/org/gnome/Rhythmbox/Shell"
siface_name = "org.gnome.Rhythmbox.Shell"
def set_rating(uri, rating):
searchobj = bus.get_object(service_name, sobj_name)
shell = dbus.Interface(searchobj, siface_name)
shell.setSongProperty(uri, "rating", float(rating))
duplicata possible de [Comment puis-je définir la note d'une chanson en jouant dans Rhythmbox 2.96?] (http://stackoverflow.com/questions/10568599/how-can-i-set-the-rating-of-a-song- jouer-dans-rhythmbox-2-96) – mgibsonbr