Debian Codegraph @

fvwm/scripts/FvwmMPD/FvwmApplet-MpdPlEd

raw
1 # FvwmApplet-MpdPlEd v1.0
2 # An MPD playlist editor for FVWM using FvwmScript
3 #
4 # Written by Bert 'theBlackDragon' Geens <[email protected]>
5 #
6 # Requires:
7 # - fvwm (doh!)
8 # - mpc
9 # - bash
10 # - python
11 #
12 # Things you might want to do:
13 # - change the WindowPosition to match your screensize (or just remove it)
14 # - get Gettext to work !
15 #
16 # Changes:
17 # 0.1
18 # Initial release
19 # 0.1.1
20 # Incorporated Hun's patch to add a clear playlist menu item.
21 # 0.1.2
22 # Make the font and the window bigger (Dominique Michel <[email protected]>
23 WindowTitle {MPD Playlist Editor}
24 WindowSize 630 700
25 #WindowPosition 300 300
26 Colorset 1
27 Font "xft:Verdana:size=16"
28
29 Init
30 Begin
31 #load the current playlist
32 ChangeTitle 1 (GetOutput { $FVWM_SYSTEMDIR/scripts/FvwmMPD/parseplaylist.sh| tr '\n' '|' } 1 -1 )
33 End
34
35 PeriodicTasks
36 Begin
37 #the flickering is just too heavy when updating every second...:(
38 If (RemainderOfDiv (GetTime) 1)==0 Then
39 Begin
40 #update the list when the currently playing song changes
41 Set $currtitle = (GetOutput {mpc} 1 -1)
42
43 # Update when the contents of the playlist change
44 If (GetOutput {$FVWM_SYSTEMDIR/scripts/FvwmMPD/parseplaylist.sh| tr '\n' '|'} 1 -1 ) == (GetTitle 1) Then
45 Do Nop
46 Else
47 Begin
48 ChangeTitle 1 (GetOutput {$FVWM_SYSTEMDIR/scripts/FvwmMPD/parseplaylist.sh| tr '\n' '|'} 1 -1 )
49 Set $oldtitle = $currtitle
50 End
51
52 # Update when the currently playing song changes
53 If $currtitle == $oldtitle Then
54 Do Nop
55 Else
56 Begin
57 ChangeTitle 1 (GetOutput {$FVWM_SYSTEMDIR/scripts/FvwmMPD/parseplaylist.sh| tr '\n' '|'} 1 -1 )
58 Set $oldtitle = $currtitle
59 End
60 End
61 End
62
63 Widget 1
64 Property
65 Flags NoReliefString
66 # Position 0 24
67 Position 0 40
68 # Size 450 450
69 Size 630 620
70 Type List
71 Title { }
72 Main
73 Case message of
74 SingleClic :
75 Begin
76 Set $item = (GetValue 1)
77 Set $clicks = (Add $clicks 1)
78 If $olditem == $item Then
79 Begin
80 If $clicks==1 Then
81 Do {Exec mpc play } (GetValue 1) { >/dev/null}
82 End
83 Else
84 Begin
85 Set $olditem = $item
86 Set $clicks=0
87 End
88 End
89 End
90
91 Widget 2
92 Property
93 Flags NoReliefString
94 # Position 0 474
95 # Size 90 26
96 Position 0 658
97 Size 140 40
98 Type ItemDraw
99 Title {Move song:}
100 Main
101 Case message of
102 SingleClic :
103 Begin
104 Do Nop
105 End
106 End
107
108 Widget 3
109 Property
110 Flags NoReliefString
111 # Position 90 474
112 # Size 60 26
113 Position 140 660
114 Size 80 40
115 Type PushButton
116 Title { Up }
117 Main
118 Case message of
119 SingleClic :
120 Begin
121 Do {Exec mpc move } (GetValue 1) { } (Add (GetValue 1) -1) { >/dev/null}
122 End
123 End
124
125 Widget 4
126 Property
127 Flags NoReliefString
128 # Position 150 474
129 # Size 60 26
130 Position 220 660
131 Size 90 40
132 Type PushButton
133 Title { Down }
134 Main
135 Case message of
136 SingleClic :
137 Begin
138 Do {Exec mpc move } (GetValue 1) { } (Add (GetValue 1) 1) { >/dev/null}
139 End
140 End
141
142 Widget 5
143 Property
144 Flags NoReliefString
145 # Position 230 474
146 # Size 110 26
147 Position 310 660
148 Size 154 40
149 Type PushButton
150 Title { Add song }
151 Main
152 Case message of
153 SingleClic :
154 Begin
155 If $MainColorset <> {} Then
156 Do {FvwmScript $[FVWM_SYSTEMDIR]/scripts/FvwmMPD/FvwmApplet-MpdAddSong } $MainColorset
157 Else
158 Begin
159 Do {FvwmScript $[FVWM_SYSTEMDIR]/scripts/FvwmMPD/FvwmApplet-MpdAddSong }
160 End
161 End
162 End
163
164 Widget 6
165 Property
166 Flags NoReliefString
167 # Position 340 474
168 Position 464 660
169 # Size 110 26
170 Size 166 40
171 Type PushButton
172 Title { Remove song }
173 Main
174 Case message of
175 SingleClic :
176 Begin
177 Do {Exec mpc del } (GetValue 1) { >/dev/null}
178 End
179 End
180
181 Widget 100
182 Property
183 Flags NoReliefString
184 Position 0 0
185 Type Menu
186 Title { File|Quit }
187 Main
188 Case message of
189 SingleClic :
190 Begin
191 Set $clickeditem = (GetValue 100)
192 If $clickeditem==1 Then
193 Quit
194 End
195 End
196
197 Widget 101
198 Property
199 Flags NoReliefString
200 Position 0 0
201 Type Menu
202 Title { Options|Toggle repeat|Toggle random|Crop|Clear }
203 Main
204 Case message of
205 SingleClic :
206 Begin
207 Set $clickeditem = (GetValue 101)
208 If $clickeditem==1 Then
209 Do {Exec mpc repeat>/dev/null}
210 If $clickeditem==2 Then
211 Do {Exec mpc random >/dev/null}
212 If $clickeditem==3 Then
213 Do {Exec mpc crop >/dev/null}
214 If $clickeditem==4 Then
215 Do {Exec mpc clear >/dev/null}
216 End
217 End
218
219 Widget 102
220 Property
221 Flags NoReliefString
222 Position 0 0
223 Type Menu
224 Title { Database|Update }
225 Main
226 Case message of
227 SingleClic :
228 Begin
229 Set $clickeditem = (GetValue 102)
230 If $clickeditem==1 Then
231 Do {Exec mpc update >/dev/null}
232 End
233 End