Browse Source

:) YO I FIXED IT!!!!?!?!?! haHAA

quinn 2 years ago
parent
commit
94f8739e88
1 changed files with 18 additions and 5 deletions
  1. 18
    5
      fzmp

+ 18
- 5
fzmp View File

@@ -118,16 +118,17 @@ filter_all_songs() {
118 118
 
119 119
 filter_by_artist() {
120 120
   local choice
121
-  mapfile -t choice < <(mpc list artist |
121
+  mapfile -t choice < <(mpc list albumartist |
122 122
     sort -h |
123 123
     fzf \
124 124
       --preview='mpc list album artist {}' \
125
-      --expect='f1,f3,enter')
125
+      --expect='f1,f3,enter,ctrl-x')
126 126
   (( ${#choice[@]} > 0 )) || die
127 127
   case "${choice[0]}" in
128 128
     f1) filter_all_songs ;;
129 129
     f3) filter_by_playlist ;;
130 130
     enter) filter_by_album_from_artist "${choice[1]}" ;;
131
+    ctrl-x) play_artist "${choice[1]}" ;;
131 132
   esac
132 133
 }
133 134
 
@@ -135,17 +136,18 @@ filter_by_album_from_artist() {
135 136
   local album artist choice
136 137
   [[ -z "$1" ]] && filter_by_artist
137 138
   artist="$1"
138
-  mapfile -t choice < <(mpc search -f '[(%date%)\t][%album%]' artist "$artist" |
139
+  mapfile -t choice < <(mpc search -f '[[%album%]' albumartist "$artist" |
139 140
     sort -h | uniq |
140 141
     fzf --prompt="$artist > " \
141 142
       --preview="album=\$(cut -f2 <<< {}); mpc search -f '[[[%track% - ][%title%]]|%file%]' artist \"$artist\" album \"\$album\"" \
142
-      --expect='f1,f3,enter' \
143
+      --expect='f1,f3,enter,ctrl-x' \
143 144
       --bind='Ctrl-A:select-all' |
144 145
       cut -f2)
145 146
   case "${choice[0]}" in
146 147
     'f1') filter_all_songs ;;
147 148
     'f3') filter_by_playlist ;;
148 149
     'enter') filter_songs_from_album "$artist" "${choice[1]}" ;;
150
+    'ctrl-x') play_album "${choice[1]}" ;;
149 151
     *) filter_by_artist ;;
150 152
   esac
151 153
 }
@@ -180,7 +182,7 @@ filter_by_playlist() {
180 182
       ${current_song:+--header="now playing: ${current_song}"} \
181 183
       --delimiter='\t' \
182 184
       --with-nth='2..' \
183
-      --expect='f1,f2,>,<,ctrl-d,enter' |
185
+      --expect='f1,f2,>,<,ctrl-d,enter,del' |
184 186
     cut -f1) || die
185 187
   case "${choice[0]}" in
186 188
     'f1') filter_all_songs ;;
@@ -189,6 +191,7 @@ filter_by_playlist() {
189 191
     '<') mpc -q prev; filter_by_playlist ;;
190 192
     'ctrl-d') [[ -n "${choice[1]}" ]] && mpc -q del "${choice[@]:1}"; filter_by_playlist ;;
191 193
     'enter') [[ -n "${choice[1]}" ]] && mpc -q play "${choice[@]:1}"; filter_by_playlist ;;
194
+    'del') [[ -n "${choice[1]}" ]] && mpc -q del "${choice[@]:1}"; filter_by_playlist ;;
192 195
   esac
193 196
 }
194 197
 
@@ -203,6 +206,16 @@ play_songs() {
203 206
   filter_by_playlist
204 207
 }
205 208
 
209
+play_artist() {
210
+    mpc findadd albumartist "$@"
211
+    filter_by_playlist
212
+}
213
+
214
+play_album() {
215
+    mpc findadd album "$@"
216
+    filter_by_playlist
217
+}
218
+
206 219
 [[ -s "$config_file" ]] && parse_config_file < "$config_file"
207 220
 
208 221
 if (( verbose > 0 && ${#config_err[@]} > 0 )); then

Loading…
Cancel
Save