[Android] Set local subtitles directory

Geoffrey Métais git at videolan.org
Fri May 20 16:30:58 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 20 16:29:29 2016 +0200| [dcd5cad85dc0dc8f5ebade96677d1796c2963e03] | committer: Geoffrey Métais

Set local subtitles directory

> https://code.videolan.org/videolan/vlc-android/commit/dcd5cad85dc0dc8f5ebade96677d1796c2963e03
---

 vlc-android/src/org/videolan/vlc/util/FileUtils.java  | 1 +
 vlc-android/src/org/videolan/vlc/util/VLCOptions.java | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index e2a1df3..6692383 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -52,6 +52,7 @@ import java.nio.channels.FileChannel;
 
 public class FileUtils {
 
+    public static final File SUBTITLES_DIRECTORY = new File(VLCApplication.getAppContext().getExternalFilesDir(null), "subs");
     /**
      * Size of the chunks that will be hashed in bytes (64 KB)
      */
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index af48542..75ac5ae 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -28,12 +28,12 @@ import android.util.Log;
 
 import org.videolan.libvlc.Media;
 import org.videolan.libvlc.MediaPlayer;
-import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.libvlc.util.HWDecoderUtil;
-import org.videolan.vlc.media.MediaWrapper;
+import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.media.MediaWrapper;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -107,6 +107,11 @@ public class VLCOptions {
 
         options.add(verboseMode ? "-vvv" : "-vv");
 
+        //Subs directory
+        FileUtils.SUBTITLES_DIRECTORY.mkdirs();
+        options.add("--sub-autodetect-path");
+        options.add("./Subtitles, ./subtitles, ./Subs, ./subs, "+FileUtils.SUBTITLES_DIRECTORY.getPath());
+
         return options;
     }
 



More information about the Android mailing list