1%
2% anyremote configuration file for Listen management (Server-mode)
3% prerequisites: amixer/pactl utility
4%
5
6% STATUS stable
7% XTEST no
8% SOUND mixer
9% ENV no
10% DEF_PLAYER
11% ALL_IN_ONE
12% MEDIACENTER audio
13% TODO It looks like listen does not process next/previous D-BUS commands properly
14
15GuiAppName=Listen
16GuiAppBinary=listen
17GuiAppRun=P=`pgrep listen`; if [ "x$P" = "x" ]; then echo NOK; else echo OK; fi
18GuiAppIcon=listen.png
19GuiAppType=Application
20GuiAppProtocols=Server
21GuiAppDesc=Listen is an audio player written in Python
22
23[Protocol]=Server
24
25(Init)=\
26	Include($(CfgDir)/Utils/aliases-server.cfg);\
27	Macro(SETUP_DEFAULT_MIXER);\
28	Macro(TEST_DBUS_SEND);\
29	Make(var,player_name,by_value,Listen);\
30	Include($(CfgDir)/Utils/aliases-server-player.cfg);\
31	Make(var,cover_size,by_value,);\
32	Make(var,listen_cmd,by_value,dbus-send --type=method_call --dest=org.gnome.Listen /org/gnome/listen);\
33	Make(var,listen_retcmd,by_value,dbus-send --type=method_call --print-reply --dest=org.gnome.Listen /org/gnome/listen);\
34	Make(var,listen_layout,\
35	     V=`$(CfgDir)/Utils/registry.sh $(TmpDir) get listen_layout`;\
36	     if [ "x$V" = "x" ]; then echo "3x4"; else echo $V; fi);
37
38(Exit)=\
39	Exec($(CfgDir)/Utils/registry.sh $(TmpDir) set listen_layout $(listen_layout));
40
41(Connect)=\
42	Make(mode,listen_$(listen_layout));
43
44[Mode]=listen_general
45
46% Volume control and 0-9,*,# assignments by Utils/aliases-server-player.cfg
47
48PLAY=\
49	Exec($(listen_cmd) org.gnome.Listen.play_pause);\
50	Macro(LISTEN_SETTITLE);\
51	Timer(LISTEN_SETTITLE,$(UpdateTimeout),0);
52
53RWD=\
54	Exec($(listen_cmd) org.gnome.Listen.rewind);
55
56FF=\
57	Exec($(listen_cmd) org.gnome.Listen.forward);
58
59PREV=\
60	Exec($(listen_cmd) org.gnome.Listen.previous);\
61	Macro(LISTEN_SETTITLE);
62
63STOP=\
64	Timer(LISTEN_SETTITLE,cancel);\
65	Exec($(listen_cmd) org.gnome.Listen.play_pause);
66
67NEXT=\
68	Exec($(listen_cmd) org.gnome.Listen.next);\
69	Macro(LISTEN_SETTITLE);
70
71PAUSE=\
72	Exec($(listen_cmd) org.gnome.Listen.play_pause);\
73	Timer(LISTEN_SETTITLE,cancel)
74
75RUN_IF_NEED=\
76	Exec(P=`pgrep listen`; if [ "x$P" = "x" ]; then listen > /dev/null & fi);
77
78RUN_OR_QUIT=\
79	Exec(P=`pgrep listen`; \
80	     if [ "x$P" = "x" ]; then \
81	         listen > /dev/null & \
82	     else \
83	         $(listen_cmd) org.gnome.Listen.quit; \
84	     fi);
85
86APP_QUIT=\
87	Timer(LISTEN_SETTITLE,cancel);\
88	Exec($(listen_cmd) org.gnome.Listen.quit);
89
90% LISTEN_DO_SETTITLE must be defined in child modes
91LISTEN_SETTITLE=\
92	Macro(LISTEN_DO_SETTITLE,P=`pgrep listen`; if [ "x$P" = "x" ]; then echo 1; else echo 0; fi);
93
94LISTEN_TITLE_GENERAL=\
95	Make(var,listen_album,$(listen_retcmd) org.gnome.Listen.get_album|tail -1|grep string|cut -d '"' -f 2);\
96	Make(var,listen_song,$(listen_retcmd) org.gnome.Listen.get_title|tail -1|grep string|cut -d '"' -f 2);\
97	ExecAndSet(title,echo "$(listen_album) - $(listen_song)");\
98	ExecAndSet(status,$(listen_retcmd) org.gnome.Listen.get_artist|tail -1|grep string|cut -d '"' -f 2);
99
100APP_PLAY_STATUS=\
101	Make(var,listen_status,$(listen_retcmd) org.gnome.Listen.playing|tail -1|grep boolean|tr -s ' '|cut -f3 -d ' ');\
102	Make(var,app_status,if [ "x$(listen_status)" = "xtrue" ]; then echo playing; else echo paused; fi);
103
104Layout 3x4=\
105	Make(mode,listen_3x4);
106
107Layout 7x1=\
108	Make(mode,listen_7x1);
109
110Layout 5x1=\
111	Make(mode,listen_5x1);
112
113[ModeEnd]
114
115[Mode]=listen_3x4 : listen_general, default_player
116
117% (EnterMode) by Utils/aliases-server-player.cfg
118% PowerMgmt by Utils/aliases-server.cfg
119
120APP_MENU=\
121	Set(menu,replace,Layout 5x1,Layout 7x1,PowerMgmt);\
122	Macro(ALLIN1MENU);\
123	Macro(MEDIACENTER_MENU);
124
125APP_POST_SETUP=\
126	Make(var,listen_layout,by_value,3x4);
127
128LISTEN_DO_SETTITLE=\
129	Macro(LISTEN_TITLE_GENERAL);
130
131[ModeEnd]
132
133[Mode]=listen_cover
134
135LISTEN_DO_SETTITLE=\
136	Macro(LISTEN_TITLE_GENERAL);\
137	Macro(APP_COVER, if [ "x$(cover_size)" = "x" ]; then echo 1; else echo 0; fi);
138
139APP_COVER=\
140	Make(var,media_file, $(listen_retcmd) org.gnome.Listen.get_cover_path|tail -1|grep string|cut -d '"' -f 2);\
141	Macro(DEFAULT_METADATA_COVER);
142
143[ModeEnd]
144
145[Mode]=listen_7x1 : listen_general, default_player_7x1, listen_cover
146
147APP_MENU=\
148	Set(menu,replace,Mute,Layout 3x4,Layout 5x1,Help,PowerMgmt);\
149	Macro(ALLIN1MENU);\
150	Macro(MEDIACENTER_MENU);
151
152APP_POST_SETUP=\
153	Make(var,listen_layout,by_value,7x1);
154
155[ModeEnd]
156
157[Mode]=listen_5x1 : listen_general, default_player_5x1, listen_cover
158
159APP_MENU=\
160	Set(menu,replace,Mute,Layout 3x4,Layout 7x1,Help,PowerMgmt);\
161	Macro(ALLIN1MENU);\
162	Macro(MEDIACENTER_MENU);
163
164APP_POST_SETUP=\
165	Make(var,listen_layout,by_value,5x1);
166
167APP_TITLE=\
168	Macro(LISTEN_SETTITLE);
169
170PLAY=\
171	Exec($(listen_cmd) org.gnome.Listen.play_pause);
172
173[ModeEnd]
174
175[End]
176