kernel still breaking. updated name which may have been issue

This commit is contained in:
tumillanino
2026-04-09 15:58:55 +10:00
parent 1c59f8a718
commit c6ffa3591f
155 changed files with 6219 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
################### File Generated by Goverlay ###################
legacy_layout=false
background_alpha=0.0
round_corners=0
background_alpha=0.0
background_color=000000
font_size=14
text_color=FFFFFF
position=top-left
toggle_hud=Shift_R+F12
pci_dev=0:08:00.0
table_columns=3
gpu_text=GPU
gpu_stats
gpu_temp
gpu_color=2E9762
cpu_text=CPU
cpu_stats
cpu_temp
cpu_color=2E97CB
vram
vram_color=AD64C1
ram
ram_color=C26693
fps
fps_limit_method=late
toggle_fps_limit=Shift_L+F1
fps_limit=90
fps_color_change
fps_color=B22222,F9F06B,99C1F1
fps_value=30,90
#offset=0
output_folder=/var/home/mel
log_duration=30
autostart_log=0
log_interval=100
toggle_logging=Shift_L+F2

View File

@@ -0,0 +1,42 @@
## GENERAL ##
## profile ##
profile=fast
## hardware acceleration ##
# vo=gpu-next
# hwdec=auto
gpu-context=wayland,auto
vo=dmabuf-wayland,gpu-next
hwdec=auto-safe
# others #
save-position-on-quit=yes
keep-open=yes
border=yes
screenshot-directory="~/Pictures/mpv/"
screenshot-template="%F - [%P]v%#01n"
screenshot-format=webp
screenshot-webp-quality=90
slang=eng,en,enUS,en-US,English,jpn,jp,jap,Japanese
sub-font-size=32
volume-max=100
## INPUT ##
## OSD ##
osd-duration=2000
osd-playing-msg='${filename}'
# osc-seekbarstyle=bar
# osd-font-size=20
## resize window ##
autofit-larger=75%x75%
## yt-dlp ##
[protocol.https]
prefetch-playlist=yes
cache-secs=10
osd-playing-msg='${media-title}'
ytdl-format="bestvideo[height<=1080]+bestaudio"
ytdl-raw-options=cookies-from-browser=firefox

View File

