Debian Codegraph @

fvwm/scripts/FvwmMPD/FvwmApplet-MpdAddSong

raw
1 # Known bugs:
2 # - you can't immediately reenter a directory you've just left (first click another one and then try again)
3 # - some other random odness may occur...
4 WindowTitle {Add to playlist}
5 WindowSize 600 700
6 #WindowPosition 470 400
7 Colorset 1
8 Font "xft:Verdana:size=16"
9
10 Init
11 Begin
12 #load the current playlist
13 ChangeTitle 1 (GetOutput { mpc ls| tr '\n' '|' } 1 -1 )
14 End
15
16 Widget 1
17 Property
18 Flags NoReliefString
19 Position 0 40
20 Size 300 620
21 Type List
22 Title { }
23 Main
24 Case message of
25 SingleClic :
26 Begin
27 Set $item = (GetValue 1)
28 Set $clicks = (Add $clicks 1)
29 If $olditem == $item Then
30 Begin
31 If $clicks==1 Then
32 #change to the doubleclicked directory
33
34 #figure out which directory was selected
35 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 1)
36 # Do {Echo } $cmd
37 Set $currdir=(GetOutput $cmd 1 -1)
38 # Do {Echo } $currdir
39
40 #change to that directory and list it's contents
41 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' | tr '\n' '|'}
42 # Do {Echo } $cmd
43 ChangeTitle 1 (GetOutput $cmd 1 -1)
44 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' 'files' | tr '\n' '|'}
45 ChangeTitle 3 (GetOutput $cmd 1 -1)
46 End
47 Else
48 Begin
49 Set $olditem = $item
50 Set $clicks=0
51 End
52 End
53 End
54
55 Widget 3
56 Property
57 Flags NoReliefString
58 Position 300 40
59 Size 300 620
60 Type List
61 Title { }
62 Main
63 Case message of
64 SingleClic :
65 Begin
66 Set $item = (GetValue 3)
67 Set $clicks = (Add $clicks 1)
68 If $olditem == $item Then
69 Begin
70 If $clicks==1 Then
71 #figure out which song was selected
72 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 3)
73 # Do {Echo } $cmd
74 Set $currfile=(GetOutput $cmd 1 -1)
75 # Do {Echo } $currfile
76
77 #add the song to the playlist
78 Set $cmd={mpc add "} $currfile {" >/dev/null}
79 # Do {Echo } $cmd
80 Do {Exec } $cmd
81 End
82 Else
83 Begin
84 Set $olditem = $item
85 Set $clicks=0
86 End
87 End
88 End
89
90 Widget 4
91 Property
92 Flags NoReliefString
93 Position 0 0
94 Size 300 40
95 Type ItemDraw
96 Title { Folders }
97 Main
98 Case message of
99 SingleClic :
100 Begin
101 End
102 End
103
104 Widget 5
105 Property
106 Flags NoReliefString
107 Position 300 0
108 Size 300 40
109 Type ItemDraw
110 Title { Songs }
111 Main
112 Case message of
113 SingleClic :
114 Begin
115 End
116 End
117
118 Widget 6
119 Property
120 Flags NoReliefString
121 Position 0 660
122 Size 100 40
123 Type PushButton
124 Title { Close }
125 Main
126 Case message of
127 SingleClic :
128 Begin
129 Quit
130 End
131 End
132
133 Widget 7
134 Property
135 Flags NoReliefString
136 Position 100 660
137 Size 95 40
138 Type ItemDraw
139 Title { Dir: }
140 Main
141 Case message of
142 SingleClic :
143 Begin
144 End
145 End
146
147 Widget 8
148 Property
149 Flags NoReliefString
150 Position 195 660
151 Size 85 40
152 Type PushButton
153 Title { Up }
154 Main
155 Case message of
156 SingleClic :
157 Begin
158 #return to the previous directory
159 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' ..}
160 # Do {Echo } $cmd
161 Set $currdir=(GetOutput $cmd 1 -1)
162 # Do {Echo } $currdir
163
164 #change to that directory and list it's contents
165 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' | tr '\n' '|'}
166 # Do {Echo } $cmd
167 ChangeTitle 1 (GetOutput $cmd 1 -1)
168 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/listsongs.sh '} $currdir {' 'files' | tr '\n' '|'}
169 ChangeTitle 3 (GetOutput $cmd 1 -1)
170 End
171 End
172
173 Widget 9
174 Property
175 Flags NoReliefString
176 Position 280 660
177 Size 100 40
178 Type PushButton
179 Title { Add dir }
180 Main
181 Case message of
182 SingleClic :
183 Begin
184 #figure out which directory was selected
185 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 1)
186 # Do {Echo } $cmd
187 Set $seldir=(GetOutput $cmd 1 -1)
188 # Do {Echo } $currfile
189
190 Set $cmd={mpc add "} $seldir {" >/dev/null}
191 # Do {Echo } $cmd
192 Do {Exec } $cmd
193 End
194 End
195
196 Widget 10
197 Property
198 Flags NoReliefString
199 Position 430 660
200 Size 85 40
201 Type ItemDraw
202 Title { Song: }
203 Main
204 Case message of
205 SingleClic :
206 Begin
207 End
208 End
209
210 Widget 11
211 Property
212 Flags NoReliefString
213 Position 515 660
214 Size 85 40
215 Type PushButton
216 Title { Add }
217 Main
218 Case message of
219 SingleClic :
220 Begin
221 #figure out which song was selected
222 Set $cmd={$FVWM_SYSTEMDIR/scripts/FvwmMPD/getdir.sh '} $currdir {' } (GetValue 3)
223 # Do {Echo } $cmd
224 Set $currfile=(GetOutput $cmd 1 -1)
225 # Do {Echo } $currfile
226
227 #add the song to the playlist
228 Set $cmd={mpc add "} $currfile {" >/dev/null}
229 # Do {Echo } $cmd
230 Do {Exec } $cmd
231 End
232 End