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