【问题标题】:banshee: How would I set the rating for a specific track on Banshee through DBus?banshee:如何通过 DBus 为 Banshee 上的特定曲目设置评分?
【发布时间】:2009-10-05 02:11:39
【问题描述】:

我想通过 DBus 界面在 Banshee 上设置特定曲目(即不仅仅是当前播放的曲目)的“评分”?

【问题讨论】:

    标签: python linux dbus banshee


    【解决方案1】:

    Banshee 不通过 DBus 公开评级功能。

    您可以使用 d-feet[1] 等应用程序快速查看它公开的所有功能。确保您感兴趣的应用程序实例(如本例中的 Banshee)正在运行。

    已经有一个错误报告要求向 DBus 界面添加评级功能[2]。您可能想订阅它。

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

    【讨论】:

    • Banshee 1.5.3 中修复了引用的错误。
    【解决方案2】:

    自去年以来,Banshee 确实支持通过命令行进行评级。

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

    查看错误报告了解更多选项: Add item rating to DBus interface

    【讨论】:

      【解决方案3】:

      遗憾的是,开发者还没有实现 GET 方法,因此没有通用的方法来执行“给当前曲目评分 1 星上/下”命令,远不如特定曲目。 有没有人编写过提供此功能的脚本? 然而,我还没有找到任何通过命令行修改 D-Bus 属性的解决方案。 最后,这是我对当前播放曲目进行评分的解决方法。

      #!/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
      

      选项:

      • inc -> 如果可能,将评分增加一
      • dec -> 如果可能,将评分降低 1
      • res -> 将评级重置为三颗星
      • 分钟 -> 将评分设置为零星
      • 最高 -> 将评级设置为五颗星

      到目前为止,Banshee 不会提供特定轨道的操纵数据,这是我最好的选择。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-13
        • 1970-01-01
        • 2012-10-28
        • 2012-05-21
        • 2015-07-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多