[Android] OpenSubtitles: cleanup some useless parameters
Nicolas Pomepuy
git at videolan.org
Thu Nov 21 13:19:11 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Nov 5 07:29:04 2024 +0100| [8e01b6314fc91d3ed7ea82a166098a231680af13] | committer: Duncan McNamara
OpenSubtitles: cleanup some useless parameters
> https://code.videolan.org/videolan/vlc-android/commit/8e01b6314fc91d3ed7ea82a166098a231680af13
---
.../org/videolan/resources/opensubtitles/OpenSubtitleRepository.kt | 1 -
.../vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt | 7 +++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/application/resources/src/main/java/org/videolan/resources/opensubtitles/OpenSubtitleRepository.kt b/application/resources/src/main/java/org/videolan/resources/opensubtitles/OpenSubtitleRepository.kt
index 3ef9cec7e9..3ade240b29 100644
--- a/application/resources/src/main/java/org/videolan/resources/opensubtitles/OpenSubtitleRepository.kt
+++ b/application/resources/src/main/java/org/videolan/resources/opensubtitles/OpenSubtitleRepository.kt
@@ -13,7 +13,6 @@ class OpenSubtitleRepository(private val openSubtitleService: IOpenSubtitleServi
suspend fun queryWithHash(
- movieByteSize: Long,
movieHash: String?,
languageIds: List<String>?,
hearingImpaired: Boolean
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
index 5e32c62d77..ef1bc6f127 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
@@ -189,11 +189,11 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, pr
return OpenSubtitleRepository.getInstance().queryWithName(name, episode, season, languageIds, hearingImpaired)
}
- private suspend fun getSubtitleByHash(movieByteSize: Long, movieHash: String?, languageIds: List<String>?, hearingImpaired: Boolean): OpenSubV1 {
+ private suspend fun getSubtitleByHash(movieHash: String?, languageIds: List<String>?, hearingImpaired: Boolean): OpenSubV1 {
if (BuildConfig.DEBUG) Log.d(this::class.java.simpleName, "Getting subs by hash with $movieHash")
manualSearchEnabled.set(false)
observableResultDescription.set(context.getString(R.string.sub_result_by_file).toSpanned())
- return OpenSubtitleRepository.getInstance().queryWithHash(movieByteSize, movieHash, languageIds, hearingImpaired)
+ return OpenSubtitleRepository.getInstance().queryWithHash(movieHash, languageIds, hearingImpaired)
}
fun onRefresh() {
@@ -219,8 +219,7 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, pr
val videoFile = File(mediaUri.path)
if (videoFile.exists()) {
val hash = FileUtils.computeHash(videoFile)
- val fileLength = videoFile.length()
- val hashSubs = getSubtitleByHash(fileLength, hash, observableSearchLanguage.get(), observableSearchHearingImpaired.get() ?: false).data
+ val hashSubs = getSubtitleByHash(hash, observableSearchLanguage.get(), observableSearchHearingImpaired.get() ?: false).data
// No result for hash. Falling back to name search
if (hashSubs.isEmpty()) getSubtitleByName(videoFile.name, null, null, observableSearchLanguage.get(), observableSearchHearingImpaired.get() ?: false).data else hashSubs
} else {
More information about the Android
mailing list