@@ -0,0 +1,333 @@
-- Copyright (c) 2021, Eisa AlAwadhi
-- License: BSD 2-Clause License
-- Creator: Eisa AlAwadhi
-- Project: SmartCopyPaste
-- Version: 2.4.1
local utils = require 'mp.utils'
local msg = require 'mp.msg'
local protocols
local extensions
local pasted = false
----------------------------USER CUSTOMIZATION SETTINGS-----------------------------------
--These settings are for users to manually change some options in the script.
--Keybinds can be defined in the bottom of the script.
local device = nil --nil is for automatic device detection, or manually change to: 'windows' or 'mac' or 'linux'
local linux_copy = 'wl-copy' --copy command that will be used in Linux. OR write a different command
local linux_paste = 'wl-paste' --paste command that will be used in Linux. OR write a different command
local mac_copy = 'pbcopy' --copy command that will be used in MAC. OR write a different command
local mac_paste = 'pbpaste' --paste command that will be used in MAC. OR write a different command
local windows_copy = 'powershell' --'powershell' is for using windows powershell to copy. OR write the copy command, e.g: ' clip'
local windows_paste = 'powershell' --'powershell' is for using windows powershell to paste. OR write the paste command
local offset = -0.65 --change to 0 so that pasting resumes from the exact position, or decrease the value so that it gives you a little preview before reaching the exact pasted position
local paste_anything = false --false is for specific paste based on the specified extensions and protocols. Change to true so paste accepts anything (not recommended to change this).
if not paste_anything then
protocols = { --add below (after a comma) any protocol you want SmartCopyPaste to work with; e.g: ,'ftp://'
'https?://' ,'magnet:'
}
extensions = { --add below (after a comma) any extension you want SmartCopyPaste to work with; e.g: ,'pdf'
--video & audio
'ac3', 'a52', 'eac3', 'mlp', 'dts', 'dts-hd', 'dtshd', 'true-hd', 'thd', 'truehd', 'thd+ac3', 'tta', 'pcm', 'wav', 'aiff', 'aif', 'aifc', 'amr', 'awb', 'au', 'snd', 'lpcm', 'yuv', 'y4m', 'ape', 'wv', 'shn', 'm2ts', 'm2t', 'mts', 'mtv', 'ts', 'tsv', 'tsa', 'tts', 'trp', 'adts', 'adt', 'mpa', 'm1a', 'm2a', 'mp1', 'mp2', 'mp3', 'mpeg', 'mpg', 'mpe', 'mpeg2', 'm1v', 'm2v', 'mp2v', 'mpv', 'mpv2', 'mod', 'tod', 'vob', 'vro', 'evob', 'evo', 'mpeg4', 'm4v', 'mp4', 'mp4v', 'mpg4', 'm4a', 'aac', 'h264', 'avc', 'x264', '264', 'hevc', 'h265', 'x265', '265', 'flac', 'oga', 'ogg', 'opus', 'spx', 'ogv', 'ogm', 'ogx', 'mkv', 'mk3d', 'mka', 'webm', 'weba', 'avi', 'vfw', 'divx', '3iv', 'xvid', 'nut', 'flic', 'fli', 'flc', 'nsv', 'gxf', 'mxf', 'wma', 'wm', 'wmv', 'asf', 'dvr-ms', 'dvr', 'wtv', 'dv', 'hdv', 'flv','f4v', 'f4a', 'qt', 'mov', 'hdmov', 'rm', 'rmvb', 'ra', 'ram', '3ga', '3ga2', '3gpp', '3gp', '3gp2', '3g2', 'ay', 'gbs', 'gym', 'hes', 'kss', 'nsf', 'nsfe', 'sap', 'spc', 'vgm', 'vgz', 'm3u', 'm3u8', 'pls', 'cue',
--images
"ase", "art", "bmp", "blp", "cd5", "cit", "cpt", "cr2", "cut", "dds", "dib", "djvu", "egt", "exif", "gif", "gpl", "grf", "icns", "ico", "iff", "jng", "jpeg", "jpg", "jfif", "jp2", "jps", "lbm", "max", "miff", "mng", "msp", "nitf", "ota", "pbm", "pc1", "pc2", "pc3", "pcf", "pcx", "pdn", "pgm", "PI1", "PI2", "PI3", "pict", "pct", "pnm", "pns", "ppm", "psb", "psd", "pdd", "psp", "px", "pxm", "pxr", "qfx", "raw", "rle", "sct", "sgi", "rgb", "int", "bw", "tga", "tiff", "tif", "vtf", "xbm", "xcf", "xpm", "3dv", "amf", "ai", "awg", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "gbr", "odg", "svg", "stl", "vrml", "x3d", "sxd", "v2d", "vnd", "wmf", "emf", "art", "xar", "png", "webp", "jxr", "hdp", "wdp", "cur", "ecw", "iff", "lbm", "liff", "nrrd", "pam", "pcx", "pgf", "sgi", "rgb", "rgba", "bw", "int", "inta", "sid", "ras", "sun", "tga",
--other types
'torrent'
}
---------------------------END OF USER CUSTOMIZATION SETTINGS------------------------
else
protocols = {''}
extensions = {''}
end
if not device then
if os.getenv('windir') ~= nil then
device = 'windows'
elseif os.execute '[ -d "/Applications" ]' == 0 and os.execute '[ -d "/Library" ]' == 0 or os.execute '[ -d "/Applications" ]' == true and os.execute '[ -d "/Library" ]' == true then
device = 'mac'
else
device = 'linux'
end
end
function handleres(res, args)
if not res.error and res.status == 0 then
return res.stdout
else
msg.error("There was an error getting "..device.." clipboard: ")
msg.error(" Status: "..(res.status or ""))
msg.error(" Error: "..(res.error or ""))
msg.error(" stdout: "..(res.stdout or ""))
msg.error("args: "..utils.to_string(args))
return ''
end
end
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
local function get_extension(path)
match = string.match(path, '%.([^%.]+)$' )
if match == nil then
return 'nomatch'
else
return match
end
end
local function get_extentionpath(path)
match = string.match(path,'(.*)%.([^%.]+)$')
if match == nil then
return 'nomatch'
else
return match
end
end
local function has_extension (tab, val)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
local function starts_protocol (tab, val)
for index, value in ipairs(tab) do
if (val:find(value) == 1) then
return true
end
end
return false
end
function get_clipboard()
local clip
if device == 'linux' then
clip = os.capture(linux_paste, false)
return clip
elseif device == 'windows' then
if windows_paste == 'powershell' then
local args = {
'powershell', '-NoProfile', '-Command', [[& {
Trap {
Write-Error -ErrorRecord $_
Exit 1
}
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
if ($clip) {
$clip = $clip
}
else {
$clip = Get-Clipboard -Raw -Format FileDropList
}
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
}]]
}
return handleres(utils.subprocess({ args = args, cancellable = false }), args)
else
clip = os.capture(windows_paste, false)
return clip
end
elseif device == 'mac' then
clip = os.capture(mac_paste, false)
return clip
end
return ''
end
function set_clipboard(text)
local pipe
if device == 'linux' then
pipe = io.popen(linux_copy, 'w')
pipe:write(text)
pipe:close()
elseif device == 'windows' then
if windows_copy == 'powershell' then
local res = utils.subprocess({ args = {
'powershell', '-NoProfile', '-Command', string.format([[& {
Trap {
Write-Error -ErrorRecord $_
Exit 1
}
Add-Type -AssemblyName PresentationCore
[System.Windows.Clipboard]::SetText('%s')
}]], text)
} })
else
pipe = io.popen(windows_copy,'w')
pipe:write(text)
pipe:close()
end
elseif device == 'mac' then
pipe = io.popen(mac_copy,'w')
pipe:write(text)
pipe:close()
end
return ''
end
local function copy()
local filePath = mp.get_property_native('path')
if (filePath ~= nil) then
local time = math.floor(mp.get_property_number('time-pos'))
mp.osd_message("Copied:\n"..filePath..' |time='..tostring(time))
set_clipboard(filePath..' |time='..tostring(time))
else
mp.osd_message('Failed to Copy\nNo Video Found')
end
end
local function copy_path()
local filePath = mp.get_property_native('path')
if (filePath ~= nil) then
mp.osd_message("Copied Video Only:\n"..filePath)
set_clipboard(filePath)
else
return false
end
end
function paste()
mp.osd_message("Pasting...")
local clip = get_clipboard()
clip = string.gsub(clip, "[\r\n]" , "")
local filePath = mp.get_property_native('path')
local time
if string.match(clip, '(.*) |time=') then
videoFile = string.match(clip, '(.*) |time=')
time = string.match(clip, ' |time=(.*)')
elseif string.match(clip, '^\"(.*)\"$') then
videoFile = string.match(clip, '^\"(.*)\"$')
else
videoFile = clip
end
local currentVideoExtension = string.lower(get_extension(videoFile))
local currentVideoExtensionPath = (get_extentionpath(videoFile))
local seekTime
if (filePath == nil) and has_extension(extensions, currentVideoExtension) and (currentVideoExtensionPath~= '') then
mp.osd_message("Pasted:\n"..videoFile)
mp.commandv('loadfile', videoFile)
elseif (filePath == nil) and (starts_protocol(protocols, videoFile)) then
mp.osd_message("Pasted:\n"..videoFile)
mp.commandv('loadfile', videoFile)
elseif (filePath ~= nil) and (filePath ~= videoFile) and has_extension(extensions, currentVideoExtension) and (currentVideoExtensionPath~= '') or (starts_protocol(protocols, videoFile)) and (filePath ~= videoFile) then
mp.osd_message('Pasted Into Playlist:\n'..videoFile)
mp.commandv('loadfile', videoFile, 'append-play')
elseif (filePath == videoFile) and (time == nil) then
mp.osd_message('Same file is already running:\n'..clip)
elseif (filePath == videoFile) and (time ~= nil) then
mp.osd_message('Resumed to Copied Time')
seekTime = time + offset
if (seekTime < 0) then
seekTime = 0
end
mp.commandv('seek', seekTime, 'absolute', 'exact')
else
mp.osd_message('Failed to Paste\nPasted Unsupported Item:\n'..clip)
end
pasted = true
end
function paste_playlist()
mp.osd_message("Pasting...")
local clip = get_clipboard()
clip = string.gsub(clip, "[\r\n]" , "")
local filePath = mp.get_property_native('path')
if string.match(clip, '(.*) |time=') then
videoFile = string.match(clip, '(.*) |time=')
elseif string.match(clip, '^\"(.*)\"$') then
videoFile = string.match(clip, '^\"(.*)\"$')
else
videoFile = clip
end
local currentVideoExtension = string.lower(get_extension(videoFile))
local currentVideoExtensionPath = (get_extentionpath(videoFile))
if has_extension(extensions, currentVideoExtension) and (currentVideoExtensionPath~= '') or (starts_protocol(protocols, videoFile)) then
mp.osd_message('Pasted Into Playlist:\n'..videoFile)
mp.commandv('loadfile', videoFile, 'append-play')
else
mp.osd_message('Failed to Add Into Playlist\nPasted Unsupported Item:\n'..clip)
end
pasted = true
end
mp.register_event('end-file', function()
pasted = false
end)
mp.register_event('file-loaded', function()
if (pasted == true) then
local clip = get_clipboard()
local time = string.match(clip, ' |time=(.*)')
local videoFile = string.match(clip, '(.*) |time=')
local filePath = mp.get_property_native('path')
local seekTime
if (filePath == videoFile) and (time ~= nil) then
seekTime = time + offset
if (seekTime < 0) then
seekTime = 0
end
mp.commandv('seek', seekTime, 'absolute', 'exact')
end
else
return false
end
end)
---------------------------KEYBINDS CUSTOMIZATION SETTINGS---------------------------------
if device == 'mac' then --MAC OS Keybinds
mp.add_key_binding('Meta+alt+c', 'copy-path', copy_path)
mp.add_key_binding('Meta+alt+C', 'copy-pathCaps', copy_path)
mp.add_key_binding('Meta+alt+v', 'paste-playlist', paste_playlist)
mp.add_key_binding('Meta+alt+V', 'paste-playlistCaps', paste_playlist)
else --Windows and Linux Keybinds
mp.add_key_binding('ctrl+c', 'copy-path', copy_path)
mp.add_key_binding('ctrl+v', 'paste-playlist', paste_playlist)
end
---------------------END OF KEYBINDS CUSTOMIZATION SETTINGS---------------------------------

