Ubuntu – Saving subtitles found by the VLC extension “Subtitle Finder”

pluginsscriptssubtitlevideovlc

I found a VLC script called 'Subtitle finder' (here) that downloads and displays video subtitles 'on-the-fly': they are downloaded and displayed during playback, and it works great, but does not saves subtitle file for the future: the whole procedure has to be restarted each time. (See this answer.)

enter image description here

enter image description here

enter image description here

While the script says ‘Download subtitles’, I imagine they are downloaded and saved temporarily during playback: where are they downloaded? can I manually save them for future use?

Maybe someone could find the answer by taking a look at the script.

Best Answer

It looks like it stays in memory to me. A similar plugin that just downloads the subtitles file from opensubtitles is probably going to be your answer by using some of that code and modifying around line:

--vlc.msg.dbg("[Subtitles] File found in the archive: " .. srturl .. extension)  

The one line edit below is BAD, but gets it not broken for unix-like OS-es only. For the script to be cross platform it needs OS detection logic:

if(item ~= nil) then
  local name = item:uri()
  vlc.msg.info("NAME: "..name)
  name = vlc.strings.decode_uri(string.gsub(name, "file:///", ""))      
  name = "/"..name
  vlc.msg.info(""..name.."."..language.."."..extension)
  vlc.msg.info("[Subtitle-download] saving subtitle to: "..name.."."..language.."."..extension)
  local fsout = assert(io.open(name.."."..language.."."..extension, "w"))
  fsout:write(dataBuffer)
  assert(fsout:close())
end

If someone running Windows VLC is interested in testing a patch that gets saving working on both Linux and Windows, check this pull request.

Evidently someone has tacked on some enhancements including the patch here.


This version here works in Linux (as well as in Windows) to save subtitles.