mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
remove playlist mode entirely
This commit is contained in:
parent
987e84e9cd
commit
9cf1c21ccf
117
aniwrapper
117
aniwrapper
@ -70,123 +70,6 @@ log() {
|
||||
fi
|
||||
}
|
||||
|
||||
playlist_mode() {
|
||||
# ---------------------------------------------------------------------------
|
||||
# playlist mode
|
||||
# ---------------------------------------------------------------------------
|
||||
log "Playlist mode"
|
||||
options="1. Play playlist|2. Add to playlist|3. Delete from playlist|4. Quit"
|
||||
choice=$(printf "%s\n" "${options[@]}" |
|
||||
rofi -dmenu -sep '|' \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
||||
[ -z "$choice" ] && seppuku "No choice selected"
|
||||
[ "$choice" == "$quit" ] && quit
|
||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
if [[ "$selection" == "1." ]]; then
|
||||
# ------------------------------------------------------------------
|
||||
# watch playlist
|
||||
# ------------------------------------------------------------------
|
||||
log "Playlist mode"
|
||||
options="1. From file|2. Streaming|3. Quit"
|
||||
choice=$(printf "%s\n" "${options[@]}" |
|
||||
rofi -dmenu -sep '|' \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
||||
[ -z "$choice" ] && seppuku "No choice selected"
|
||||
[ "$choice" == "$quit" ] && quit
|
||||
|
||||
log "Selection: $choice"
|
||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
if [[ "$selection" == "1." ]]; then
|
||||
# --------------------------------------------------------------
|
||||
# watch playlist from file (downloaded videos)
|
||||
# --------------------------------------------------------------
|
||||
log "Watching playlist from file"
|
||||
PLAYLIST_DIR="$HOME/Videos/sauce"
|
||||
log "Default playlist directory: $PLAYLIST_DIR"
|
||||
choice=$(cd "$PLAYLIST_DIR" && find . -mindepth 1 -type d |
|
||||
cut -c 3- |
|
||||
rofi -dmenu \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
|
||||
[ -z "$choice" ] && seppuku "No choice selected"
|
||||
log "Choice" "$choice"
|
||||
run -P "$PLAYLIST_DIR/$choice"
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
# --------------------------------------------------------------
|
||||
# watch playlist of 'queued' videos to stream
|
||||
# --------------------------------------------------------------
|
||||
log "Watching from 'queue'"
|
||||
choice=$(rofi -dmenu \
|
||||
-config "$CFG_DIR/$CFG_FILE" \
|
||||
-l 1 -p "Enter path to playlist file (or leave blank for default):")
|
||||
if [[ "$choice" ]]; then
|
||||
PLAYLIST_FILE="$choice"
|
||||
else
|
||||
PLAYLIST_FILE="$DEFAULT_PLAYLIST"
|
||||
fi
|
||||
run -p
|
||||
fi
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
# ------------------------------------------------------------------
|
||||
# add to playlist
|
||||
# ------------------------------------------------------------------
|
||||
log "Add to playlist"
|
||||
choice=$(rofi -dmenu \
|
||||
-config "$CFG_DIR/$CFG_FILE" \
|
||||
-l 1 -p "Enter path to playlist file (or leave blank for default):")
|
||||
if [[ "$choice" ]]; then
|
||||
PLAYLIST_FILE="$choice"
|
||||
else
|
||||
PLAYLIST_FILE="$DEFAULT_PLAYLIST"
|
||||
fi
|
||||
run -a "$PLAYLIST_FILE"
|
||||
elif [[ "$selection" == "3." ]]; then
|
||||
# -----------------------------------------------------------------------
|
||||
# delete from playlist
|
||||
# -----------------------------------------------------------------------
|
||||
log "Delete from playlist"
|
||||
choice=$(rofi -dmenu \
|
||||
-config "$CFG_DIR/$CFG_FILE" \
|
||||
-l 1 -p "Enter path to playlist file (or leave blank for default):")
|
||||
if [[ "$choice" ]]; then
|
||||
PLAYLIST_FILE="$choice"
|
||||
else
|
||||
PLAYLIST_FILE="$DEFAULT_PLAYLIST"
|
||||
fi
|
||||
[ "$VERBOSE" -eq 1 ] && log "playlist file: $PLAYLIST_FILE"
|
||||
lines=""
|
||||
cnt=0
|
||||
while read -r line; do
|
||||
if [[ "$cnt" -eq 0 ]]; then
|
||||
lines="$((cnt + 1)). $line"
|
||||
else
|
||||
lines="$lines|$((cnt + 1)). $line"
|
||||
fi
|
||||
((cnt++))
|
||||
done < "$PLAYLIST_FILE"
|
||||
choice=$(rofi -dmenu -l 12 \
|
||||
-sep '|' \
|
||||
-config "$CFG_DIR/$CFG_FILE" -p "Choose episode to delete:" \
|
||||
<<< "${lines[*]}")
|
||||
log "choice: $choice"
|
||||
selection=$(awk '{print $1}' <<< "$choice")
|
||||
idx=${selection//\./}
|
||||
log "index selected: $idx"
|
||||
log "deleting entry: $idx"
|
||||
if [[ -z "$idx" ]]; then
|
||||
log "no entry selected"
|
||||
exit 1
|
||||
fi
|
||||
sed -ie "$idx"d "$PLAYLIST_FILE"
|
||||
if [ "$?" -eq 0 ]; then
|
||||
log "$selection deleted from playlist"
|
||||
exit 0
|
||||
else
|
||||
log "there was a problem deleting $choice"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
play_file() {
|
||||
# opens the passed in file with $PLAYER_CMD
|
||||
log "Checking if file is playable"
|
||||
|
Loading…
Reference in New Issue
Block a user