[vlc-devel] [PATCH] vlsub: Add language to subtitle name

Galileo Sartor galileo.sartor at gmail.com
Mon Oct 8 17:26:32 CEST 2018


---
 share/lua/extensions/VLSub.lua | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index ee9e5f84a9..4d1d0ccdc5 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -1486,6 +1486,7 @@ function download_subtitles()
     subfileName = subfileName.."."..item.SubLanguageID
   end
 
+  local filenameWithoutExtension = subfileName
   subfileName = subfileName.."."..item.SubFormat
   local tmp_dir = vlc.config.cachedir()
   local file_target_access = true
@@ -1512,14 +1513,13 @@ function download_subtitles()
 
   -- Determine if the path to the video file is accessible for writing
 
-  local target
-  if openSub.file.dir then
-    target = openSub.file.dir..subfileName
-  end
+  local fln_pathToFile = openSub.file.dir
+  local target = fln_pathToFile..subfileName
 
   if not target or not file_touch(target) then
     if openSub.conf.dirPath then
-      target =  openSub.conf.dirPath..slash..subfileName
+      fln_pathToFile = openSub.conf.dirPath..slash
+      target =  fln_pathToFile..subfileName
       message = "<br>"..
         warn_tag(lang["mess_save_warn"].."  "..
         "<a href='"..vlc.strings.make_uri(
@@ -1533,6 +1533,7 @@ function download_subtitles()
     end
   end
 
+  target = fln_pathToFile..filenameWithoutExtension.."."..openSub.movie.sublanguageid.."."..item.SubFormat
   vlc.msg.dbg("[VLsub] Subtitles files: "..target)
 
   -- Unzipped data into file target
-- 
2.17.1



More information about the vlc-devel mailing list