diff --git a/diana-mui b/diana-mui new file mode 100755 index 0000000..ed51e7f --- /dev/null +++ b/diana-mui @@ -0,0 +1,147 @@ +#!/usr/bin/env bash +### _ _ _ _ +### __ _ ___ | |_| |__ | | ___| |_ _ _ +### / _` |/ _ \| __| '_ \| |/ _ \ __| | | | +###| (_| | (_) | |_| |_) | | __/ |_| |_| | +### \__, |\___/ \__|_.__/|_|\___|\__|\__,_| +### |___/ +### https://www.youtube.com/user/gotbletu +### https://twitter.com/gotbletu +### https://github.com/gotbletu +### gotbletu@gmail.com +### +### Author : gotbletu +### Name : diana-mui +### Version : 0.2 +### Date : 20190607 +### Description : diana-mui is a Menu User Interface to the diana program. Diana is a commandline interface to aria2 daemon +### Depends On : bash aria2 coreutils fzf gawk procps-ng xdg-utils diana (https://github.com/baskerville/diana) +### Video Demo : https://www.youtube.com/watch?v=y59JwlYsrAE +### References : https://github.com/baskerville/diana/blob/87c5b1b57425585b4c0f543edcf7e9038cf793c5/diana#L427-L429 + +# download path +DIANA_DOWNLOAD_DIR=~/Downloads/Aria +# cli frontend to aria2 daemon +DIANA_BIN=/usr/bin/diana +# diana's custom way to start aria2 daemon +DAD_BIN=/usr/bin/dad +# list all active,paused,completed,errors +DIANAMUI_PROGRESS_BIN=~/.scripts/diana-progress + +main_program () { +while true; do + clear + printf '%s\n\n' '======== Diana MUI ========' + printf '%s\n' ' o|l) Open File <==> List All Downloads' + printf '%s\n' ' a|A) Add <==> Add Paused' + printf '%s\n' ' i|f) File Info <==> Show Filename' + printf '%s\n' ' r|R) Remove * <==> Force Remove *' + printf '%s\n' ' p|P) Pause * <==> Pause All Active' + printf '%s\n' ' c|C) Resume * <==> Resume All Paused' + printf '%s\n' ' T) Stop Seeding Completed Torrents' + printf '%s\n' ' E) Clear Completed Downloads & Errors' + printf '%s\n' ' s|S) Start Aria2c Daemon <==> STOP Daemon' + printf '%s\n' ' h|q) Help <==> Quit' + printf '%s\n' + printf '%s\n' ' * Use TAB key to select multiple' + printf '%s\n' + printf ' Enter Your Choice: ' + read INPUT + + case "$INPUT" in + + l) # List all + watch -t "$DIANAMUI_PROGRESS_BIN" + ;; + i) # Show File Info + GID=`("$DIANA_BIN" list && "$DIANA_BIN" paused && "$DIANA_BIN" stopped && "$DIANA_BIN" errors) | fzf | awk '{print $1}'` + "$DIANA_BIN" info "$GID" + read -rsp $'Press any key to return to main menu\n' -n1 key + ;; + f) # Show Filename + GID=`("$DIANA_BIN" list && "$DIANA_BIN" paused && "$DIANA_BIN" stopped && "$DIANA_BIN" errors) | fzf | awk '{print $1}'` + "$DIANA_BIN" files "$GID" + read -rsp $'Press any key to return to main menu\n' -n1 key + ;; + o) # Open File + GID=`("$DIANA_BIN" list && "$DIANA_BIN" paused && "$DIANA_BIN" stopped && "$DIANA_BIN" errors) | fzf | awk '{print $1}'` + nohup xdg-open "$("$DIANA_BIN" files "$GID" | cut -d'%' -f2- | awk '{$1=$1};1')" >/dev/null 2>&1 & + # read -rsp $'Press any key to return to main menu\n' -n1 key + ;; + a) # Add + printf '%s\n' ">>> Add [|||>> " URI + "$DIANA_BIN" add "$URI" + ;; + A) # Add Paused + printf '%s\n' ">>> Add [|||>> " URI + "$DIANA_BIN" --pause add "$URI" + ;; + r) # Removing Download + ("$DIANA_BIN" list && "$DIANA_BIN" paused ) | fzf -m | awk '{print $1}' | while read GID; do "$DIANA_BIN" remove "$GID"; done + ;; + R) # Force Removing Download + ("$DIANA_BIN" list && "$DIANA_BIN" paused ) | fzf -m | awk '{print $1}' | while read GID; do "$DIANA_BIN" forcerm "$GID"; done + ;; + p) # Pausing Download + "$DIANA_BIN" list | fzf -m | awk '{print $1}' | while read GID; do "$DIANA_BIN" pause "$GID"; done + ;; + P) # Pause All The Active Downloads (aka Sleep) + "$DIANA_BIN" sleep + ;; + c) # Resuming Download + "$DIANA_BIN" paused | fzf -m | awk '{print $1}' | while read GID; do "$DIANA_BIN" resume "$GID"; done + ;; + C) # Resume All The Paused Downloads (aka Wake) + "$DIANA_BIN" wake + ;; + E) # Clear The List Of Stopped Downloads And Errors (aka Purge) + "$DIANA_BIN" purge + ;; + T) # Stop Seeding Completed Downloads (aka Clean) + "$DIANA_BIN" clean + ;; + s) printf '%s\n' "Starting Aria2c Daemon..." + printf '%s\n' "Download To: $DIANA_DOWNLOAD_DIR" + mkdir -p "$DIANA_DOWNLOAD_DIR" + "$DAD_BIN" -d "$DIANA_DOWNLOAD_DIR" start + sleep 3 + ;; + S) printf '%s\n' "Stopping Aria2c Daemon..." + "$DAD_BIN" stop + sleep 3 + ;; + h|H) # Help page + clear + printf '%s\n' 'Diana-MUI is a Menu User Interface to the diana program.' + printf '%s\n' 'Diana is a commandline interface to aria2 daemon.' + printf '%s\n' 'Aria2 is a download utility that supports HTTP(S), FTP, BitTorrent, and Metalink.' + printf '%s\n' + printf '%s\n' 'Requirements: bash aria2 coreutils fzf gawk procps-ng xdg-utils diana (https://github.com/baskerville/diana)' + printf '%s\n' + printf '%s\n' 'Optional: aria2c addon (https://chrome.google.com/webstore/detail/aria2c-integration/edcakfpjaobkpdfpicldlccdffkhpbfk)' + printf '%s\n' + printf '%s\n' + printf '%s\n' 'Author: gotbletu ' + printf '%s\n' ' https://www.youtube.com/user/gotbletu' + printf '%s\n' ' https://twitter.com/gotbletu' + printf '%s\n' ' https://github.com/gotbletu' + printf '%s\n' + read -rsp $'Press any key to return to main menu\n' -n1 key + ;; + q|Q) # Quit/Exit + clear && break + ;; + *) printf '%s\n' "Invalid Option... Try Again" + sleep 2 + ;; + esac + +done +} + +# run program +main_program + + diff --git a/diana-progress b/diana-progress new file mode 100755 index 0000000..c0341cd --- /dev/null +++ b/diana-progress @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +### _ _ _ _ +### __ _ ___ | |_| |__ | | ___| |_ _ _ +### / _` |/ _ \| __| '_ \| |/ _ \ __| | | | +###| (_| | (_) | |_| |_) | | __/ |_| |_| | +### \__, |\___/ \__|_.__/|_|\___|\__|\__,_| +### |___/ +### https://www.youtube.com/user/gotbletu +### https://twitter.com/gotbletu +### https://github.com/gotbletu +### gotbletu@gmail.com +### +### Author : gotbletu +### Name : diana-progress +### Version : 0.2 +### Date : 20190607 +### Description : outputs basic stats and info about the current aria2c daemon downloads +### Depends On : bash diana (https://github.com/baskerville/diana) +### Video Demo : https://www.youtube.com/watch?v=y59JwlYsrAE + +DIANA_BIN=/usr/bin/diana + +# printf '%s\n' "====BANDWIDTH====" +"$DIANA_BIN" stats +printf '%s\n' "=====ACTIVE======" +"$DIANA_BIN" list +printf '%s\n' "=====PAUSED======" +"$DIANA_BIN" paused +printf '%s\n' "====COMPLETED====" +"$DIANA_BIN" stopped +printf '%s\n' "=====ERRORS======" +"$DIANA_BIN" errors diff --git a/diana_mui_aria2c_daemon_frontend.md b/diana_mui_aria2c_daemon_frontend.md new file mode 100644 index 0000000..e1b1b35 --- /dev/null +++ b/diana_mui_aria2c_daemon_frontend.md @@ -0,0 +1,58 @@ +# Diana-MUI - Menu User Interface To Aria2c Daemon +a poorman's frontend to diana (which is a commandline frontend to aria2 daemon) + +* tutorial video: [Link](https://youtu.be/y59JwlYsrAE) +* offical website: [Link](https://www.youtube.com/user/gotbletu) + +### install requirements + bash aria2 coreutils fzf gawk procps-ng xdg-utils diana (https://github.com/baskerville/diana) + +### download required scripts + $ wget https://github.com/gotbletu/shownotes/blob/master/diana-mui + $ wget https://github.com/gotbletu/shownotes/blob/master/diana-progress + +### configuration + # open scripts and edit paths to fit your setup + DIANA_DOWNLOAD_DIR=~/Downloads/Aria + DIANA_BIN=/usr/bin/diana + DAD_BIN=/usr/bin/dad + DIANAMUI_PROGRESS_BIN=~/.scripts/diana-progress + +### usage + $ diana-mui + +### optional: w3m keymap + vim ~/.w3m/keymap + + # add to download active list + keymap xd EXTERN_LINK 'diana add' + # add to download paused list + keymap XD EXTERN_LINK 'diana --pause add' + # open diana-mui script + keymap xD SHELL 'diana-mui' + +### references +- https://youtu.be/y59JwlYsrAE +- [aria2c - The Ultra Fast Download Utility - Linux CLI](https://www.youtube.com/watch?v=ZMiyeNxcBSY) +- [W3M Web Browser Playlist](https://www.youtube.com/playlist?list=PLqv94xWU9zZ35Yv0s6zMID5JoS8qu19Kh) +- [Transmission CLI TUI Torrent Client](https://www.youtube.com/playlist?list=PLqv94xWU9zZ05Dbc551z14Eerj2xPWyVt) +- https://github.com/baskerville/diana +- [Undocumented Diana Features](https://github.com/baskerville/diana/blob/87c5b1b57425585b4c0f543edcf7e9038cf793c5/diana#L427-L429) +- [Aria2c Integration Add-on Chrome Chromium](https://chrome.google.com/webstore/detail/aria2c-integration/edcakfpjaobkpdfpicldlccdffkhpbfk) + +### contact + + _ _ _ _ + __ _ ___ | |_| |__ | | ___| |_ _ _ + / _` |/ _ \| __| '_ \| |/ _ \ __| | | | + | (_| | (_) | |_| |_) | | __/ |_| |_| | + \__, |\___/ \__|_.__/|_|\___|\__|\__,_| + |___/ + +- http://www.youtube.com/user/gotbletu +- https://twitter.com/gotbletu +- https://github.com/gotbletu +- gotbletu@gmail.com + + +tags: gotbletu youtube tutorial screencast tips and tricks guide hidden gems shownotes computer opensource free software linuxmint linux distro ubuntu debian fedora archlinux terminal console tty commandline cli tui mui ncurses zsh shell bash curses text user interface scripts scripting server aria2c aria2 aria daemon download manager downloader w3m web browser opendirectories