Skip to content

Commit fc7002e

Browse files
add searching by channel option
1 parent da87ac6 commit fc7002e

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

.github/workflows/app-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
sudo apt-get install --yes libxcb-image0-dev libxcb-image0
2323
sudo apt-get install --yes libxcb-res0 libxcb-res0-dev
2424
sudo apt-get install --yes libopencv-dev libfuse2
25-
sudo apt-get install --yes libopencv-videoio-dev libfmt9
25+
sudo apt-get install --yes libopencv-videoio-dev libfmt8
2626
- name: Build AppImage
2727
run: |
2828
./build_appimage.sh

ytwatch

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ PLAYER_OPT=${YTWATCH_PLAYER_OPT:-"--playlist=-"}
88
[ $(which devour) ] || [ ${YTWATCH_SWALLOWER} ] \
99
&& SWALLOWER=${YTWATCH_SWALLOWER:-devour}
1010
YTSCRAPER=${YTWATCH_SCRAPER:-"./ytscraper"}
11-
1211
UEBERZUGPP=${YTWATCH_UEBERZUGPP:-/usr/local/bin/ueberzugpp}
1312
FZF=${YTWATCH_FZF:-fzf}
1413

1514
readonly BASH_BINARY="$(which bash)"
1615
args=$(getopt -l "play-now::help" -o "p::h" -- "$@")
1716
eval set -- "$args"
1817

19-
LIST="$("${YTSCRAPER}" "${CSV}" | \
20-
jq -r "map_values(delpaths(keys_unsorted[:-400] | map([.])))" | jq ".videos")"
21-
18+
if [ "${@: -1}" == "--" ]; then
19+
LIST="$("${YTSCRAPER}" "${CSV}" | \
20+
jq -r "map_values(delpaths(keys_unsorted[:-400] | map([.])))" | jq ".videos")"
21+
else
22+
LIST="$("${YTSCRAPER}" "${CSV}" | \
23+
jq -r '.videos | map(select(.channel | test("'"${@: -1}"'";"i")))')"
24+
fi
2225

2326
start_mpv(){
2427
echo "${LIST}"| jq -r ".[] | .url" | tac | ${SWALLOWER} ${PLAYER} ${PLAYER_OPT}
@@ -73,28 +76,28 @@ start_fzf(){
7376
.title, .channel, .published, .url, .thumbnail" <<< ${LIST})'
7477

7578
BIND_STRING='enter:execute(jq -r ".[{n}] | .url" <<< ${LIST} | \
76-
'${SWALLOWER}' '${PLAYER}' '${PLAYER_OPT}')'
79+
'${SWALLOWER}' '${PLAYER}' '${PLAYER_OPT}' )'
7780

7881
SHELL="${BASH_BINARY}" LIST="${LIST}" $FZF --multi --tac \
7982
--preview "${PREVIEW_STRING}" \
8083
--bind "${BIND_STRING}" <<<"${LEFT}"
81-
}
84+
}
8285

83-
while [ $# -ge 1 ]; do
84-
case "$1" in
85-
--)
86-
start_ueberzug
87-
start_fzf
88-
exit 0
89-
;;
90-
-p|--play-now)
91-
start_mpv
92-
exit 0
93-
;;
94-
-h|--help)
95-
echo "${0} [-p|--play-now] [-h|--help]"
96-
exit 0
97-
;;
98-
esac
99-
shift
100-
done
86+
while [ $# -ge 1 ]; do
87+
case "$1" in
88+
--)
89+
start_ueberzug
90+
start_fzf
91+
exit 0
92+
;;
93+
-p|--play-now)
94+
start_mpv
95+
exit 0
96+
;;
97+
-h|--help)
98+
echo "${0} [-p|--play-now] [-h|--help]"
99+
exit 0
100+
;;
101+
esac
102+
shift
103+
done

0 commit comments

Comments
 (0)