mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
fix playlist from file and add more logging
This commit is contained in:
parent
ce362345a4
commit
4b7fccec1c
8
ani-cli
8
ani-cli
@ -484,9 +484,11 @@ while getopts 'hd:HlpadP:' OPT; do
|
|||||||
;;
|
;;
|
||||||
P)
|
P)
|
||||||
is_playlist=1
|
is_playlist=1
|
||||||
playlist_file="$OPTARG"
|
# remove spaces from $OPTARG
|
||||||
[ -z "$playlist_file" ] && die "Eneter in path to playlist"
|
playlist_file="${OPTARG/ //}"
|
||||||
mpv "$playlist_file"
|
[ -z "$playlist_file" ] && die "Enter in path to playlist"
|
||||||
|
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "$playlist_file"
|
||||||
|
$player_fn "$playlist_file"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
25
aniwrapper
25
aniwrapper
@ -7,6 +7,7 @@ DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
|||||||
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt"
|
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt"
|
||||||
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||||
CFG_FILE="meh.rasi"
|
CFG_FILE="meh.rasi"
|
||||||
|
VERBOSE=1
|
||||||
|
|
||||||
# printf "%s\n" "CONFIG DIR: $CFG_DIR"
|
# printf "%s\n" "CONFIG DIR: $CFG_DIR"
|
||||||
|
|
||||||
@ -28,6 +29,12 @@ run() {
|
|||||||
"$CMD" "$*"
|
"$CMD" "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
if [[ "$VERBOSE" -eq 1 ]]; then
|
||||||
|
printf "%s\n" "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
[ "$choice" == "5. Quit" ] && quit
|
[ "$choice" == "5. Quit" ] && quit
|
||||||
|
|
||||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||||
@ -36,12 +43,14 @@ if [[ "$selection" == "1." ]]; then
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# streaming
|
# streaming
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
log "Streaming mode"
|
||||||
printf "%s\n" "STREAMING..."
|
printf "%s\n" "STREAMING..."
|
||||||
run
|
run
|
||||||
elif [[ "$selection" == "2." ]]; then
|
elif [[ "$selection" == "2." ]]; then
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# download
|
# download
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
log "Download anime"
|
||||||
dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
|
dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
|
||||||
-l 1 -p "Enter download dir:")
|
-l 1 -p "Enter download dir:")
|
||||||
# if dl_dir is none set to current directory
|
# if dl_dir is none set to current directory
|
||||||
@ -51,11 +60,13 @@ elif [[ "$selection" == "3." ]]; then
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# continue
|
# continue
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
log "Continue watching"
|
||||||
run -H
|
run -H
|
||||||
elif [[ "$selection" == "4." ]]; then
|
elif [[ "$selection" == "4." ]]; then
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# playlist mode
|
# playlist mode
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
log "Playlist mode"
|
||||||
options="1. Play playlist|2. Add to playlist|3. Delete from playlist|4. Quit"
|
options="1. Play playlist|2. Add to playlist|3. Delete from playlist|4. Quit"
|
||||||
choice=$(printf "%s\n" "${options[@]}" |
|
choice=$(printf "%s\n" "${options[@]}" |
|
||||||
rofi -dmenu -sep '|' \
|
rofi -dmenu -sep '|' \
|
||||||
@ -67,40 +78,48 @@ elif [[ "$selection" == "4." ]]; then
|
|||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# watch playlist
|
# watch playlist
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
log "Playlist mode"
|
||||||
options="1. From file|2. Streaming|3. Quit"
|
options="1. From file|2. Streaming|3. Quit"
|
||||||
choice=$(printf "%s\n" "${options[@]}" |
|
choice=$(printf "%s\n" "${options[@]}" |
|
||||||
rofi -dmenu -sep '|' \
|
rofi -dmenu -sep '|' \
|
||||||
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
||||||
[ -z "$choice" ] && seppuku "No choice selected"
|
[ -z "$choice" ] && seppuku "No choice selected"
|
||||||
[ "$choice" == "5. Quit" ] && quit
|
[ "$choice" == "5. Quit" ] && quit
|
||||||
|
log "Selection: $choice"
|
||||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||||
if [[ "$selection" == "1." ]]; then
|
if [[ "$selection" == "1." ]]; then
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# watch playlist from file (downloaded videos)
|
# watch playlist from file (downloaded videos)
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# TODO: Change directory to variable set at install
|
# TODO: Change directory to variable set at install
|
||||||
|
log "Watching playlist from file"
|
||||||
PLAYLIST_DIR="$HOME/Videos/sauce"
|
PLAYLIST_DIR="$HOME/Videos/sauce"
|
||||||
choice=$(find "$PLAYLIST_DIR" -type d |
|
log "Default playlist directory: $PLAYLIST_DIR"
|
||||||
|
choice=$(cd "$PLAYLIST_DIR" && find . -mindepth 1 -type d |
|
||||||
|
cut -c 3- |
|
||||||
rofi -dmenu \
|
rofi -dmenu \
|
||||||
-config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
|
-config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
|
||||||
[ -z "$choice" ] && seppuku "No choice selected"
|
[ -z "$choice" ] && seppuku "No choice selected"
|
||||||
[ -z "$choice" ] &&
|
log "Choice" "$choice"
|
||||||
run -P "$PLAYLIST_DIR/$choice"
|
run -P "$PLAYLIST_DIR/$choice"
|
||||||
elif [[ "$selection" == "2." ]]; then
|
elif [[ "$selection" == "2." ]]; then
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# watch playlist of 'queued' videos to stream
|
# watch playlist of 'queued' videos to stream
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
|
log "Watching from 'queue'"
|
||||||
run -p
|
run -p
|
||||||
fi
|
fi
|
||||||
elif [[ "$selection" == "2." ]]; then
|
elif [[ "$selection" == "2." ]]; then
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# add to playlist
|
# add to playlist
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
log "Add to playlist"
|
||||||
run -a
|
run -a
|
||||||
elif [[ "$selection" == "3." ]]; then
|
elif [[ "$selection" == "3." ]]; then
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# delete from playlist
|
# delete from playlist
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
log "Not implemented yet"
|
||||||
run -r
|
run -r
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user