-
-
Save fullmetalsheep/28c397b200a7348027d983f31a7eddfa to your computer and use it in GitHub Desktop.
Revisions
-
fullmetalsheep revised this gist
Oct 15, 2018 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,13 @@ -- default keybinding: b local utils = require 'mp.utils' --sleep function, so that subs aren't downloaded the instant a file is loaded --taken from:http://lua-users.org/wiki/SleepFunction function sleep(s) local ntime = os.time() + s repeat until os.time() > ntime end --original function, pressing b will trigger this and download the subtitle manually function load_sub_fn() subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path @@ -23,6 +30,7 @@ end --added function, auto search for subs and download if not present, the way god intended :P function autosubs() sleep(10) subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path mp.msg.info("Searching subtitle") mp.osd_message("Searching subtitle") -
fullmetalsheep revised this gist
Aug 21, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function load_sub_fn() mp.osd_message("Searching subtitle") t = {} t.args = {subl, "download", "-s", "-f", "-l", "en", mp.get_property("path")} res = utils.subprocess(t) if res.status == 0 then mp.commandv("rescan_external_files", "reselect") -
fullmetalsheep renamed this gist
Nov 24, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
fullmetalsheep revised this gist
Nov 24, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function load_sub_fn() end end --added function, auto search for subs and download if not present, the way god intended :P function autosubs() subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path mp.msg.info("Searching subtitle") -
fullmetalsheep revised this gist
Nov 24, 2016 . 1 changed file with 23 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,32 @@ -- requires subliminal, version 1.0 or newer -- default keybinding: b local utils = require 'mp.utils' --original function, pressing b will trigger this and download the subtitle manually function load_sub_fn() subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path mp.msg.info("Searching subtitle") mp.osd_message("Searching subtitle") t = {} t.args = {subl, "download", "-f", "-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 --added function, auto search for subs and download if not present, the way god inteded :P function autosubs() subl = "/usr/local/bin/subliminal" -- 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 @@ -20,4 +39,5 @@ function load_sub_fn() end end mp.add_key_binding("b", "auto_load_subs", load_sub_fn) mp.register_event("file-loaded", autosubs) -
selsta revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 -
selsta revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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, "download", "-s", "-l", "en", mp.get_property("path")} res = utils.subprocess(t) if res.status == 0 then mp.commandv("rescan_external_files", "reselect") -
selsta revised this gist
Mar 19, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ -- 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/local/bin/subliminal" -- use 'which subliminal' to find the path mp.msg.info("Searching subtitle") mp.osd_message("Searching subtitle") t = {} t.args = {subl, "-q", "-s", "-l", "en", "--", mp.get_property("path")} res = utils.subprocess(t) -
selsta revised this gist
Mar 1, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 -
selsta revised this gist
Feb 26, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 mp.msg.info("Searching subtitle") t = {} t.args = {subl, "-q", "-s", "-l", "en", "--", mp.get_property("path")} -
selsta created this gist
Feb 26, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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)