[Android] WatchNext: fix removal after finish

Duncan McNamara git at videolan.org
Mon Sep 27 06:03:24 UTC 2021


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Sep  9 16:47:07 2021 +0200| [1857e4ae61ef11979a5256349c3f24f1d3d5ec48] | committer: Nicolas Pomepuy

WatchNext: fix removal after finish

Finished medias would stay on in the watch next channel, now passed 95%
they will be removed.

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

 application/vlc-android/src/org/videolan/vlc/util/TvChannels.kt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/util/TvChannels.kt b/application/vlc-android/src/org/videolan/vlc/util/TvChannels.kt
index a88801843..329ca21f6 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/TvChannels.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/TvChannels.kt
@@ -106,8 +106,10 @@ suspend fun setResumeProgram(context: Context, mw: MediaWrapper) {
             while (it.moveToNext()) {
                 if (!it.isNull(1) && mw.id.toString() == cursor.getString(1)) {
                     // Found a row that contains the matching ID
+                    isProgramPresent = true
                     val watchNextProgramId = cursor.getLong(0)
-                    if (it.getInt(2) == 0 || mw.time == 0L) { //Row removed by user or progress null
+                    if (it.getInt(2) == 0 || mw.time == 0L ||
+                        (mw.time != 0L && mw.length.toDouble() / mw.time.toDouble() > 0.95)) { //Row removed by user or progress null
                         if (deleteWatchNext(context, watchNextProgramId) < 1) {
                             Log.e(TAG, "Delete program failed")
                             return
@@ -115,7 +117,6 @@ suspend fun setResumeProgram(context: Context, mw: MediaWrapper) {
                     } else { // Update the program
                         val existingProgram = WatchNextProgram.fromCursor(cursor)
                         updateWatchNext(context, existingProgram, mw.time, watchNextProgramId)
-                        isProgramPresent = true
                     }
                     break
                 }



More information about the Android mailing list