[Android] Update subtitles database when needed

Geoffrey Métais git at videolan.org
Tue May 24 15:40:07 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 24 15:07:31 2016 +0200| [3bb0df435778893cd3ef55d65f2da4a1ff03d50f] | committer: Geoffrey Métais

Update subtitles database when needed

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

 vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java b/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
index addf1c8..48c5c59 100644
--- a/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
+++ b/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
@@ -46,6 +46,7 @@ import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.helpers.UiTools;
+import org.videolan.vlc.media.MediaDatabase;
 import org.videolan.vlc.media.MediaWrapper;
 
 import java.io.File;
@@ -321,7 +322,8 @@ public class SubtitlesDownloader {
             while ((length = gzIS.read(buffer)) != -1) {
                 f.write(buffer, 0, length);
             }
-            // TODO Update the media database
+            if (!canWrite)
+                MediaDatabase.getInstance().saveSubtitle(srtURl, path);
         } catch (IOException e) {
             if (BuildConfig.DEBUG) Log.e(TAG, "download fail", e);
         } catch (Throwable e) { //for various service outages



More information about the Android mailing list