Compare commits

..

8 Commits

11 changed files with 3097 additions and 5 deletions

View File

@ -1,8 +1,6 @@
# Color ls # Color ls
alias ls='ls --color=auto' alias ls='ls --color=auto'
# Limit mpv and youtube-dl to 1080p so it doesn't use too much bandwidth
alias mpvs='mpv --ytdl-format="bestvideo[ext=mp4][height<=?1080]+bestaudio[ext=m4a]"'
# Run mpv from clipboard # Run mpv from clipboard
alias mpvy='mpvs (xsel -b)' alias mpvy='mpvs (xsel -b)'

View File

@ -10,7 +10,9 @@ source ~/.config/fish/functions/extra_prompt.fish
gpgt gpgt
# Add .local/bin to path # Add .local/bin to path
set -gx PATH "$PATH:$HOME/.local/bin:$HOME/.local/bin/deskutils:" set -gx PATH "$PATH:$HOME/.local/bin:"
set -gx PATH "$PATH:$HOME/.local/bin/deskutils:"
set -gx PATH "$PATH:$HOME/.local/bin/minrss-scripts:"
# Disable fish greeting # Disable fish greeting
set fish_greeting "" set fish_greeting ""

1
src/.config/mpv/mpv.conf Normal file
View File

@ -0,0 +1 @@
osd-status-msg=${playback-time/full} / ${duration} (${percent-pos}%)\nframe: ${estimated-frame-number} / ${estimated-frame-count}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,133 @@
-- sponsorblock_minimal.lua
--
-- This script skips sponsored segments of YouTube videos
-- using data from https://github.com/ajayyy/SponsorBlock
local opt = require 'mp.options'
local options = {
server = "https://sponsor.ajay.app/api/skipSegments",
-- Categories to fetch and skip
categories = '"sponsor"'
}
opt.read_options(options)
function getranges()
local luacurl_available, cURL = pcall(require,'cURL')
local cstr = ("categories=[%s]"):format(options.categories)
local vstr = ("videoID=%s"):format(youtube_id)
if not(luacurl_available) then -- if Lua-cURL is not available on this system
local curl_cmd = {
"curl",
"-L",
"-s",
"-G",
"-d", cstr,
"-d", vstr,
options.server
}
local sponsors = mp.command_native{
name = "subprocess",
capture_stdout = true,
playback_only = false,
args = curl_cmd
}
res = sponsors.stdout
else -- otherwise use Lua-cURL (binding to libcurl)
local API = ("%s?%s&%s"):format(options.server, cstr, vstr)
local buf={}
local c = cURL.easy_init()
c:setopt_followlocation(1)
c:setopt_url(API)
c:setopt_writefunction(function(chunk) table.insert(buf,chunk); return true; end)
c:perform()
res = table.concat(buf)
end
if string.match(res,"%[(.-)%]") then
ranges = {}
for i in string.gmatch(string.sub(res,2,-2),"%[(.-)%]") do
k,v = string.match(i,"(%d+.?%d*),(%d+.?%d*)")
ranges[k] = v
end
end
return
end
function skip_ads(name,pos)
if pos ~= nil then
for k,v in pairs(ranges) do
k = tonumber(k)
v = tonumber(v)
if k <= pos and v > pos then
--this message may sometimes be wrong
--it only seems to be a visual thing though
mp.osd_message(("[sponsorblock] skipping forward %ds"):format(math.floor(v-mp.get_property("time-pos"))))
--need to do the +0.01 otherwise mpv will start spamming skip sometimes
--example: https://www.youtube.com/watch?v=4ypMJzeNooo
mp.set_property("time-pos",v+0.01)
return
end
end
end
return
end
function file_loaded()
local video_path = mp.get_property("path", "")
local video_referer = string.match(mp.get_property("http-header-fields", ""), "Referer:([^,]+)") or ""
local urls = {
"ytdl://youtu%.be/([%w-_]+).*",
"ytdl://w?w?w?%.?youtube%.com/v/([%w-_]+).*",
"https?://youtu%.be/([%w-_]+).*",
"https?://w?w?w?%.?youtube%.com/v/([%w-_]+).*",
"/watch.*[?&]v=([%w-_]+).*",
"/embed/([%w-_]+).*",
"^ytdl://([%w-_]+)$",
"-([%w-_]+)%."
}
youtube_id = nil
local purl = mp.get_property("metadata/by-key/PURL", "")
for i,url in ipairs(urls) do
youtube_id = youtube_id or string.match(video_path, url) or string.match(video_referer, url) or string.match(purl, url)
end
if not youtube_id or string.len(youtube_id) < 11 then return end
youtube_id = string.sub(youtube_id, 1, 11)
getranges()
if ranges then
ON = true
mp.add_key_binding("b","sponsorblock",toggle)
mp.observe_property("time-pos", "native", skip_ads)
end
return
end
function end_file()
if not ON then return end
mp.unobserve_property(skip_ads)
ranges = nil
ON = false
end
function toggle()
if ON then
mp.unobserve_property(skip_ads)
mp.osd_message("[sponsorblock] off")
ON = false
return
end
mp.observe_property("time-pos", "native", skip_ads)
mp.osd_message("[sponsorblock] on")
ON = true
return
end
mp.register_event("file-loaded", file_loaded)
mp.register_event("end-file", end_file)