View File

@@ -0,0 +1,56 @@
---@class ClipshotOptions
---@field name string
---@field type string
local o = {
name = 'mpv-screenshot.jpeg',
type = '' -- defaults to jpeg
}
require('mp.options').read_options(o, 'clipshot')
local file, cmd
local lib = package.cpath:match('%p[\\|/]?%p(%a+)')
if lib == 'so' then -- Linux/BSD
file = '/tmp/'..o.name
if os.getenv('XDG_SESSION_TYPE') == 'wayland' then -- Wayland
cmd = {'sh', '-c', ('wl-copy < %q'):format(image)}
else -- Xorg
local type = o.type ~= '' and o.type or 'image/jpeg'
cmd = {'xclip', '-sel', 'c', '-t', type, '-i', file}
end
elseif lib == 'dll' then -- Windows
file = os.getenv('TEMP')..'\\'..o.name
cmd = {
'powershell', '-NoProfile', '-Command', ([[& {
Add-Type -Assembly System.Windows.Forms;
Add-Type -Assembly System.Drawing;
$shot = [Drawing.Image]::FromFile(%q);
[Windows.Forms.Clipboard]::SetImage($shot);
}]]):format(file)
}
else -- MacOS
file = os.getenv('TMPDIR')..'/'..o.name
-- png: «class PNGf»
local type = o.type ~= '' and o.type or 'JPEG picture'
cmd = {
'osascript', '-e', ([[
set the clipboard to ( ¬
read (POSIX file %q) as %s)
]]):format(file, type)
}
end
---@param arg string
---@return fun()
local function clipshot(arg)
return function()
mp.commandv('screenshot-to-file', file, arg)
mp.command_native_async({'run', unpack(cmd)}, function(suc, _, err)
mp.osd_message(suc and 'Copied screenshot to clipboard' or err, 1)
end)
end
end
mp.add_key_binding('c', 'clipshot-subs', clipshot('subtitles'))
mp.add_key_binding('C', 'clipshot-video', clipshot('video'))
mp.add_key_binding('Alt+c', 'clipshot-window', clipshot('window'))

