parent
180d8cd21b
commit
4ede5bf7bd
2 changed files with 33 additions and 4 deletions
@ -0,0 +1,24 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
buildURL(){ |
||||
if [ -n "$1" ]; then |
||||
in="$1" |
||||
else |
||||
in="$(cat -)" |
||||
fi |
||||
id="$(echo "$in" | cut -d ' ' -f 1)" |
||||
mins="$(echo "$in" | cut -d ' ' -f 4)" |
||||
secs="$(echo "$in" | cut -d ' ' -f 5)" |
||||
seconds="$(( $mins * 60 + $secs ))" |
||||
echo -e "https://youtube.com/watch?v=$id&t=$seconds" |
||||
} |
||||
export -f buildURL |
||||
|
||||
url="$(curl https://ippsec.rocks/dataset.json 2>/dev/null |\ |
||||
jq -cM '[.[] | {machine:.machine,ID:.videoId,mins:.timestamp.minutes,secs:.timestamp.seconds,line:.line}]' |\ |
||||
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @tsv' |\ |
||||
fzf -d ' ' --with-nth '3,2' --header-lines 1 --preview-window 'up:1' --preview 'bash -c '\''buildURL "$0"'\'' {}' |\ |
||||
buildURL)" |
||||
|
||||
open-youtube "$url" |
||||
|
@ -1,14 +1,19 @@ |
||||
#!/bin/bash |
||||
|
||||
url="$1" |
||||
isxclient=$( readlink /dev/fd/2 | grep -q 'tty' && [[ -n $DISPLAY ]] ; echo $? ) |
||||
if [[ ! -t 2 || $isxclient == "0" ]]; then |
||||
DMENU="rofi -dmenu -p" |
||||
else |
||||
DMENU="fzf --prompt" |
||||
fi |
||||
|
||||
notify-send "Opening Video" "$url" |
||||
url="$1" |
||||
|
||||
if [ -z "$url" ]; then |
||||
url=$(rofi -dmenu -p 'URL') |
||||
url=$($DMENU 'URL') |
||||
fi |
||||
|
||||
code=$(youtube-dl "$url" -F | sed -n '/format code/,$ p' | tail -n +2 | rofi -dmenu -p Quality | awk '{print $1}') |
||||
code=$(youtube-dl "$url" -F | sed -n '/format code/,$ p' | tail -n +2 | $DMENU Quality | awk '{print $1}') |
||||
|
||||
mpv "$url" --ytdl-format="$code" |
||||
|
||||
|
Loading…
Reference in new issue