Compare commits
9 commits
a2a5261ca4
...
86c42fba7a
Author | SHA1 | Date | |
---|---|---|---|
86c42fba7a | |||
980b6d5d0d | |||
caf0570284 | |||
0c11e2672d | |||
c417a7872f | |||
8b3920deb5 | |||
10e98e71af | |||
4fbf0bdd04 | |||
9b2a7dda0e |
1
aliases
1
aliases
|
@ -5,6 +5,7 @@
|
||||||
# Detect if we have GNU coreutils or BSD
|
# Detect if we have GNU coreutils or BSD
|
||||||
if date --version > /dev/null 2>&1 ;then
|
if date --version > /dev/null 2>&1 ;then
|
||||||
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
||||||
|
alias lh='ls -trhgGN --color=always | cut -d" " -f3-' # List files in chronological order
|
||||||
alias diff='diff --color'
|
alias diff='diff --color'
|
||||||
alias less='less --quiet'
|
alias less='less --quiet'
|
||||||
alias grep="grep --color"
|
alias grep="grep --color"
|
||||||
|
|
|
@ -19,7 +19,7 @@ else
|
||||||
clip="$(wl-paste)"
|
clip="$(wl-paste)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?/-]\+')"
|
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?@/-]\+')"
|
||||||
|
|
||||||
# Check the requirements for every option
|
# Check the requirements for every option
|
||||||
opts="fav|rot13"
|
opts="fav|rot13"
|
||||||
|
@ -33,6 +33,7 @@ if [ -n "$urls" ] && check_exists "yt-dlp"; then
|
||||||
check_exists "lncrawl" && opts="crawl|$opts"
|
check_exists "lncrawl" && opts="crawl|$opts"
|
||||||
else
|
else
|
||||||
check_exists "mpv" && opts="play|low-play|$opts"
|
check_exists "mpv" && opts="play|low-play|$opts"
|
||||||
|
check_exists "mpc" && opts="queue|$opts"
|
||||||
opts="download|$opts"
|
opts="download|$opts"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -74,6 +75,10 @@ case "$choice" in
|
||||||
"low-play")
|
"low-play")
|
||||||
playvideo -l "$clip"
|
playvideo -l "$clip"
|
||||||
;;
|
;;
|
||||||
|
"queue")
|
||||||
|
out="$(mpdurlqueue "$urls" 2>&1)" && notify-send "cliplumber" "stream queued"
|
||||||
|
printf "%s" "$out" | grep "ERROR:" | notify_err
|
||||||
|
;;
|
||||||
"audio-search")
|
"audio-search")
|
||||||
"$TERM_EMU" --single-instance mpv --ytdl-format=bestaudio ytdl://ytsearch:"$clip"
|
"$TERM_EMU" --single-instance mpv --ytdl-format=bestaudio ytdl://ytsearch:"$clip"
|
||||||
;;
|
;;
|
||||||
|
|
61
bin/mpdurlqueue
Executable file
61
bin/mpdurlqueue
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
A simple script to pipe URIs through yt-dlp and mpd
|
||||||
|
|
||||||
|
Credit: https://gist.github.com/phaer/86bdcc3fb59cd3fcd9534bfe84d9fe5f
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
import mpd
|
||||||
|
import yt_dlp
|
||||||
|
|
||||||
|
mpd_host = ('localhost', 6600)
|
||||||
|
ydl_opts = {
|
||||||
|
'format': 'bestaudio/audio',
|
||||||
|
'quiet': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("usage: {} <url>".format(sys.argv[0]), file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
source_url = sys.argv[1]
|
||||||
|
client = mpd.MPDClient()
|
||||||
|
|
||||||
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
|
try:
|
||||||
|
info = ydl.extract_info(source_url, process=False, download=False)
|
||||||
|
except yt_dlp.utils.DownloadError:
|
||||||
|
# Don't print anything, yt-dlp is already on it
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if info.get("_type") is not None and info.get("_type") == "playlist":
|
||||||
|
print("Queuing playlists not supported yet.", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
info = ydl.process_ie_result(info, download=False)
|
||||||
|
url = info.get('url')
|
||||||
|
title = info.get('title')
|
||||||
|
source = info.get('extractor_key')
|
||||||
|
|
||||||
|
# This info is only available for songs
|
||||||
|
# that have been tagged as such on youtube
|
||||||
|
artist = info.get('artist')
|
||||||
|
|
||||||
|
if not (url and title and source):
|
||||||
|
print("youtube-dl error.", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
client.connect(*mpd_host)
|
||||||
|
|
||||||
|
# Get current playing song index and then append the stream just after
|
||||||
|
# This is analogous to `mpc insert <song>`
|
||||||
|
pos = int(client.status()["song"])
|
||||||
|
song_id = client.addid(url, pos + 1)
|
||||||
|
|
||||||
|
client.addtagid(song_id, 'title', title)
|
||||||
|
client.addtagid(song_id, 'album', source)
|
||||||
|
if artist is not None:
|
||||||
|
client.addtagid(song_id, 'artist', artist)
|
||||||
|
|
||||||
|
client.disconnect()
|
|
@ -6,5 +6,6 @@ set trash = "+$my_account/Trash"
|
||||||
|
|
||||||
macro index,pager gs "<shell-escape>mbsync $my_mbsync_conf $my_account<enter>" "IMAP sync account"
|
macro index,pager gs "<shell-escape>mbsync $my_mbsync_conf $my_account<enter>" "IMAP sync account"
|
||||||
macro index,pager gi "<shell-escape>mbsync $my_mbsync_conf $my_account:INBOX<enter>" "IMAP sync Inbox"
|
macro index,pager gi "<shell-escape>mbsync $my_mbsync_conf $my_account:INBOX<enter>" "IMAP sync Inbox"
|
||||||
|
macro index,pager gf "<shell-escape>fdm fetch -a $my_account<enter>" "fdm filter mailbox"
|
||||||
|
|
||||||
# vim: syntax=neomuttrc
|
# vim: syntax=neomuttrc
|
||||||
|
|
42
config/neomutt/extract-reply.sh
Executable file
42
config/neomutt/extract-reply.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
text="$(cat)"
|
||||||
|
|
||||||
|
# Extract only the text/html part of the multipart email
|
||||||
|
# TODO parse actual encoding instead of defaulting to iso-8859-1
|
||||||
|
mailto="$(printf "%s" "$text" \
|
||||||
|
| awk '
|
||||||
|
boundary {
|
||||||
|
if ($0 ~ boundary) {
|
||||||
|
boundary = "";
|
||||||
|
next
|
||||||
|
}
|
||||||
|
print $0
|
||||||
|
}
|
||||||
|
|
||||||
|
/Content-Type: text\/html;/ {
|
||||||
|
boundary=line
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
line=$0
|
||||||
|
}' \
|
||||||
|
| qprint -d \
|
||||||
|
| iconv -f iso-8859-1 -t utf-8 \
|
||||||
|
| grep -Eo '<a href="mailto:.*?</a>')"
|
||||||
|
|
||||||
|
to="$(printf "%s" "$mailto" | sed -En 's/.*mailto:(.*?)\?subject=.*/\1/p')"
|
||||||
|
subject="$(printf "%s" "$mailto" | sed -En 's/.*\?subject=(.*?)" .*/\1/p')"
|
||||||
|
# TODO extract original To: to emulate use_envelope_from
|
||||||
|
|
||||||
|
datadir="${XDG_DATA_HOME:-"$HOME/.local/share"}/neomutt"
|
||||||
|
mkdir -p "$datadir"
|
||||||
|
|
||||||
|
format_str="unmy_hdr To: Subject:
|
||||||
|
my_hdr To: \"%s\"
|
||||||
|
my_hdr Subject: \"%s\"
|
||||||
|
echo \`rm \"%s\"\`"
|
||||||
|
|
||||||
|
printf "$format_str" "$to" "$subject" "$datadir/info.rc" > "$datadir/info.rc"
|
|
@ -55,6 +55,13 @@ bind pager gh display-toggle-weed
|
||||||
bind pager ge extract-keys
|
bind pager ge extract-keys
|
||||||
|
|
||||||
macro pager gu "<pipe-message> urlscan <enter>"
|
macro pager gu "<pipe-message> urlscan <enter>"
|
||||||
|
# Answer emails with a reply address in the body
|
||||||
|
# https://unix.stackexchange.com/a/586010/248368
|
||||||
|
macro pager gr "<pipe-message> ~/.config/neomutt/extract-reply.sh <enter>\
|
||||||
|
<enter-command>source ~/.local/share/neomutt/info.rc <enter>\
|
||||||
|
<mail><enter><enter><enter>"
|
||||||
|
# Use a hook to reset sender and subject just after creating the reply
|
||||||
|
send-hook . 'unmy_hdr To: Subject:'
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# ATTACH #
|
# ATTACH #
|
||||||
|
|
|
@ -4,10 +4,3 @@ set folder = "~/mail"
|
||||||
set my_msmtp_conf = "" # Leave empty for default
|
set my_msmtp_conf = "" # Leave empty for default
|
||||||
set my_mbsync_conf = "" # Leave empty for default
|
set my_mbsync_conf = "" # Leave empty for default
|
||||||
source common.rc
|
source common.rc
|
||||||
|
|
||||||
# Override sidebar_new_mail_only
|
|
||||||
# Move back to sidebar.rc once the issue is resolved
|
|
||||||
# https://github.com/neomutt/neomutt/issues/2208
|
|
||||||
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%f"\0' | xargs -0`
|
|
||||||
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
|
||||||
sidebar_whitelist `find ~/mail -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
|
|
||||||
|
|
|
@ -13,4 +13,9 @@ unset sidebar_next_new_wrap # wrap <sidebar-{next,prev}-new> to beginnin
|
||||||
unset sidebar_on_right # keep bar on the left
|
unset sidebar_on_right # keep bar on the left
|
||||||
set sidebar_sort_method = 'path' # sort by mailbox path alphabetically
|
set sidebar_sort_method = 'path' # sort by mailbox path alphabetically
|
||||||
|
|
||||||
|
# Override sidebar_new_mail_only
|
||||||
|
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%f"\0' | xargs -0`
|
||||||
|
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
||||||
|
sidebar_whitelist `find $folder -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
|
||||||
|
|
||||||
# vim: syntax=neomuttrc
|
# vim: syntax=neomuttrc
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
# CLI Pipe Viewer 0.1.5 - configuration file
|
# CLI Pipe Viewer 0.2.1 - configuration file
|
||||||
|
|
||||||
our $CONFIG = {
|
our $CONFIG = {
|
||||||
api_host => "auto",
|
api_host => "auto",
|
||||||
auto_captions => 0,
|
auto_captions => 0,
|
||||||
autoplay_mode => 0,
|
autoplay_mode => 0,
|
||||||
|
bypass_age_gate_with_proxy => 0,
|
||||||
cache_dir => "$ENV{HOME}/.cache/pipe-viewer",
|
cache_dir => "$ENV{HOME}/.cache/pipe-viewer",
|
||||||
colors => 1,
|
colors => 1,
|
||||||
comments_order => "top",
|
comments_order => "top",
|
||||||
|
@ -44,6 +45,7 @@ our $CONFIG = {
|
||||||
debug => 0,
|
debug => 0,
|
||||||
download_and_play => 0,
|
download_and_play => 0,
|
||||||
download_with_wget => 1,
|
download_with_wget => 1,
|
||||||
|
download_with_ytdl => 1,
|
||||||
downloads_dir => ".",
|
downloads_dir => ".",
|
||||||
env_proxy => 1,
|
env_proxy => 1,
|
||||||
fat32safe => 0,
|
fat32safe => 0,
|
||||||
|
@ -63,6 +65,7 @@ our $CONFIG = {
|
||||||
ignored_projections => [],
|
ignored_projections => [],
|
||||||
interactive => 1,
|
interactive => 1,
|
||||||
keep_original_video => 0,
|
keep_original_video => 0,
|
||||||
|
local_playlist_limit => -1,
|
||||||
maxResults => 20,
|
maxResults => 20,
|
||||||
merge_into_mkv => 1,
|
merge_into_mkv => 1,
|
||||||
merge_into_mkv_args => "-loglevel warning -c:s srt -c:v copy -c:a copy -disposition:s forced",
|
merge_into_mkv_args => "-loglevel warning -c:s srt -c:v copy -c:a copy -disposition:s forced",
|
||||||
|
@ -76,12 +79,14 @@ our $CONFIG = {
|
||||||
region => undef,
|
region => undef,
|
||||||
remove_played_file => 0,
|
remove_played_file => 0,
|
||||||
resolution => "720p",
|
resolution => "720p",
|
||||||
|
saved_channels_file => "$ENV{HOME}/.config/pipe-viewer/users.txt",
|
||||||
show_video_info => 1,
|
show_video_info => 1,
|
||||||
skip_if_exists => 1,
|
skip_if_exists => 1,
|
||||||
skip_watched => 0,
|
skip_watched => 0,
|
||||||
split_videos => 1,
|
split_videos => 1,
|
||||||
srt_languages => ["en", "fr"],
|
srt_languages => ["en", "fr"],
|
||||||
subscribed_channels_file => "$ENV{HOME}/.config/pipe-viewer/subscribed_channels.txt",
|
subscribed_channels_file => "$ENV{HOME}/.config/pipe-viewer/subscribed_channels.txt",
|
||||||
|
subscriptions_lifetime => 600,
|
||||||
subscriptions_limit => 10000,
|
subscriptions_limit => 10000,
|
||||||
thousand_separator => ",",
|
thousand_separator => ",",
|
||||||
timeout => undef,
|
timeout => undef,
|
||||||
|
@ -112,10 +117,12 @@ our $CONFIG = {
|
||||||
videoDuration => undef,
|
videoDuration => undef,
|
||||||
videoLicense => undef,
|
videoLicense => undef,
|
||||||
watch_history => 1,
|
watch_history => 1,
|
||||||
watched_file => "$ENV{HOME}/.config/pipe-viewer/watched.txt",
|
watch_history_file => "$ENV{HOME}/.config/pipe-viewer/watched.txt",
|
||||||
wget_cmd => "/usr/bin/wget",
|
wget_cmd => "/usr/bin/wget",
|
||||||
youtube_users_file => "$ENV{HOME}/.config/pipe-viewer/users.txt",
|
|
||||||
youtube_video_url => "https://www.youtube.com/watch?v=%s",
|
youtube_video_url => "https://www.youtube.com/watch?v=%s",
|
||||||
ytdl => 1,
|
ytdl => 1,
|
||||||
ytdl_cmd => "/usr/bin/yt-dlp",
|
ytdl_cmd => "/usr/bin/yt-dlp",
|
||||||
|
ytdlp_comments => 0,
|
||||||
|
ytdlp_max_comments => 10,
|
||||||
|
ytdlp_max_replies => 3,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ from local import GPG_KEY, NOTIF_GRANTS
|
||||||
c = c # noqa: F821 pylint: disable=E0602,C0103
|
c = c # noqa: F821 pylint: disable=E0602,C0103
|
||||||
config = config # noqa: F821 pylint: disable=E0602,C0103
|
config = config # noqa: F821 pylint: disable=E0602,C0103
|
||||||
|
|
||||||
|
config.load_autoconfig(False)
|
||||||
|
|
||||||
########
|
########
|
||||||
# Misc #
|
# Misc #
|
||||||
########
|
########
|
||||||
|
@ -50,6 +52,7 @@ config.set("content.notifications.enabled", False, "*://*.reddit.com/*")
|
||||||
|
|
||||||
# Hinting
|
# Hinting
|
||||||
config.bind("F", "hint all tab-bg")
|
config.bind("F", "hint all tab-bg")
|
||||||
|
config.bind(";p", "hint links spawn cliplumber {hint-url}")
|
||||||
config.bind(";v", "hint links spawn playvideo {hint-url}")
|
config.bind(";v", "hint links spawn playvideo {hint-url}")
|
||||||
config.bind(";i", "hint images download")
|
config.bind(";i", "hint images download")
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
top.location.hostname = "nitter.pussthecat.org";
|
top.location.hostname = "nitter.fdn.fr";
|
||||||
})();
|
})();
|
||||||
|
|
37
mailcap
37
mailcap
|
@ -1,3 +1,40 @@
|
||||||
text/html; unshare -n -r w3m -I %{charset} -T text/html; copiousoutput;
|
text/html; unshare -n -r w3m -I %{charset} -T text/html; copiousoutput;
|
||||||
image/*; mutt_bgrun /usr/bin/feh -. %s; test=test -n "$DISPLAY"
|
image/*; mutt_bgrun /usr/bin/feh -. %s; test=test -n "$DISPLAY"
|
||||||
application/pdf; mutt_bgrun /usr/bin/zathura %s; test=test -n "$DISPLAY"
|
application/pdf; mutt_bgrun /usr/bin/zathura %s; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
# Fichiers LibreOffice, Word, Excel et PowerPoint
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.template; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.template; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
application/msword; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.msword; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
application/excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/msexcel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/x-excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/x-msexcel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/vnd.ms-excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/ms-Excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
application/vnd.ms-powerpoint; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/x-mspowerpoint; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
application/ppt; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
application/rtf; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||||
|
|
||||||
|
# # MS documents to txt
|
||||||
|
# application/msword; tika -t %s | less;
|
||||||
|
# application/vnd.msword; tika -t %s | less;
|
||||||
|
# application/excel; tika %s | less;
|
||||||
|
# application/msexcel; tika %s | less;
|
||||||
|
# application/x-excel; tika %s | less;
|
||||||
|
# application/x-msexcel; tika %s | less;
|
||||||
|
# application/vnd.ms-excel; tika %s | less;
|
||||||
|
# application/ms-Excel; tika %s | less;
|
||||||
|
# application/vnd.ms-powerpoint; tika %s | w3m -dump -T text/html | less;
|
||||||
|
# application/x-mspowerpoint; tika %s | w3m -dump -T text/html | less;
|
||||||
|
# application/ppt; tika %s | w3m -dump -T text/html | less;
|
||||||
|
# application/rtf; tika %s | w3m -dump -T text/html | less;
|
||||||
|
|
1
vimrc
1
vimrc
|
@ -58,6 +58,7 @@ if has("unix") || has("mac")
|
||||||
|
|
||||||
Plugin 'tikhomirov/vim-glsl'
|
Plugin 'tikhomirov/vim-glsl'
|
||||||
Plugin 'jamessan/vim-gnupg'
|
Plugin 'jamessan/vim-gnupg'
|
||||||
|
Plugin 'https://git.sr.ht/~sircmpwn/hare.vim'
|
||||||
Plugin 'romainl/vim-cool'
|
Plugin 'romainl/vim-cool'
|
||||||
Plugin 'machakann/vim-highlightedyank'
|
Plugin 'machakann/vim-highlightedyank'
|
||||||
let g:highlightedyank_highlight_duration = 200
|
let g:highlightedyank_highlight_duration = 200
|
||||||
|
|
Loading…
Reference in a new issue