View File

@@ -0,0 +1,418 @@
-- reload.lua
--
-- When an online video is stuck buffering or got very slow CDN
-- source, restarting often helps. This script provides automatic
-- reloading of videos that doesn't have buffering progress for some
-- time while keeping the current time position. It also adds `Ctrl+r`
-- keybinding to reload video manually.
--
-- SETTINGS
--
-- To override default setting put the `lua-settings/reload.conf` file in
-- mpv user folder, on linux it is `~/.config/mpv`. NOTE: config file
-- name should match the name of the script.
--
-- Default `reload.conf` settings:
--
-- ```
-- # enable automatic reload on timeout
-- # when paused-for-cache event fired, we will wait
-- # paused_for_cache_timer_timeout sedonds and then reload the video
-- paused_for_cache_timer_enabled=yes
--
-- # checking paused_for_cache property interval in seconds,
-- # can not be less than 0.05 (50 ms)
-- paused_for_cache_timer_interval=1
--
-- # time in seconds to wait until reload
-- paused_for_cache_timer_timeout=10
--
-- # enable automatic reload based on demuxer cache
-- # if demuxer-cache-time property didn't change in demuxer_cache_timer_timeout
-- # time interval, the video will be reloaded as soon as demuxer cache depleated
-- demuxer_cache_timer_enabled=yes
--
-- # checking demuxer-cache-time property interval in seconds,
-- # can not be less than 0.05 (50 ms)
-- demuxer_cache_timer_interval=2
--
-- # if demuxer cache didn't receive any data during demuxer_cache_timer_timeout
-- # we decide that it has no progress and will reload the stream when
-- # paused_for_cache event happens
-- demuxer_cache_timer_timeout=20
--
-- # when the end-of-file is reached, reload the stream to check
-- # if there is more content available.
-- reload_eof_enabled=no
--
-- # keybinding to reload stream from current time position
-- # you can disable keybinding by setting it to empty value
-- # reload_key_binding=
-- reload_key_binding=Ctrl+r
-- ```
--
-- DEBUGGING
--
-- Debug messages will be printed to stdout with mpv command line option
-- `--msg-level='reload=debug'`. You may also need to add the `--no-msg-color`
-- option to make the debug logs visible if you are using a dark colorscheme
-- in terminal.
local msg = require 'mp.msg'
local options = require 'mp.options'
local utils = require 'mp.utils'
local settings = {
paused_for_cache_timer_enabled = true,
paused_for_cache_timer_interval = 1,
paused_for_cache_timer_timeout = 10,
demuxer_cache_timer_enabled = true,
demuxer_cache_timer_interval = 2,
demuxer_cache_timer_timeout = 20,
reload_eof_enabled = false,
reload_key_binding = "Ctrl+r",
}
-- global state stores properties between reloads
local property_path = nil
local property_time_pos = 0
local property_keep_open = nil
-- FSM managing the demuxer cache.
--
-- States:
--
-- * fetch - fetching new data
-- * stale - unable to fetch new data for time < 'demuxer_cache_timer_timeout'
-- * stuck - unable to fetch new data for time >= 'demuxer_cache_timer_timeout'
--
-- State transitions:
--
-- +---------------------------+
-- v |
-- +-------+ +-------+ +-------+
-- + fetch +<--->+ stale +---->+ stuck |
-- +-------+ +-------+ +-------+
-- | ^ | ^ | ^
-- +---+ +---+ +---+
local demuxer_cache = {
timer = nil,
state = {
name = 'uninitialized',
demuxer_cache_time = 0,
in_state_time = 0,
},
events = {
continue_fetch = { name = 'continue_fetch', from = 'fetch', to = 'fetch' },
continue_stale = { name = 'continue_stale', from = 'stale', to = 'stale' },
continue_stuck = { name = 'continue_stuck', from = 'stuck', to = 'stuck' },
fetch_to_stale = { name = 'fetch_to_stale', from = 'fetch', to = 'stale' },
stale_to_fetch = { name = 'stale_to_fetch', from = 'stale', to = 'fetch' },
stale_to_stuck = { name = 'stale_to_stuck', from = 'stale', to = 'stuck' },
stuck_to_fetch = { name = 'stuck_to_fetch', from = 'stuck', to = 'fetch' },
},
}
-- Always start with 'fetch' state
function demuxer_cache.reset_state()
demuxer_cache.state = {
name = demuxer_cache.events.continue_fetch.to,
demuxer_cache_time = 0,
in_state_time = 0,
}
end
-- Has 'demuxer_cache_time' changed
function demuxer_cache.has_progress_since(t)
return demuxer_cache.state.demuxer_cache_time ~= t
end
function demuxer_cache.is_state_fetch()
return demuxer_cache.state.name == demuxer_cache.events.continue_fetch.to
end
function demuxer_cache.is_state_stale()
return demuxer_cache.state.name == demuxer_cache.events.continue_stale.to
end
function demuxer_cache.is_state_stuck()
return demuxer_cache.state.name == demuxer_cache.events.continue_stuck.to
end
function demuxer_cache.transition(event)
if demuxer_cache.state.name == event.from then
-- state setup
demuxer_cache.state.demuxer_cache_time = event.demuxer_cache_time
if event.name == 'continue_fetch' then
demuxer_cache.state.in_state_time = demuxer_cache.state.in_state_time + event.interval
elseif event.name == 'continue_stale' then
demuxer_cache.state.in_state_time = demuxer_cache.state.in_state_time + event.interval
elseif event.name == 'continue_stuck' then
demuxer_cache.state.in_state_time = demuxer_cache.state.in_state_time + event.interval
elseif event.name == 'fetch_to_stale' then
demuxer_cache.state.in_state_time = 0
elseif event.name == 'stale_to_fetch' then
demuxer_cache.state.in_state_time = 0
elseif event.name == 'stale_to_stuck' then
demuxer_cache.state.in_state_time = 0
elseif event.name == 'stuck_to_fetch' then
demuxer_cache.state.in_state_time = 0
end
-- state transition
demuxer_cache.state.name = event.to
msg.debug('demuxer_cache.transition', event.name, utils.to_string(demuxer_cache.state))
else
msg.error(
'demuxer_cache.transition',
'illegal transition', event.name,
'from state', demuxer_cache.state.name)
end
end
function demuxer_cache.initialize(demuxer_cache_timer_interval)
demuxer_cache.reset_state()
demuxer_cache.timer = mp.add_periodic_timer(
demuxer_cache_timer_interval,
function()
demuxer_cache.demuxer_cache_timer_tick(
mp.get_property_native('demuxer-cache-time'),
demuxer_cache_timer_interval)
end
)
end
-- If there is no progress of demuxer_cache_time in
-- settings.demuxer_cache_timer_timeout time interval switch state to
-- 'stuck' and switch back to 'fetch' as soon as any progress is made
function demuxer_cache.demuxer_cache_timer_tick(demuxer_cache_time, demuxer_cache_timer_interval)
local event = nil
local cache_has_progress = demuxer_cache.has_progress_since(demuxer_cache_time)
-- I miss pattern matching so much
if demuxer_cache.is_state_fetch() then
if cache_has_progress then
event = demuxer_cache.events.continue_fetch
else
event = demuxer_cache.events.fetch_to_stale
end
elseif demuxer_cache.is_state_stale() then
if cache_has_progress then
event = demuxer_cache.events.stale_to_fetch
elseif demuxer_cache.state.in_state_time < settings.demuxer_cache_timer_timeout then
event = demuxer_cache.events.continue_stale
else
event = demuxer_cache.events.stale_to_stuck
end
elseif demuxer_cache.is_state_stuck() then
if cache_has_progress then
event = demuxer_cache.events.stuck_to_fetch
else
event = demuxer_cache.events.continue_stuck
end
end
event.demuxer_cache_time = demuxer_cache_time
event.interval = demuxer_cache_timer_interval
demuxer_cache.transition(event)
end
local paused_for_cache = {
timer = nil,
time = 0,
}
function paused_for_cache.reset_timer()
msg.debug('paused_for_cache.reset_timer', paused_for_cache.time)
if paused_for_cache.timer then
paused_for_cache.timer:kill()
paused_for_cache.timer = nil
paused_for_cache.time = 0
end
end
function paused_for_cache.start_timer(interval_seconds, timeout_seconds)
msg.debug('paused_for_cache.start_timer', paused_for_cache.time)
if not paused_for_cache.timer then
paused_for_cache.timer = mp.add_periodic_timer(
interval_seconds,
function()
paused_for_cache.time = paused_for_cache.time + interval_seconds
if paused_for_cache.time >= timeout_seconds then
paused_for_cache.reset_timer()
reload_resume()
end
msg.debug('paused_for_cache', 'tick', paused_for_cache.time)
end
)
end
end
function paused_for_cache.handler(property, is_paused)
if is_paused then
if demuxer_cache.is_state_stuck() then
msg.info("demuxer cache has no progress")
-- reset demuxer state to avoid immediate reload if
-- paused_for_cache event triggered right after reload
demuxer_cache.reset_state()
reload_resume()
end
paused_for_cache.start_timer(
settings.paused_for_cache_timer_interval,
settings.paused_for_cache_timer_timeout)
else
paused_for_cache.reset_timer()
end
end
function read_settings()
options.read_options(settings, mp.get_script_name())
msg.debug(utils.to_string(settings))
end
function reload(path, time_pos)
msg.debug("reload", path, time_pos)
if time_pos == nil then
mp.commandv("loadfile", path, "replace")
else
mp.commandv("loadfile", path, "replace", "start=+" .. time_pos)
end
end
function reload_resume()
local path = mp.get_property("path", property_path)
local time_pos = mp.get_property("time-pos")
local reload_duration = mp.get_property_native("duration")
local playlist_count = mp.get_property_number("playlist/count")
local playlist_pos = mp.get_property_number("playlist-pos")
local playlist = {}
for i = 0, playlist_count-1 do
playlist[i] = mp.get_property("playlist/" .. i .. "/filename")
end
-- Tries to determine live stream vs. pre-recordered VOD. VOD has non-zero
-- duration property. When reloading VOD, to keep the current time position
-- we should provide offset from the start. Stream doesn't have fixed start.
-- Decent choice would be to reload stream from it's current 'live' positon.
-- That's the reason we don't pass the offset when reloading streams.
if reload_duration and reload_duration > 0 then
msg.info("reloading video from", time_pos, "second")
reload(path, time_pos)
-- VODs get stuck when reload is called without a time_pos
-- this is most noticeable in youtube videos whenever download gets stuck in the first frames
-- video would stay paused without being actually paused
-- issue surfaced in mpv 0.33, afaik
elseif reload_duration and reload_duration == 0 then
msg.info("reloading video from", time_pos, "second")
reload(path, time_pos)
else
msg.info("reloading stream")
reload(path, nil)
end
msg.info("file ", playlist_pos+1, "of", playlist_count, "in playlist")
for i = 0, playlist_pos-1 do
mp.commandv("loadfile", playlist[i], "append")
end
mp.commandv("playlist-move", 0, playlist_pos+1)
for i = playlist_pos+1, playlist_count-1 do
mp.commandv("loadfile", playlist[i], "append")
end
end
function reload_eof(property, eof_reached)
msg.debug("reload_eof", property, eof_reached)
local time_pos = mp.get_property_number("time-pos")
local duration = mp.get_property_number("duration")
if eof_reached and math.floor(time_pos) == math.floor(duration) then
msg.debug("property_time_pos", property_time_pos, "time_pos", time_pos)
-- Check that playback time_pos made progress after the last reload. When
-- eof is reached we try to reload video, in case there is more content
-- available. If time_pos stayed the same after reload, it means that vidkk
-- to avoid infinite reload loop when playback ended
-- math.floor function rounds time_pos to a second, to avoid inane reloads
if math.floor(property_time_pos) == math.floor(time_pos) then
msg.info("eof reached, playback ended")
mp.set_property("keep-open", property_keep_open)
else
msg.info("eof reached, checking if more content available")
reload_resume()
mp.set_property_bool("pause", false)
property_time_pos = time_pos
end
end
end
function on_file_loaded(event)
local debug_info = {
event = event,
time_pos = mp.get_property("time-pos"),
stream_pos = mp.get_property("stream-pos"),
stream_end = mp.get_property("stream-end"),
duration = mp.get_property("duration"),
seekable = mp.get_property("seekable"),
pause = mp.get_property("pause"),
paused_for_cache = mp.get_property("paused-for-cache"),
cache_buffering_state = mp.get_property("cache-buffering-state"),
}
msg.debug("debug_info", utils.to_string(debug_info))
-- When the video is reloaded after being paused for cache, it won't start
-- playing again while all properties looks fine:
-- `pause=no`, `paused-for-cache=no` and `cache-buffering-state=100`.
-- As a workaround, we cycle through the paused state by sending two SPACE
-- keypresses.
-- What didn't work:
-- - Cycling through the `pause` property.
-- - Run the `playlist-play-index current` command.
mp.commandv("keypress", 'SPACE')
mp.commandv("keypress", 'SPACE')
end
-- main
read_settings()
if settings.reload_key_binding ~= "" then
mp.add_key_binding(settings.reload_key_binding, "reload_resume", reload_resume)
end
if settings.paused_for_cache_timer_enabled then
mp.observe_property("paused-for-cache", "bool", paused_for_cache.handler)
end
if settings.demuxer_cache_timer_enabled then
demuxer_cache.initialize(settings.demuxer_cache_timer_interval)
end
if settings.reload_eof_enabled then
-- vo-configured == video output created && its configuration went ok
mp.observe_property(
"vo-configured",
"bool",
function(name, vo_configured)
msg.debug(name, vo_configured)
if vo_configured then
property_path = mp.get_property("path")
property_keep_open = mp.get_property("keep-open")
mp.set_property("keep-open", "yes")
mp.set_property("keep-open-pause", "no")
end
end
)
mp.observe_property("eof-reached", "bool", reload_eof)
end
mp.register_event("file-loaded", on_file_loaded)