22
src/.config/sxhkd/sxhkdrc Normal file
View File

@ -0,0 +1,22 @@
# Soundboard setup
# "Boxes" labelled 0-9 in ~/med/sb2/
# Each one has files/symlinks 0-9
super + {0-9}
unlink ~/med/sb/cur;\
ln -sr ~/med/sb/{0-9} ~/med/sb/cur;\
rm /tmp/sb-socket*
KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
id=$(cat /dev/random | base32 | head -c 5);\
socket="/tmp/sb-socket$snd_id-$id";\
mpv --input-ipc-server=$socket ~/med/sb/cur/$snd_id*;\
rm $socket
shift + KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls /tmp/sb-socket$snd_id-* |\
while read -r socket; do \
echo {"stop"} | socat - $socket;\
done

View File

@ -28,7 +28,8 @@ then
--exclude=med/memes/woof/quar \ --exclude=med/memes/woof/quar \
--exclude=BL_proxy \ --exclude=BL_proxy \
--exclude=a.out \ --exclude=a.out \
~/med ~/dox dogeystamp@lambda:/mnt/disk/uv/ --exclude=dlcache \
~/med ~/dox ~/.xonotic dogeystamp@lambda:/mnt/disk/uv/
fi fi
if [ $ACTION = RECV ] if [ $ACTION = RECV ]

View File

@ -2,4 +2,8 @@
# Dunst notification sound script. # Dunst notification sound script.
if pactl list short sinks | grep -q virtual_mic; then
mpv ~/.local/bin/deskutils/notif.wav --audio-device=pulse/c1_out
else
mpv ~/.local/bin/deskutils/notif.wav mpv ~/.local/bin/deskutils/notif.wav
fi

5
src/.local/bin/mpva Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# Run mpv on the output files of minrss
mpvs $(for v in "$@"; do echo $(head -n 2 "${v}" | tail -n 1 | awk -F\" '{ print $2 }'); done)

10
src/.local/bin/mpvs Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Custom mpv settings
# passed to yt-dl
FORMAT="bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best"
mpv \
--ytdl-format="$FORMAT" \
$@

View File

@ -35,6 +35,8 @@ export BROWSER="qutebrowser"
export MANPAGER='nvim +Man!' export MANPAGER='nvim +Man!'
export MANWIDTH=999 export MANWIDTH=999
export SXHKD_SHELL='/bin/sh'
# Variables for passphrase2pgp # Variables for passphrase2pgp
export REALNAME="dogeystamp" export REALNAME="dogeystamp"
export EMAIL="dogeystamp@disroot.org" export EMAIL="dogeystamp@disroot.org"