Rick van Vonderen
7 years ago
9 changed files with 599 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||||
|
# Change scroll to volume ajust |
||||||
|
AXIS_UP add volume 1 |
||||||
|
AXIS_DOWN add volume -1 |
||||||
|
AXIS_LEFT add volume 1 |
||||||
|
AXIS_RIGHT add volume -1 |
||||||
|
MOUSE_BTN3 add volume 1 |
||||||
|
MOUSE_BTN4 add volume -1 |
||||||
|
|
||||||
|
# Cycle through aspect ratio's |
||||||
|
F2 cycle_values video-aspect "16:9" "16:10" "4:3" "2.35:1" "-1" |
||||||
|
|
||||||
|
# Video view formats |
||||||
|
Alt+RIGHT add video-rotate 90 |
||||||
|
Alt+LEFT add video-rotate -90 |
||||||
|
Alt+- add video-zoom -0.25 |
||||||
|
Alt+= add video-zoom 0.25 |
||||||
|
Alt+h add video-pan-x -0.05 |
||||||
|
Alt+n add video-pan-x 0.05 |
||||||
|
Alt+c add video-pan-y 0.05 |
||||||
|
Alt+t add video-pan-y -0.05 |
@ -0,0 +1,6 @@ |
|||||||
|
layout=bottombar |
||||||
|
hidetimeout=2000 |
||||||
|
scalewindowed=2.4 |
||||||
|
scalefullscreen=2.4 |
||||||
|
vidscale=no |
||||||
|
valign=0.7 |
@ -0,0 +1,64 @@ |
|||||||
|
# [VIDEO] |
||||||
|
profile=opengl-hq |
||||||
|
hwdec=vaapi |
||||||
|
|
||||||
|
# [AUDIO] |
||||||
|
volume=30 |
||||||
|
volume-max=100 |
||||||
|
#autosync=30 # Sync the audio to the video playback |
||||||
|
|
||||||
|
# [WINDOW] |
||||||
|
geometry=1720:0 |
||||||
|
autofit=1280x720 |
||||||
|
autofit-larger=1280x720 |
||||||
|
border=no |
||||||
|
|
||||||
|
# [CACHE] |
||||||
|
cache=1024000 |
||||||
|
|
||||||
|
#cache=262144 |
||||||
|
#cache-default=51200 |
||||||
|
#cache-pause=no |
||||||
|
|
||||||
|
#cache=yes |
||||||
|
#cache-default=50000 # size in KB |
||||||
|
#cache-backbuffer=25000 # size in KB |
||||||
|
#cache-secs=10 # how many seconds of audio/video to prefetch if the cache is active |
||||||
|
|
||||||
|
# [SUBTITLES BEHAVIOUR AND FEEL] |
||||||
|
demuxer-mkv-subtitle-preroll # Load subtitles while seeking |
||||||
|
sub-ass-force-style=Kerning=yes # Forces kerning on subtitles (more pleasent spacing between letters) |
||||||
|
sub-use-margins # Use black borders space for subtitles |
||||||
|
sub-auto=fuzzy |
||||||
|
sub-file-paths=ass:srt:sub:subs:subtitles:Subtitles |
||||||
|
|
||||||
|
# [SUBTITLES LOOK] (for srt) |
||||||
|
sub-font="Source Sans Pro Semibold" |
||||||
|
sub-font-size=48 |
||||||
|
sub-margin-y=36 |
||||||
|
sub-color="#FFFFFFFF" |
||||||
|
sub-border-color="#FF151515" |
||||||
|
sub-border-size=3.2 |
||||||
|
sub-shadow-offset=1 |
||||||
|
sub-shadow-color="#33000000" |
||||||
|
sub-spacing=0.5 |
||||||
|
|
||||||
|
# [Language] |
||||||
|
slang=jp,jpn,Japanese,en,eng,English |
||||||
|
alang=jp,jpn,Japanese,en,eng,English |
||||||
|
|
||||||
|
# [YouTube] |
||||||
|
ytdl |
||||||
|
ytdl-format=bestvideo[height<=?1080]+bestaudio/best # Get the best quality available, equal to or below 1080p |
||||||
|
#ytdl-format=0/(bestvideo[vcodec=vp9]/bestvideo[height>720]/bestvideo[fps>30])[tbr<13000]+(bestaudio[acodec=opus]/bestaudio)/best |
||||||
|
|
||||||
|
# [Profiles] |
||||||
|
[extension.webm] |
||||||
|
loop-file=inf |
||||||
|
|
||||||
|
[extension.gif] |
||||||
|
loop-file=inf |
||||||
|
|
||||||
|
#[protocol.http] |
||||||
|
#[protocol.https] |
||||||
|
#user-agent='Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' |
@ -0,0 +1,113 @@ |
|||||||
|
-- This script uses the lavfi cropdetect filter to automatically |
||||||
|
-- insert a crop filter with appropriate parameters for the currently |
||||||
|
-- playing video. |
||||||
|
-- |
||||||
|
-- It registers the key-binding "C" (shift+c), which when pressed, |
||||||
|
-- inserts the filter vf=lavfi=cropdetect. After 1 second, it then |
||||||
|
-- inserts the filter vf=crop=w:h:x:y, where w,h,x,y are determined |
||||||
|
-- from the vf-metadata gathered by cropdetect. The cropdetect filter |
||||||
|
-- is removed immediately after the crop filter is inserted as it is |
||||||
|
-- no longer needed. |
||||||
|
-- |
||||||
|
-- If the "C" key is pressed again, the crop filter is removed |
||||||
|
-- restoring playback to its original state. |
||||||
|
-- |
||||||
|
-- Since the crop parameters are determined from the 1 second of video |
||||||
|
-- between inserting the cropdetect and crop filters, the "C" key |
||||||
|
-- should be pressed at a position in the video where the crop region |
||||||
|
-- is unambiguous (i.e., not a black frame, black background title |
||||||
|
-- card, or dark scene). |
||||||
|
-- |
||||||
|
-- The default delay between insertion of the cropdetect and |
||||||
|
-- crop filters may be overridden by adding |
||||||
|
-- |
||||||
|
-- --script-opts=autocrop.detect_seconds=<number of seconds> |
||||||
|
-- |
||||||
|
-- to mpv's arguments. This may be desirable to allow cropdetect more |
||||||
|
-- time to collect data. |
||||||
|
require "mp.msg" |
||||||
|
|
||||||
|
script_name = mp.get_script_name() |
||||||
|
cropdetect_label = string.format("%s-cropdetect", script_name) |
||||||
|
crop_label = string.format("%s-crop", script_name) |
||||||
|
|
||||||
|
-- number of seconds to gather cropdetect data |
||||||
|
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name))) |
||||||
|
if not detect_seconds then |
||||||
|
detect_seconds = 1 |
||||||
|
end |
||||||
|
|
||||||
|
function del_filter_if_present(label) |
||||||
|
-- necessary because mp.command('vf del @label:filter') raises an |
||||||
|
-- error if the filter doesn't exist |
||||||
|
local vfs = mp.get_property_native("vf") |
||||||
|
for i,vf in pairs(vfs) do |
||||||
|
if vf["label"] == label then |
||||||
|
table.remove(vfs, i) |
||||||
|
mp.set_property_native("vf", vfs) |
||||||
|
return true |
||||||
|
end |
||||||
|
end |
||||||
|
return false |
||||||
|
end |
||||||
|
|
||||||
|
function autocrop_start() |
||||||
|
-- exit if cropdetection is already in progress |
||||||
|
if timer then |
||||||
|
mp.msg.warn("already cropdetecting!") |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
-- if there's a crop filter, remove it and exit |
||||||
|
if del_filter_if_present(crop_label) then |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
-- insert the cropdetect filter |
||||||
|
ret=mp.command( |
||||||
|
string.format( |
||||||
|
'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"', |
||||||
|
cropdetect_label |
||||||
|
) |
||||||
|
) |
||||||
|
-- wait to gather data |
||||||
|
timer=mp.add_timeout(detect_seconds, do_crop) |
||||||
|
end |
||||||
|
|
||||||
|
function do_crop() |
||||||
|
-- get the metadata |
||||||
|
local cropdetect_metadata = mp.get_property_native( |
||||||
|
string.format("vf-metadata/%s", cropdetect_label) |
||||||
|
) |
||||||
|
-- use it to crop if its valid |
||||||
|
if cropdetect_metadata then |
||||||
|
if cropdetect_metadata["lavfi.cropdetect.w"] |
||||||
|
and cropdetect_metadata["lavfi.cropdetect.h"] |
||||||
|
and cropdetect_metadata["lavfi.cropdetect.x"] |
||||||
|
and cropdetect_metadata["lavfi.cropdetect.y"] |
||||||
|
then |
||||||
|
mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s", |
||||||
|
crop_label, |
||||||
|
cropdetect_metadata["lavfi.cropdetect.w"], |
||||||
|
cropdetect_metadata["lavfi.cropdetect.h"], |
||||||
|
cropdetect_metadata["lavfi.cropdetect.x"], |
||||||
|
cropdetect_metadata["lavfi.cropdetect.y"])) |
||||||
|
else |
||||||
|
mp.msg.error( |
||||||
|
"Got empty crop data. You might need to increase detect_seconds." |
||||||
|
) |
||||||
|
end |
||||||
|
else |
||||||
|
mp.msg.error( |
||||||
|
"No crop data. Was the cropdetect filter successfully inserted?" |
||||||
|
) |
||||||
|
mp.msg.error( |
||||||
|
"Does your version of ffmpeg/libav support AVFrame metadata?" |
||||||
|
) |
||||||
|
end |
||||||
|
-- remove the cropdetect filter |
||||||
|
del_filter_if_present(cropdetect_label) |
||||||
|
timer=nil |
||||||
|
end |
||||||
|
|
||||||
|
mp.add_key_binding("C", "auto_crop", autocrop_start) |
@ -0,0 +1,19 @@ |
|||||||
|
--makes mpv only stay on top while playing |
||||||
|
--please note that this won't do anything if ontop is not enabled before pausing |
||||||
|
|
||||||
|
local was_ontop = false |
||||||
|
|
||||||
|
mp.observe_property("pause", "bool", function(name, value) |
||||||
|
local ontop = mp.get_property_native("ontop") |
||||||
|
if value == true then |
||||||
|
if ontop == true then |
||||||
|
mp.set_property_native("ontop", false) |
||||||
|
was_ontop = true |
||||||
|
end |
||||||
|
elseif value == false then |
||||||
|
if was_ontop and (ontop == false) then |
||||||
|
mp.set_property_native("ontop", true) |
||||||
|
end |
||||||
|
was_ontop = false |
||||||
|
end |
||||||
|
end) |
@ -0,0 +1,45 @@ |
|||||||
|
-- playlist.lua |
||||||
|
-- |
||||||
|
-- Automatically adds files from the same directory |
||||||
|
-- to the playlist. |
||||||
|
|
||||||
|
local msg = require 'mp.msg' |
||||||
|
local utils = require 'mp.utils' |
||||||
|
|
||||||
|
local current_dir = nil |
||||||
|
|
||||||
|
table.indexOf = function(t, x) |
||||||
|
for k, v in pairs(t) do |
||||||
|
if x == v then return k end |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
function alphanumsort(t) |
||||||
|
local function padnum(d) return ("%012d"):format(d) end |
||||||
|
table.sort(t, function(a,b) |
||||||
|
return tostring(a):gsub("%d+",padnum) < |
||||||
|
tostring(b):gsub("%d+",padnum) |
||||||
|
end) |
||||||
|
return t |
||||||
|
end |
||||||
|
|
||||||
|
mp.register_event("file-loaded", function() |
||||||
|
local dir = utils.split_path(mp.get_property("path")) |
||||||
|
if dir ~= current_dir then |
||||||
|
local entries = utils.readdir(dir, "files") |
||||||
|
if entries ~= nil then |
||||||
|
entries = alphanumsort(entries) |
||||||
|
local index = table.indexOf(entries, mp.get_property("filename")) |
||||||
|
if index ~= nil then |
||||||
|
index = index - 1 |
||||||
|
current_dir = dir |
||||||
|
mp.commandv("playlist_clear") |
||||||
|
for k, v in pairs(entries) do |
||||||
|
mp.commandv("loadfile", utils.join_path(current_dir, v), "append") |
||||||
|
end |
||||||
|
mp.commandv("playlist_remove", "current") |
||||||
|
mp.set_property("playlist-pos", index) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end) |
@ -0,0 +1,278 @@ |
|||||||
|
-- Display some stats. |
||||||
|
-- |
||||||
|
-- You can invoke the script with "i" by default or create a different key |
||||||
|
-- binding in input.conf using "<yourkey> script_binding stats". |
||||||
|
-- |
||||||
|
-- The style is configurable through a config file named "lua-settings/stats.conf" |
||||||
|
-- located in your mpv directory. |
||||||
|
-- |
||||||
|
-- Please note: not every property is always available and therefore not always |
||||||
|
-- visible. |
||||||
|
|
||||||
|
local options = require 'mp.options' |
||||||
|
|
||||||
|
-- Options |
||||||
|
local o = { |
||||||
|
ass_formatting = true, |
||||||
|
duration = 3, |
||||||
|
debug = false, |
||||||
|
|
||||||
|
-- Text style |
||||||
|
font = "Source Sans Pro", |
||||||
|
font_size = 10, |
||||||
|
font_color = "FFFFFF", |
||||||
|
border_size = 1.0, |
||||||
|
border_color = "262626", |
||||||
|
shadow_x_offset = 0.0, |
||||||
|
shadow_y_offset = 0.0, |
||||||
|
shadow_color = "000000", |
||||||
|
alpha = "11", |
||||||
|
|
||||||
|
-- Custom header for ASS tags to style the text output. |
||||||
|
-- Specifying this will ignore the text style values above and just |
||||||
|
-- use this string instead. |
||||||
|
custom_header = "", |
||||||
|
|
||||||
|
-- Text formatting |
||||||
|
-- With ASS |
||||||
|
nl = "\\N", |
||||||
|
indent = "\\h\\h\\h\\h\\h", |
||||||
|
prefix_sep = "\\h\\h", |
||||||
|
b1 = "{\\b1}", |
||||||
|
b0 = "{\\b0}", |
||||||
|
-- Without ASS |
||||||
|
no_ass_nl = "\n", |
||||||
|
no_ass_indent = "\t", |
||||||
|
no_ass_prefix_sep = " ", |
||||||
|
no_ass_b1 = "\027[1m", |
||||||
|
no_ass_b0 = "\027[0m", |
||||||
|
} |
||||||
|
options.read_options(o) |
||||||
|
|
||||||
|
|
||||||
|
function main() |
||||||
|
local stats = { |
||||||
|
header = "", |
||||||
|
file = "", |
||||||
|
video = "", |
||||||
|
audio = "" |
||||||
|
} |
||||||
|
|
||||||
|
o.ass_formatting = o.ass_formatting and has_vo_window() |
||||||
|
if not o.ass_formatting then |
||||||
|
o.nl = o.no_ass_nl |
||||||
|
o.indent = o.no_ass_indent |
||||||
|
o.prefix_sep = o.no_ass_prefix_sep |
||||||
|
if not has_ansi() then |
||||||
|
o.b1 = "" |
||||||
|
o.b0 = "" |
||||||
|
else |
||||||
|
o.b1 = o.no_ass_b1 |
||||||
|
o.b0 = o.no_ass_b0 |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
add_header(stats) |
||||||
|
add_file(stats) |
||||||
|
add_video(stats) |
||||||
|
add_audio(stats) |
||||||
|
|
||||||
|
mp.osd_message(join_stats(stats), o.duration) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function add_file(s) |
||||||
|
local sec = "file" |
||||||
|
s[sec] = "" |
||||||
|
|
||||||
|
append_property(s, sec, "filename", {prefix="File:", nl="", indent=""}) |
||||||
|
append_property(s, sec, "metadata/title", {prefix="Title:"}) |
||||||
|
append_property(s, sec, "chapter", {prefix="Chapter:"}) |
||||||
|
if append_property(s, sec, "cache-used", {prefix="Cache:"}) then |
||||||
|
append_property(s, sec, "demuxer-cache-duration", |
||||||
|
{prefix="+", suffix=" sec", nl="", indent=o.prefix_sep, |
||||||
|
prefix_sep="", no_prefix_markup=true}) |
||||||
|
append_property(s, sec, "cache-speed", |
||||||
|
{prefix="", suffix="", nl="", indent=o.prefix_sep, |
||||||
|
prefix_sep="", no_prefix_markup=true}) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function add_video(s) |
||||||
|
local sec = "video" |
||||||
|
s[sec] = "" |
||||||
|
if not has_video() then |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
if append_property(s, sec, "video-codec", {prefix="Video:", nl="", indent=""}) then |
||||||
|
append_property(s, sec, "hwdec-active", |
||||||
|
{prefix="(hwdec)", nl="", indent=" ", |
||||||
|
no_prefix_markup=true, no_value=true}, |
||||||
|
{no=true}) |
||||||
|
end |
||||||
|
append_property(s, sec, "avsync", {prefix="A-V:"}) |
||||||
|
if append_property(s, sec, "drop-frame-count", {prefix="Dropped:"}) then |
||||||
|
append_property(s, sec, "vo-drop-frame-count", {prefix="VO:", nl=""}) |
||||||
|
append_property(s, sec, "mistimed-frame-count", {prefix="Mistimed:", nl=""}) |
||||||
|
append_property(s, sec, "vo-delayed-frame-count", {prefix="Delayed:", nl=""}) |
||||||
|
end |
||||||
|
if append_property(s, sec, "display-fps", {prefix="Display FPS:", suffix=" (specified)"}) then |
||||||
|
append_property(s, sec, "estimated-display-fps", |
||||||
|
{suffix=" (estimated)", nl="", indent=""}) |
||||||
|
else |
||||||
|
append_property(s, sec, "estimated-display-fps", |
||||||
|
{prefix="Display FPS:", suffix=" (estimated)"}) |
||||||
|
end |
||||||
|
if append_property(s, sec, "fps", {prefix="FPS:", suffix=" (specified)"}) then |
||||||
|
append_property(s, sec, "estimated-vf-fps", |
||||||
|
{suffix=" (estimated)", nl="", indent=""}) |
||||||
|
else |
||||||
|
append_property(s, sec, "estimated-vf-fps", |
||||||
|
{prefix="FPS:", suffix=" (estimated)"}) |
||||||
|
end |
||||||
|
if append_property(s, sec, "video-speed-correction", {prefix="DS:"}) then |
||||||
|
append_property(s, sec, "audio-speed-correction", |
||||||
|
{prefix="/", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true}) |
||||||
|
end |
||||||
|
if append_property(s, sec, "video-params/w", {prefix="Native Resolution:"}) then |
||||||
|
append_property(s, sec, "video-params/h", |
||||||
|
{prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true}) |
||||||
|
end |
||||||
|
append_property(s, sec, "window-scale", {prefix="Window Scale:"}) |
||||||
|
append_property(s, sec, "video-params/aspect", {prefix="Aspect Ratio:"}) |
||||||
|
append_property(s, sec, "video-params/pixelformat", {prefix="Pixel format:"}) |
||||||
|
append_property(s, sec, "video-params/colormatrix", {prefix="Colormatrix:"}) |
||||||
|
append_property(s, sec, "video-params/primaries", {prefix="Primaries:"}) |
||||||
|
append_property(s, sec, "video-params/gamma", {prefix="Gamma:"}) |
||||||
|
append_property(s, sec, "video-params/colorlevels", {prefix="Levels:"}) |
||||||
|
append_property(s, sec, "packet-video-bitrate", {prefix="Bitrate:", suffix=" kbps"}) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function add_audio(s) |
||||||
|
local sec = "audio" |
||||||
|
s[sec] = "" |
||||||
|
if not has_audio() then |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
append_property(s, sec, "audio-codec", {prefix="Audio:", nl="", indent=""}) |
||||||
|
append_property(s, sec, "audio-params/samplerate", {prefix="Sample Rate:", suffix=" Hz"}) |
||||||
|
append_property(s, sec, "audio-params/channel-count", {prefix="Channels:"}) |
||||||
|
append_property(s, sec, "packet-audio-bitrate", {prefix="Bitrate:", suffix=" kbps"}) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function add_header(s) |
||||||
|
if not o.ass_formatting then |
||||||
|
s.header = "" |
||||||
|
return |
||||||
|
end |
||||||
|
if o.custom_header and o.custom_header ~= "" then |
||||||
|
s.header = set_ASS(true) .. o.custom_header |
||||||
|
else |
||||||
|
s.header = string.format("%s{\\fs%d}{\\fn%s}{\\bord%f}{\\3c&H%s&}{\\1c&H%s&}" .. |
||||||
|
"{\\alpha&H%s&}{\\xshad%f}{\\yshad%f}{\\4c&H%s&}", |
||||||
|
set_ASS(true), o.font_size, o.font, o.border_size, |
||||||
|
o.border_color, o.font_color, o.alpha, o.shadow_x_offset, |
||||||
|
o.shadow_y_offset, o.shadow_color) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
-- Format and append a property. |
||||||
|
-- A property whose value is either `nil` or empty (hereafter called "invalid") |
||||||
|
-- is skipped and not appended. |
||||||
|
-- Returns `false` in case nothing was appended, otherwise `true`. |
||||||
|
-- |
||||||
|
-- s : Table containing key `sec`. |
||||||
|
-- sec : Existing key in table `s`, value treated as a string. |
||||||
|
-- property: The property to query and format (based on its OSD representation). |
||||||
|
-- attr : Optional table to overwrite certain (formatting) attributes for |
||||||
|
-- this property. |
||||||
|
-- exclude : Optional table containing keys which are considered invalid values |
||||||
|
-- for this property. Specifying this will replace empty string as |
||||||
|
-- default invalid value (nil is always invalid). |
||||||
|
function append_property(s, sec, prop, attr, excluded) |
||||||
|
excluded = excluded or {[""] = true} |
||||||
|
local ret = mp.get_property_osd(prop) |
||||||
|
if not ret or excluded[ret] then |
||||||
|
if o.debug then |
||||||
|
print("No value for property: " .. prop) |
||||||
|
end |
||||||
|
return false |
||||||
|
end |
||||||
|
|
||||||
|
attr.prefix_sep = attr.prefix_sep or o.prefix_sep |
||||||
|
attr.indent = attr.indent or o.indent |
||||||
|
attr.nl = attr.nl or o.nl |
||||||
|
attr.suffix = attr.suffix or "" |
||||||
|
attr.prefix = attr.prefix or "" |
||||||
|
attr.no_prefix_markup = attr.no_prefix_markup or false |
||||||
|
attr.prefix = attr.no_prefix_markup and attr.prefix or b(attr.prefix) |
||||||
|
ret = attr.no_value and "" or ret |
||||||
|
|
||||||
|
s[sec] = string.format("%s%s%s%s%s%s%s", s[sec], attr.nl, attr.indent, |
||||||
|
attr.prefix, attr.prefix_sep, no_ASS(ret), attr.suffix) |
||||||
|
return true |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function no_ASS(t) |
||||||
|
return set_ASS(false) .. t .. set_ASS(true) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function set_ASS(b) |
||||||
|
if not o.ass_formatting then |
||||||
|
return "" |
||||||
|
end |
||||||
|
return mp.get_property_osd("osd-ass-cc/" .. (b and "0" or "1")) |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function join_stats(s) |
||||||
|
r = s.header .. s.file |
||||||
|
|
||||||
|
if s.video and s.video ~= "" then |
||||||
|
r = r .. o.nl .. o.nl .. s.video |
||||||
|
end |
||||||
|
if s.audio and s.audio ~= "" then |
||||||
|
r = r .. o.nl .. o.nl .. s.audio |
||||||
|
end |
||||||
|
|
||||||
|
return r |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function has_vo_window() |
||||||
|
return mp.get_property("vo-configured") == "yes" |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function has_video() |
||||||
|
local r = mp.get_property("video") |
||||||
|
return r and r ~= "no" and r ~= "" |
||||||
|
end |
||||||
|
|
||||||
|
|
||||||
|
function has_audio() |
||||||
|
local r = mp.get_property("audio") |
||||||
|
return r and r ~= "no" and r ~= "" |
||||||
|
end |
||||||
|
|
||||||
|
function has_ansi() |
||||||
|
local is_windows = type(package) == 'table' and type(package.config) == 'string' and package.config:sub(1,1) == '\\' |
||||||
|
if is_windows then |
||||||
|
return os.getenv("ANSICON") |
||||||
|
end |
||||||
|
return true |
||||||
|
end |
||||||
|
|
||||||
|
function b(t) |
||||||
|
return o.b1 .. t .. o.b0 |
||||||
|
end |
||||||
|
|
||||||
|
mp.add_key_binding("i", mp.get_script_name(), main, {repeatable=true}) |
@ -0,0 +1,34 @@ |
|||||||
|
--sets the startime of a youtube video as specified in the "t=HHhMMmSSs" part of the url |
||||||
|
--NOTE: This might become obsolete once youtube-dl adds the functionality |
||||||
|
|
||||||
|
local msg = require 'mp.msg' |
||||||
|
|
||||||
|
function youtube_starttime() |
||||||
|
url = mp.get_property("path", "") |
||||||
|
start = 0 |
||||||
|
|
||||||
|
if string.find(url, "youtu%.?be") and |
||||||
|
((url:find("http://") == 1) or (url:find("https://") == 1)) then |
||||||
|
time = string.match(url, "[#&%?]t=%d*h?%d*m?%d+s?m?h?") |
||||||
|
--the time-string can start with #, & or ? followed by t= and the timing parameters |
||||||
|
--at least one number needs to be present after t=, followed by h, m, s or nothing (>implies s) |
||||||
|
|
||||||
|
if time then |
||||||
|
for pos in string.gmatch(time,"%d+%a?") do |
||||||
|
if string.match(pos,"%d+h") then --find out multiplier for |
||||||
|
multiplier = 60*60 --hours |
||||||
|
elseif string.match(pos,"%d+m") then |
||||||
|
multiplier = 60 --minutes |
||||||
|
else multiplier = 1 end --seconds |
||||||
|
|
||||||
|
start = start + (string.match(pos,"%d+") * multiplier) |
||||||
|
end |
||||||
|
|
||||||
|
msg.info("parsed '" .. time .. "' into '" .. start .. "' seconds") |
||||||
|
end |
||||||
|
|
||||||
|
mp.set_property("file-local-options/start",start) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
mp.add_hook("on_load", 50, youtube_starttime) |
@ -0,0 +1,20 @@ |
|||||||
|
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" |
||||||
|
|
||||||
|
local usr_host="%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}" |
||||||
|
local directory="%{$fg[green]%}%~%{$reset_color%}" |
||||||
|
local arrow="%(?::%{$fg[red]%})➤%{$reset_color%}" |
||||||
|
|
||||||
|
PROMPT='╭─${usr_host} ${directory} $(git_prompt_info) |
||||||
|
╰─${arrow} ' |
||||||
|
RPROMPT='%t' |
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$reset_color%}%{$fg_bold[red]%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[blue]%})%{$reset_color%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}✗" |
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color" |
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_AHEAD=" ↑" |
||||||
|
ZSH_THEME_GIT_PROMPT_BEHIND=" ↓" |
||||||
|
ZSH_THEME_GIT_PROMPT_STASHED=" ●" |
||||||
|
ZSH_THEME_GIT_PROMPT_UNMERGED="🖕🏻 " |
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$fg[yellow]%}⭑" |
Loading…
Reference in new issue