Skip to content

Instantly share code, notes, and snippets.

@selsta
Last active October 8, 2023 11:28
Show Gist options
  • Save selsta/ce3fb37e775dbd15c698 to your computer and use it in GitHub Desktop.
Save selsta/ce3fb37e775dbd15c698 to your computer and use it in GitHub Desktop.

Revisions

  1. selsta revised this gist Jul 31, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions autosub.lua
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    -- 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
  2. selsta revised this gist Jul 31, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion autosub.lua
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ function load_sub_fn()
    mp.msg.info("Searching subtitle")
    mp.osd_message("Searching subtitle")
    t = {}
    t.args = {subl, "-q", "-s", "-l", "en", "--", mp.get_property("path")}
    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")
  3. selsta revised this gist Mar 19, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions autosub.lua
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    -- default keybinding: b
    -- add this to your input.conf to change the key to download the subtitles
    -- 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/local/bin/subliminal" -- use 'which subliminal' to find the path
    mp.msg.info("Searching subtitle")
    mp.osd_message("Subtitle download succeeded")
    mp.osd_message("Searching subtitle")
    t = {}
    t.args = {subl, "-q", "-s", "-l", "en", "--", mp.get_property("path")}
    res = utils.subprocess(t)
  4. selsta revised this gist Mar 1, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions autosub.lua
    Original file line number Diff line number Diff line change
    @@ -5,14 +5,17 @@ local utils = require 'mp.utils'
    function load_sub_fn()
    subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path
    mp.msg.info("Searching subtitle")
    mp.osd_message("Subtitle download succeeded")
    t = {}
    t.args = {subl, "-q", "-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

  5. selsta revised this gist Feb 26, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion autosub.lua
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,9 @@
    -- default keybinding: b
    -- add this to your input.conf to change the key to download the subtitles
    -- keyname script_binding auto_load_subs
    local utils = require 'mp.utils'
    function load_sub_fn()
    subl = "/usr/local/bin/subliminal" --use 'which subliminal' to find the path
    subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path
    mp.msg.info("Searching subtitle")
    t = {}
    t.args = {subl, "-q", "-s", "-l", "en", "--", mp.get_property("path")}
  6. selsta created this gist Feb 26, 2015.
    18 changes: 18 additions & 0 deletions autosub.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    -- add this to your input.conf to change the key to download the subtitles
    -- keyname script_binding auto_load_subs
    local utils = require 'mp.utils'
    function load_sub_fn()
    subl = "/usr/local/bin/subliminal" --use 'which subliminal' to find the path
    mp.msg.info("Searching subtitle")
    t = {}
    t.args = {subl, "-q", "-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")
    else
    mp.msg.warn("Subtitle download failed")
    end
    end

    mp.add_key_binding("b", "auto_load_subs", load_sub_fn)