aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEuro20179 <f>2021-03-01 20:41:27 -0800
committerEuro20179 <f>2021-03-01 20:41:27 -0800
commiteadf749c9354051515c42b07b81063250c00f4aa (patch)
tree7ca6b96f403488e1689bf45f5136643a64e45b1a
parentb22b2b56fd1a4f3dd316378281569fbb163cf09f (diff)
downloadytfzf-eadf749c9354051515c42b07b81063250c00f4aa.tar.gz
simplification of -n link selection
-rwxr-xr-xytfzf30
1 files changed, 12 insertions, 18 deletions
diff --git a/ytfzf b/ytfzf
index 93b14c9..4ffad46 100755
--- a/ytfzf
+++ b/ytfzf
@@ -277,24 +277,18 @@ user_selection () {
[ $is_url -eq 1 ] && return
format_menu
- #starts at 1 because when doing -an it selects the first n results (0 is not a result)
- i=1
- while [ $i -le $link_count ]
- do
- if [ $auto_select -eq 1 ] ; then
- selected_data="$selected_data\n$(echo "$videos_data" | sed ${i}q | tail -n1)" ;
- elif [ $random_select -eq 1 ] ; then
- selected_data="$selected_data\n$(echo "$videos_data" | shuf -n 1)"
- elif [ $show_thumbnails -eq 1 ] ; then
- dep_ck "ueberzug"
- start_ueberzug
- selected_data="$(echo "$videos_data" | video_menu_img )"
- stop_ueberzug
- else
- selected_data="$selected_data\n$(echo "$videos_data" | video_menu )"
- fi
- i=$(($i+1))
- done
+ if [ $auto_select -eq 1 ] ; then
+ selected_data="$(echo "$videos_data" | sed ${link_count}q )" ;
+ elif [ $random_select -eq 1 ] ; then
+ selected_data="$(echo "$videos_data" | shuf -n $link_count )"
+ elif [ $show_thumbnails -eq 1 ] ; then
+ dep_ck "ueberzug"
+ start_ueberzug
+ selected_data="$(echo "$videos_data" | video_menu_img )"
+ stop_ueberzug
+ else
+ selected_data="$selected_data\n$(echo "$videos_data" | video_menu )"
+ fi
shorturls="$(echo "$selected_data" | sed -E -e 's_.*\|([^|]+) *$_\1_')"
[ -z "$shorturls" ] && exit;
Un proyecto texto-plano.xyz