View File

@@ -0,0 +1,5 @@
if grep -q "Arch Linux" /etc/os-release
function bat --wraps=glow --description 'alias bat glow'
glow $argv
end
end

View File

@@ -0,0 +1,9 @@
if grep -q "Arch Linux" /etc/os-release
atuin init fish | source
end
if grep -q "Arch Linux" /etc/os-release
function cat --wraps=glow --description 'alias cat glow'
glow $argv
end
end

View File

@@ -0,0 +1,3 @@
function deployments
rpm-ostree status $argv
end

View File

@@ -0,0 +1,7 @@
function fish_greeting
fastfetch -c ~/.config/fastfetch/startup.jsonc
## atuin
if grep -q "Arch Linux" /etc/os-release
atuin init fish | source
end
end

View File

@@ -0,0 +1,4 @@
function m4a --description 'alias m4a yt-dlp -x --audio-format m4a'
yt-dlp -x --audio-format m4a $argv
end

View File

@@ -0,0 +1,3 @@
function pin-deployment
sudo ostree admin pin $argv
end

View File

@@ -0,0 +1,3 @@
function remove-deployment
sudo ostree admin undeploy $argv
end

View File

@@ -0,0 +1,3 @@
function unpin-deployment
sudo ostree admin pin -u $argv
end

View File

@@ -0,0 +1,5 @@
-N 5
--embed-thumbnail
--embed-metadata
--cookies-from-browser firefox
-o ~/Downloads/%(fulltitle)s.%(ext)s

View File

@@ -0,0 +1,7 @@
--ozone-platform-hint=auto
--enable-gpu-rasterization
--ignore-gpu-blocklist
--enable-zero-copy
--use-gl=angle
--use-angle=vulkan
--enable-features=Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,VaapiVideoDecodeLinuxGL,VaapiIgnoreDriverChecks,VaapiVideoEncoder,VaapiVideoDecoder