Compare commits

..

3 Commits

Author SHA1 Message Date
ksyasuda
10a675202a update docs/help to reflect latest changes 2022-02-06 20:06:30 -08:00
ksyasuda
c3b0a26ce7 update script to allow player selection in command-line mode 2022-02-06 20:04:37 -08:00
ksyasuda
49cf4f3ecc update readme and manpage to reflect latest changes 2022-02-06 19:43:24 -08:00
4 changed files with 80 additions and 54 deletions

View File

@ -135,8 +135,8 @@ The above output was produced by searching: `isekai -`
## aniwrapper ## aniwrapper
``` ```
aniwrapper [-cdhpqvS] [-t <theme> or -T <config_path>] <query> aniwrapper [-cdhpqSv] [-t <theme> or -T <config_path>] <query>
aniwrapper [-cvS] [-t <theme> or -T <config_path>] -f <path_to_directory> aniwrapper [-cpqSv] [-t <theme> or -T <config_path>] -f <path_to_directory>
aniwrapper -Q <query> aniwrapper -Q <query>
aniwrapper -C aniwrapper -C

View File

@ -38,23 +38,24 @@ help_text() {
printf "%s\n" "$line" printf "%s\n" "$line"
done <<< " done <<< "
Usage: Usage:
aniwrapper [-cdhpqvS] [-t <theme> or -T <config_path>] aniwrapper [-dhpqSv] [-t <theme> | -T <config_path>] [<query>]
aniwrapper [-cvS] [-t <theme> or -T <config_path>] -f <path_to_directory> aniwrapper -f <directory_path> [-t <theme> | -T <config_path>] [-pSv] [<query>]\
aniwrapper -Q <query> aniwrapper -c [-dhpqSv] [<query>]
aniwrapper -C aniwrapper -Q <query>
aniwrapper -C
Options: Options:
-c enable command-line mode (rofi disabled) -c enable command-line mode (rofi disabled)
-C connect to history database -C connect to history database
-d download episode in command-line mode -d download episode in command-line mode
-f <path_to_directory> (no trailing slash) specify starting directory for play for file mode -f <path_to_directory> (no trailing slash) specify starting directory for play for file mode
-h show this help text -h show this help text
-p enable player selection menu -p enable player selection menu
-q enable quality selection -q enable quality selection
-Q <query> query the history database -Q <query> query the history database
-v verbose output -v verbose output
-S silent mode (suppress output to stdout) [cannot be used with -v] -S silent mode (suppress output to stdout) [cannot be used with -v]
-t <aniwrapper (default)|dracula|doomone|fancy|flamingo|material|onedark> change rofi theme -t <aniwrapper (default)|dracula|doomone|fancy|flamingo|material|onedark> change rofi theme
-T <config_path> specify custom rofi theme -T <config_path> specify custom rofi theme
" "
} }
@ -228,14 +229,10 @@ parse_args() {
done done
} }
check_flags() { get_player() {
# Check if command-line flag is set msg1="Choose from the supported players, or supply your own player command (full functionality not guaranteed)"
if ((VERBOSE == 1 && SILENT == 1)); then msg2="if using an unsupported player, it must be able to play URLs for streaming from the internet"
seppuku "verbose and silent options cannot be used together" if ((IS_ROFI == 1)); then
fi
if ((IS_DOWNLOAD == 0 && IS_ALTERNATE_PLAYER == 1)); then
msg1="Choose from the supported players, or supply your own player command (full functionality not guaranteed)"
msg2="if using an unsupported player, it must be able to play URLs for streaming from the internet"
PLAYER_FN=$( PLAYER_FN=$(
awk '{print $NF}' < <(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \ awk '{print $NF}' < <(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \
-l 4 -theme-str 'listview {columns: 1;} window {width: 40%;}' \ -l 4 -theme-str 'listview {columns: 1;} window {width: 40%;}' \
@ -243,10 +240,32 @@ check_flags() {
-mesg "$(printf "%s\n%s\n" "$(generate_span "$msg1")" "$(generate_span "$msg2")")" \ -mesg "$(printf "%s\n%s\n" "$(generate_span "$msg1")" "$(generate_span "$msg2")")" \
-a 0 -sep '|' <<< "$SUPPORTED_PLAYERS") -a 0 -sep '|' <<< "$SUPPORTED_PLAYERS")
) )
[ -z "$PLAYER_FN" ] && PLAYER_FN=mpv else
if ! command -v "$PLAYER_FN" > /dev/null; then printf "%s\n%s\n" "$msg1" "$msg2"
seppuku "ERROR: $PLAYER_FN does not exist" printf "%s\n" "SUPPORTED PLAYERS:"
fi # while read -r player; do
# printf "%s\n" "$player"
# done <<< "$(printf "%s\n" "$SUPPORTED_PLAYERS" | sed 's/|/\n/g')"
# bash version
while IFS='|' read -ra players; do
printf "%s\n" "${players[@]}"
done <<< "$SUPPORTED_PLAYERS"
printf "%s" "Enter player: "
read -r PLAYER_FN
fi
[ -z "$PLAYER_FN" ] && PLAYER_FN=mpv
if ! command -v "$PLAYER_FN" > /dev/null; then
seppuku "ERROR: $PLAYER_FN does not exist"
fi
}
check_flags() {
# Check if command-line flag is set
if ((VERBOSE == 1 && SILENT == 1)); then
seppuku "verbose and silent options cannot be used together"
fi
if ((IS_DOWNLOAD == 0 && IS_ALTERNATE_PLAYER == 1)); then
get_player
lg "SELECTED PLAYER FN -> $PLAYER_FN" lg "SELECTED PLAYER FN -> $PLAYER_FN"
fi fi
if ((IS_ROFI == 0 && IS_DOWNLOAD == 0)); then if ((IS_ROFI == 0 && IS_DOWNLOAD == 0)); then

View File

@ -8,13 +8,17 @@ aniwrapper - A rofi wrapper around ani-cli: a command-line tool to
browser, download, and stream anime browser, download, and stream anime
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\f[B]aniwrapper\f[R] [-cdhpqvS] [-t \f[I]theme\f[R] | -T \f[B]aniwrapper\f[R] [-dhpqSv] [-t \f[I]theme\f[R] | -T
\f[I]config_path\f[R]] [\f[I]query\f[R]] \f[I]config_path\f[R]] [\f[I]query\f[R]]
.PD 0 .PD 0
.P .P
.PD .PD
\f[B]aniwrapper\f[R] [-cvS] [-t \f[I]theme\f[R] | -T \f[B]aniwrapper\f[R] -f \f[I]directory_path\f[R] [-t \f[I]theme\f[R] |
\f[I]config_path\f[R]] -f \f[I]path_to_directory\f[R] -T \f[I]config_path\f[R]] [-pSv] [\f[I]query\f[R]]
.PD 0
.P
.PD
\f[B]aniwrapper\f[R] -c [-dhpqSv] [\f[I]query\f[R]]
.PD 0 .PD 0
.P .P
.PD .PD
@ -85,28 +89,30 @@ Verbose output
Launch main menu with default options Launch main menu with default options
.TP .TP
\f[B]aniwrapper konosuba\f[R] \f[B]aniwrapper konosuba\f[R]
Run in stream mode with a search query: \[lq]konosuba\[rq] Run in \f[I]stream\f[R] mode with a \f[I]search query\f[R] =
\[lq]konosuba\[rq]
.TP .TP
\f[B]aniwrapper -qd naruto\f[R] \f[B]aniwrapper -qd naruto\f[R]
Run in download mode with quality selection enabled and a search query: Run in \f[I]download\f[R] mode with \f[I]quality selection enabled\f[R]
\[lq]naruto\[rq] and a \f[I]search query\f[R] = \[lq]naruto\[rq]
.TP .TP
\f[B]aniwrapper -vqt doomone\f[R] \f[B]aniwrapper -vqt doomone\f[R]
Run with quality selection menu and \f[I]doomone\f[R] theme Run with \f[I]quality selection enabled\f[R] and the \f[I]doomone\f[R]
theme
.TP .TP
\f[B]aniwrapper -cd\f[R] \f[B]aniwrapper -cqd\f[R]
Enable downloading an anime in command-line mode (\f[B]rofi\f[R] Run in \f[I]command-line\f[R] \f[I]download\f[R] mode with \f[I]quality
disabled) selection enabled\f[R] (\f[B]rofi\f[R] disabled)
.TP .TP
\f[B]aniwrapper -Q \[lq]SELECT * FROM watch_history ORDER BY watch_date DESC LIMIT 10;\[rq]\f[R] \f[B]aniwrapper -Q \[lq]SELECT * FROM watch_history ORDER BY watch_date DESC LIMIT 10;\[rq]\f[R]
Query history database for your 10 most recently watched anime Query history database for your 10 most recently watched anime
.TP .TP
\f[B]aniwrapper -f /media/videos\f[R] \f[B]aniwrapper -f /media/videos -t dracula\f[R]
Run in \[lq]Play from File\[rq] mode starting the search from the Run in \f[I]Play from File\f[R] mode, using the \f[I]dracula\f[R] theme,
\f[I]/media/videos\f[R] directory and with the \f[I]search\f[R] starting from \f[I]/media/videos\f[R]
.TP .TP
\f[B]aniwrapper -S\f[R] \f[B]aniwrapper -S\f[R]
Run in quiet mode (suppress all output to stdout and disable Run in \f[I]silent\f[R] mode (suppress all output to stdout and disable
notifications) notifications)
.SH SEE ALSO .SH SEE ALSO
.PP .PP

View File

@ -12,8 +12,9 @@ aniwrapper - A rofi wrapper around ani-cli: a command-line tool to browser, down
# SYNOPSIS # SYNOPSIS
**aniwrapper** [-cdhpqvS] [-t _theme_ | -T *config_path*] [*query*]\ **aniwrapper** [-dhpqSv] [-t _theme_ | -T *config_path*] [*query*]\
**aniwrapper** [-cvS] [-t *theme* | -T *config_path*] -f _path_to_directory_\ **aniwrapper** -f _directory_path_ [-t _theme_ | -T *config_path*] [-pSv] [*query*]\
**aniwrapper** -c [-dhpqSv] [*query*]\
**aniwrapper** -Q _query_\ **aniwrapper** -Q _query_\
**aniwrapper** -C\ **aniwrapper** -C\
@ -73,26 +74,26 @@ Defaults:
: Launch main menu with default options : Launch main menu with default options
**aniwrapper konosuba** **aniwrapper konosuba**
: Run in stream mode with a search query: "konosuba" : Run in _stream_ mode with a _search query_ = "konosuba"
**aniwrapper -qd naruto** **aniwrapper -qd naruto**
: Run in download mode with quality selection enabled and a search query: : Run in _download_ mode with _quality selection enabled_ and a _search query_ =
"naruto" "naruto"
**aniwrapper -vqt doomone** **aniwrapper -vqt doomone**
: Run with quality selection menu and _doomone_ theme : Run with _quality selection enabled_ and the _doomone_ theme
**aniwrapper -cd** **aniwrapper -cqd**
: Enable downloading an anime in command-line mode (**rofi** disabled) : Run in _command-line_ _download_ mode with _quality selection enabled_ (**rofi** disabled)
**aniwrapper -Q "SELECT \* FROM watch_history ORDER BY watch_date DESC LIMIT 10;"** **aniwrapper -Q "SELECT \* FROM watch_history ORDER BY watch_date DESC LIMIT 10;"**
: Query history database for your 10 most recently watched anime : Query history database for your 10 most recently watched anime
**aniwrapper -f /media/videos** **aniwrapper -f /media/videos -t dracula**
: Run in "Play from File" mode starting the search from the _/media/videos_ directory : Run in _Play from File_ mode, using the _dracula_ theme, and with the _search_ starting from _/media/videos_
**aniwrapper -S** **aniwrapper -S**
: Run in quiet mode (suppress all output to stdout and disable notifications) : Run in _silent_ mode (suppress all output to stdout and disable notifications)
# SEE ALSO # SEE ALSO