1% 2% anyremote configuration file for management of MPRIS-compatible players. (Server-mode) 3% 4 5% STATUS nonstable 6% XTEST no 7% SOUND app/amixer 8% ENV no 9% ALL_IN_ONE 10% TODO Wait MPRIS v2.0 to support playlist operations (v1 do not allow to select track in playlist) 11 12GuiAppName=MPRIS 13GuiAppBinary=true 14GuiAppType=Application 15GuiAppProtocols=Server 16GuiAppDesc=Manage appliucation through MPRIS (Media Player Remote Interfacing Specification) 17[Protocol]=Server 18 19(Init)=\ 20 Include($(CfgDir)/Utils/aliases-server.cfg);\ 21 Macro(SETUP_DEFAULT_MIXER);\ 22 Macro(SETUP_DEFAULT_POWER_MANAGEMENT);\ 23 Macro(TEST_QDBUS);\ 24 Make(var,mpris_volume,by_value,-1);\ 25 Make(var,mpris_app,by_value,---); 26 27(Connect)=\ 28 Make(mode,mpris); 29 30[Mode]=mpris 31 32(EnterMode)=\ 33 Set(layout,default);\ 34 Set(status,$(mpris_app));\ 35 Set(icons,MPRIS,1,vol_down,2,mute,3,vol_up,4,rewind,5,play,6,forward,7,prev,8,pause,9,next,*,question,0,stop,#,no);\ 36 Macro(MPRIS_MENU); 37 38Cancel=\ 39 Make(exit); 40 41MPRIS_MENU=\ 42 Set(menu,replace,Browse MPRIS,Run App,Repeat,Random,PowerMgmt);\ 43 Macro(ALLIN1MENU); 44 45MPRIS_DELTIMER=\ 46 Timer(MPRIS_SETTITLE,cancel); 47 48MPRIS_SETTITLE=\ 49 Make(var,artist,TN=`qdbus org.mpris.$(mpris_app) /TrackList GetCurrentTrack 2> /dev/null`; \ 50 if [ "x$TN" != "x" ]; then qdbus org.mpris.$(mpris_app) /TrackList GetMetadata $TN 2> /dev/null|grep artist|cut -f 2 -d ":"; fi);\ 51 Make(var,title, TN=`qdbus org.mpris.$(mpris_app) /TrackList GetCurrentTrack 2> /dev/null`; \ 52 if [ "x$TN" != "x" ]; then qdbus org.mpris.$(mpris_app) /TrackList GetMetadata $TN 2> /dev/null|grep title |cut -f 2 -d ":"; fi);\ 53 Make(var,album, TN=`qdbus org.mpris.$(mpris_app) /TrackList GetCurrentTrack 2> /dev/null`; \ 54 if [ "x$TN" != "x" ]; then qdbus org.mpris.$(mpris_app) /TrackList GetMetadata $TN 2> /dev/null|grep album |cut -f 2 -d ":"; fi);\ 55 Set(title,$(album) - $(title));\ 56 Set(status,$(artist)); 57 58MPRIS_POS=\ 59 Make(var,mpris_pos,qdbus org.mpris.$(mpris_app) /Player PositionGet 2> /dev/null); 60 61MPRIS_GETVOL=\ 62 Make(var,mpris_vol,qdbus org.mpris.$(mpris_app) /Player VolumeGet|tr -d '\n' 2> /dev/null); 63 64Back=\ 65 Set(text,close);\ 66 Macro(MPRIS_MENU); 67 68Back($$)=\ 69 Set(list,close);\ 70 Macro(MPRIS_MENU); 71 72 731=Macro(MPRIS_GETVOL);\ 74 Make(var,mpris_vol,echo "$(mpris_vol)-5"|bc);\ 75 Exec(qdbus org.mpris.$(mpris_app) /Player VolumeSet $(mpris_vol)); 76 77% VolumeGet add \n to value. Use some tricks to strip it 782=Make(var,mpris_volume,\ 79 if [ "x$(mpris_volume)" = "x-1" ] || [ "x$(mpris_volume)" = "x" ]; \ 80 then \ 81 qdbus org.mpris.$(mpris_app) /Player VolumeGet;qdbus org.mpris.$(mpris_app) /Player VolumeSet 0; \ 82 else \ 83 qdbus org.mpris.$(mpris_app) /Player VolumeSet $(mpris_volume); echo "-1"; fi);\ 84 Make(var,mpris_volume,echo "$(mpris_volume) an-trick-to-strip-new-line"|tr -d '\n'|cut -f 1 -d ' '); 85 863=Macro(MPRIS_GETVOL);\ 87 Make(var,mpris_vol,echo "$(mpris_vol)+5"|bc);\ 88 Exec(qdbus org.mpris.$(mpris_app) /Player VolumeSet $(mpris_vol) 2> /dev/null); 89 904=Macro(MPRIS_POS);\ 91 Make(var,mpris_pos,echo "$(mpris_pos)-10000"|bc);\ 92 Exec(qdbus org.mpris.$(mpris_app) /Player PositionSet $(mpris_pos) 2> /dev/null);\ 93 Macro(MPRIS_SETTITLE); 94 955=Exec(qdbus org.mpris.$(mpris_app) /Player Play 2> /dev/null);\ 96 Macro(MPRIS_SETTITLE);\ 97 Timer(MPRIS_SETTITLE,$(UpdateTimeout),0); 98 996=Macro(MPRIS_POS);\ 100 Make(var,mpris_pos,echo "$(mpris_pos)+10000"|bc);\ 101 Exec(qdbus org.mpris.$(mpris_app) /Player PositionSet $(mpris_pos) 2> /dev/null);\ 102 Macro(MPRIS_SETTITLE); 103 1047=Exec(qdbus org.mpris.$(mpris_app) /Player Prev 2> /dev/null);\ 105 Macro(MPRIS_SETTITLE); 1068=Exec(qdbus org.mpris.$(mpris_app) /Player Pause 2> /dev/null);\ 107 Macro(MPRIS_SETTITLE); 1089=Exec(qdbus org.mpris.$(mpris_app) /Player Next 2> /dev/null);\ 109 Macro(MPRIS_SETTITLE); 110 111* *=Set(text,replace,Help,1 - Vol-\n2 - Mute\n3 - Vol+\n4 - Rewind\n5 - Play\n6 - FF\n7 - Previous\n8 - Pause\n9 - Next\n* * - Help\n0 - Stop\n# - Kill app\n); 1120=Exec(qdbus org.mpris.$(mpris_app) /Player Stop) 113#=Exec(killall $(mpris_app)) 114 115% PowerMgmt by Utils/aliases-server.cfg 116 117Browse MPRIS=\ 118 ExecAndSet(list,replace,MPRIS apps,qdbus|grep mpris|sed 's/org.mpris.//;s/$/,/');\ 119 Set(menu,replace,Choose,Kill); 120 121Run App=\ 122 Set(list,replace,MPRIS apps,Amarok,Audacious,Clementine,Dragon,Kaffeine,QMMP,VLC);\ 123 Set(menu,replace,Start); 124 125Choose($$)=\ 126 Set(list,close);\ 127 Make(var,mpris_app,by_value,$(Param));\ 128 Make(var,mpris_volume,by_value,-1);\ 129 Set(status,$(mpris_app));\ 130 Macro(MPRIS_MENU); 131 132Kill($$)=\ 133 Set(list,close);\ 134 Exec(qdbus org.mpris.$(Param) / Quit);\ 135 Macro(MPRIS_MENU); 136 137% 138% specify apps in non-parametrized way 139% 140Start(1,Amarok)=\ 141 Set(list,close);\ 142 Make(var,mpris_app,by_value,amarok);\ 143 Set(status,$(mpris_app));\ 144 Make(var,mpris_volume,by_value,-1);\ 145 Exec(amarok);\ 146 Macro(MPRIS_MENU); 147 148Start(2,Audacious)=\ 149 Set(list,close);\ 150 Make(var,mpris_app,by_value,audacious);\ 151 Set(status,$(mpris_app));\ 152 Make(var,mpris_volume,by_value,-1);\ 153 Exec(audacious);\ 154 Macro(MPRIS_MENU); 155 156Start(3,Clementine)=\ 157 Set(list,close);\ 158 Make(var,mpris_app,by_value,clementine);\ 159 Set(status,$(mpris_app));\ 160 Make(var,mpris_volume,by_value,-1);\ 161 Exec(clementine);\ 162 Macro(MPRIS_MENU); 163 164Start(4,Dragon)=\ 165 Set(list,close);\ 166 Make(var,mpris_app,by_value,dragon);\ 167 Set(status,$(mpris_app));\ 168 Make(var,mpris_volume,by_value,-1);\ 169 Exec(dragon);\ 170 Macro(MPRIS_MENU); 171 172Start(5,Kaffeine)=\ 173 Set(list,close);\ 174 Make(var,mpris_app,by_value,kaffeine);\ 175 Set(status,$(mpris_app));\ 176 Exec(kaffeine);\ 177 Macro(MPRIS_MENU); 178 179Start(6,QMMP)=\ 180 Set(list,close);\ 181 Make(var,mpris_app,by_value,qmmp);\ 182 Set(status,$(mpris_app));\ 183 Make(var,mpris_volume,by_value,-1);\ 184 Exec(qmmp);\ 185 Macro(MPRIS_MENU); 186 187Start(7,VLC)=\ 188 Set(list,close);\ 189 Make(var,mpris_app,by_value,vlc);\ 190 Set(status,$(mpris_app));\ 191 Make(var,mpris_volume,by_value,-1);\ 192 Exec(vlc --control dbus);\ 193 Macro(MPRIS_MENU); 194 195Repeat=\ 196 Make(mode,mpris_repeat); 197 198Random=\ 199 Make(mode,mpris_random); 200 201[Mode]=mpris_repeat 202 203(EnterMode)=\ 204 Set(list,replace,Repeat,Yes,No); 205 206Back($$)=\ 207 Set(list,close);\ 208 Make(mode,mpris); 209 210Push($$)=\ 211 Macro(Choose($$)); 212 213# depends on MPRIS version Random/SetRandom are used 214Choose($$)=\ 215 Set(list,close);\ 216 Exec(qdbus org.mpris.$(mpris_app) /TrackList SetLoop `echo $(Param)|sed 's/Yes/true/;s/No/false/'`);\ 217 Exec(qdbus org.mpris.$(mpris_app) /TrackList Loop `echo $(Param)|sed 's/Yes/true/;s/No/false/'`);\ 218 Make(mode,mpris); 219 220[ModeEnd] 221 222[Mode]=mpris_random 223 224(EnterMode)=\ 225 Set(list,replace,Random,Yes,No); 226 227Push($$)=\ 228 Macro(Choose($$)); 229 230# depends on MPRIS version Loop/SetLoop are used 231Choose($$)=\ 232 Set(list,close);\ 233 Exec(qdbus org.mpris.$(mpris_app) /TrackList SetRandom `echo $(Param)|sed 's/Yes/true/;s/No/false/'`);\ 234 Exec(qdbus org.mpris.$(mpris_app) /TrackList Random `echo $(Param)|sed 's/Yes/true/;s/No/false/'`);\ 235 Make(mode,mpris); 236 237[ModeEnd] 238 239[End] 240