Add multimedia/mpv configuration files - dotfiles - leot's dotfiles
 (HTM) hg clone https://bitbucket.org/iamleot/dotfiles
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) changeset c2dad3b50d75608a07280de0db04aad9bb73b711
 (DIR) parent 3e20a27cdd799f56ea0e7833da8da0ed2f94c952
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Mon, 24 Sep 2018 14:35:21 
       
       Add multimedia/mpv configuration files
       
       Diffstat:
        config/mpv/input.conf          |  17 +++++++++++++++++
        config/mpv/mpv.conf            |  13 +++++++++++++
        config/mpv/scripts/autosub.lua |  23 +++++++++++++++++++++++
        3 files changed, 53 insertions(+), 0 deletions(-)
       ---
       diff -r 3e20a27cdd79 -r c2dad3b50d75 config/mpv/input.conf
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/config/mpv/input.conf     Mon Sep 24 14:35:21 2018 +0200
       @@ -0,0 +1,17 @@
       +a      ab-loop
       +h      playlist-prev
       +l      playlist-next
       +L      cycle-values loop-playlist "inf" "no"
       +k      seek 5
       +K      seek 60
       +j      seek -5
       +J      seek -60
       +p      add chapter -1
       +n      add chapter +1
       +Ctrl+j no-osd sub-seek -1
       +Ctrl+k no-osd sub-seek 1
       +Alt+k  add sub-pos -1
       +Alt+j  add sub-pos +1
       +Alt+l  cycle-values loop-file "inf" "no"
       +s      cycle sub
       +S      cycle sub down
       diff -r 3e20a27cdd79 -r c2dad3b50d75 config/mpv/mpv.conf
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/config/mpv/mpv.conf       Mon Sep 24 14:35:21 2018 +0200
       @@ -0,0 +1,13 @@
       +audio-display=no
       +cache-default=24000
       +image-display-duration=inf
       +no-msg-color
       +vo=xv,x11
       +ao=oss
       +term-playing-msg='${?media-title:${media-title}}${!media-title:No file}'
       +ytdl-format='bestvideo[height<=?720]+bestaudio/best[height<=?720]'
       +script-opts=osc-layout=box
       +write-filename-in-watch-later-config=yes
       +
       +[pseudo-gui]
       +audio-display=attachment
       diff -r 3e20a27cdd79 -r c2dad3b50d75 config/mpv/scripts/autosub.lua
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/config/mpv/scripts/autosub.lua    Mon Sep 24 14:35:21 2018 +0200
       @@ -0,0 +1,23 @@
       +-- requires subliminal, version 1.0 or newer
       +-- default keybinding: b
       +-- add the following to your input.conf to change the default keybinding:
       +-- keyname script_binding auto_load_subs
       +local utils = require 'mp.utils'
       +function load_sub_fn()
       +    subl = "/usr/pkg/bin/subliminal-2.7" -- use 'which subliminal' to find the path
       +    mp.msg.info("Searching subtitle")
       +    mp.osd_message("Searching subtitle")
       +    t = {}
       +    t.args = {subl, "download", "-s", "-l", "en", mp.get_property("path")}
       +    res = utils.subprocess(t)
       +    if res.status == 0 then
       +        mp.commandv("rescan_external_files", "reselect") 
       +        mp.msg.info("Subtitle download succeeded")
       +        mp.osd_message("Subtitle download succeeded")
       +    else
       +        mp.msg.warn("Subtitle download failed")
       +        mp.osd_message("Subtitle download failed")
       +    end
       +end
       +
       +mp.add_key_binding("b", "auto_load_subs", load_sub_fn)