Compare commits
No commits in common. "f9b97ed30be87d924481a92d7f8b6de01e2ff965" and "4fb7bbe0848a3fb7ea18878b000fc4f833e9f84c" have entirely different histories.
f9b97ed30b
...
4fb7bbe084
2 changed files with 2 additions and 76 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
|
@ -9,7 +10,6 @@
|
||||||
./fish.nix
|
./fish.nix
|
||||||
./kitty.nix
|
./kitty.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
./ytfp.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
wget
|
wget
|
||||||
ripgrep
|
ripgrep
|
||||||
ncdu
|
ncdu
|
||||||
|
fzf
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
rclone
|
rclone
|
||||||
waypipe
|
waypipe
|
||||||
|
|
@ -77,30 +78,5 @@
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
};
|
};
|
||||||
lazysql.enable = true;
|
lazysql.enable = true;
|
||||||
fzf = {
|
|
||||||
enable = true;
|
|
||||||
enableFishIntegration = true;
|
|
||||||
defaultOptions = [
|
|
||||||
"--height 40%"
|
|
||||||
"--border"
|
|
||||||
];
|
|
||||||
colors = with config.scheme.withHashtag; {
|
|
||||||
bg = base00;
|
|
||||||
"bg+" = base01;
|
|
||||||
border = base03;
|
|
||||||
fg = base05;
|
|
||||||
"fg+" = base05;
|
|
||||||
header = base08;
|
|
||||||
hl = base08;
|
|
||||||
"hl+" = base08;
|
|
||||||
info = config.scheme.withHashtag.${config.colors.accent};
|
|
||||||
label = base05;
|
|
||||||
marker = base07;
|
|
||||||
pointer = base06;
|
|
||||||
prompt = config.scheme.withHashtag.${config.colors.accent};
|
|
||||||
"selected-bg" = base02;
|
|
||||||
spinner = base06;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
# full credit to u/SupermarketAntique32 on reddit:
|
|
||||||
# https://www.reddit.com/r/commandline/comments/1sd26he/youtube_search_and_play_in_20_lines_of_bash/
|
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
(writeShellApplication {
|
|
||||||
name = "ytfp";
|
|
||||||
runtimeInputs = [
|
|
||||||
bash
|
|
||||||
curl
|
|
||||||
fzf
|
|
||||||
yt-dlp
|
|
||||||
chafa
|
|
||||||
mpv
|
|
||||||
];
|
|
||||||
text = ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# `ytfp`: Search YouTube video using `fzf` and play it in `mpv`
|
|
||||||
# Require `fzf`, `yt-dlp`, `chafa`, `mpv`
|
|
||||||
#
|
|
||||||
|
|
||||||
SEARCH_VID() {
|
|
||||||
yt-dlp "https://www.youtube.com/results?search_query=$1" \
|
|
||||||
--flat-playlist --playlist-items 1:20 --print \
|
|
||||||
$'%(thumbnails.0.url)s\t%(title)s\t%(channel)s\t%(view_count)s\t%(url)s' \
|
|
||||||
| grep --extended-regexp --invert-match 'playlist|channel'
|
|
||||||
}
|
|
||||||
RENDER_VID_INFO() {
|
|
||||||
curl --silent "$1" | chafa --size=x14 --clear
|
|
||||||
echo "Title : $2"
|
|
||||||
echo "Channel : $3"
|
|
||||||
echo "Views : $4"
|
|
||||||
}
|
|
||||||
export -f SEARCH_VID RENDER_VID_INFO
|
|
||||||
|
|
||||||
fzf --preview-window down --layout reverse --disabled --with-shell 'bash -c' \
|
|
||||||
--bind 'start:reload:SEARCH_VID fzf' \
|
|
||||||
--bind 'change:reload:sleep 0.3; SEARCH_VID {q} || true' \
|
|
||||||
--bind 'load:first' \
|
|
||||||
--delimiter '\t' --with-nth 2 \
|
|
||||||
--preview 'RENDER_VID_INFO {1} {2} {3} {4}' \
|
|
||||||
--bind 'enter:execute-silent(mpv {5})'
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue