Forráskód Böngészése

Update "pod" script

Samuel W. Flint 2 éve
szülő
commit
4d76666190
1 módosított fájl, 17 hozzáadás és 7 törlés
  1. 17 7
      pod

+ 17 - 7
pod

@@ -4,7 +4,7 @@ POD_BASE_DIR=${POD_BASE_DIR:-~/Music/}
 POD_SUB_DIR=${POD_SUB_DIR:-Podcasts}
 
 show_usage() {
-    echo "$(basename $0) [ list | play [ FILE ] | pick [-x] | pause | stop | listened | update-feeds ]" >&2
+    echo "$(basename $0) [ list | play [ FILE ] | pick [-x] | pause | stop | listened | update-feeds | wanted ]" >&2
 }
 
 show_help() {
@@ -13,13 +13,15 @@ show_help() {
 $(basename $0): Manage podcasts
 
 help                : show help
-list                : list podcast episodes
+list                : list local podcast episodes
+list-all            : list all podcast episodes
 play [ FILE ]       : if FILE, play, picking up from where last paused/stopped
 pick  [ -x ]        : pick a podcast to play, if -x, using an X-windows picker
 pause               : pause current episode, saving current location
 stop                : stop current episode, saving current location
 listened [ FILE* ]  : mark current episode as listened or if FILES mark them
 update-feeds        : update feeds
+wanted              : list wanted episodes
 EOF
 }
 
@@ -33,7 +35,7 @@ git_annex_wrap() {
 }
 
 find_unlistened() {
-    git_annex_wrap find --metadata "tag=unlistened" --include='Podcasts/*' --in=here
+    git_annex_wrap find --metadata "tag=unlistened" --include='Podcasts/*' $@
 }
 
 play_pod() {
@@ -82,14 +84,18 @@ case "$CMD" in
         exit
         ;;
     list)
+        find_unlistened --in=here
+        exit
+        ;;
+    list-all)
         find_unlistened
         exit
-    ;;
+        ;;
     play)
         pod stop
         mpc clear
         if [ $# -lt 1 ] ; then
-            for item in $(find_unlistened) ; do
+            for item in $(find_unlistened --in=here) ; do
                 mpc add $item
             done
         else
@@ -100,9 +106,9 @@ case "$CMD" in
     pick)
         CHOSEN_POD=''
         if [ "$1" == "-x" ] ; then
-            CHOSEN_POD=$(find_unlistened | rofi -dmenu -p "podcast")
+            CHOSEN_POD=$(find_unlistened --in=here | rofi -dmenu -p "podcast")
         else
-            CHOSEN_POD=$(find_unlistened | fzf)
+            CHOSEN_POD=$(find_unlistened --in=here | fzf)
         fi
         if [ "${#CHOSEN_POD}" -gt 0 ] ; then
                 play_pod $CHOSEN_POD
@@ -151,6 +157,10 @@ case "$CMD" in
         cd $CUR_DIR
         exit
         ;;
+    wanted)
+        find_unlistened --not --in=here
+        exit
+        ;;
     *)
         show_usage
         echo