From 52d598b7e61ee3ac0f083ddb3ca4554a8e2c1e0c Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Tue, 5 Apr 2022 23:37:09 +0300 Subject: [PATCH] fix pages --- peertube-cli.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/peertube-cli.sh b/peertube-cli.sh index 255568a..2abe1b8 100755 --- a/peertube-cli.sh +++ b/peertube-cli.sh @@ -50,11 +50,20 @@ peertube_menu_videos() { echo "Avalaible $(jj -i preload total) videos" sub_menu=1 + page=0 while [ $sub_menu -eq 1 ]; do names=$(jj -i preload -l 'data.#.name') - menu_videos_choice=$(echo "Main menu\n$names" | fzy) + menu_videos_choice=$(echo "Main menu\n$names\nNext page" | fzy) case $menu_videos_choice in "Main menu") sub_menu=0 ;; + "Next page") + if [ "$1" = 'all' ]; then + page=$(expr $page + 100) + peertube_api_get_all_videos $page + else + page=$(expr $page + 100) + peertube_api_get_local_videos $page + fi ;; *) video_uuid=$(jj -i preload data.#[name="$menu_videos_choice"].uuid) peertube_menu_video $video_uuid ; @@ -145,16 +154,12 @@ while true; do case "$choice" in "$videosmenu") - echo 'Enter page number (per 100 videos)' - read page - peertube_api_get_all_videos $page - peertube_menu_videos ;; + peertube_api_get_all_videos 0 + peertube_menu_videos 'all' ;; "$videosmenulocal") - echo 'Enter page number (per 100 videos)' - read page - peertube_api_get_local_videos $page - peertube_menu_videos ;; + peertube_api_get_local_videos 0 + peertube_menu_videos 'local' ;; "$changepod") empty=0