OpenSubtitles: fix some crash due to incorrect casting

This commit is contained in:
Nicolas Pomepuy 2024-11-05 09:30:58 +01:00 committed by Duncan McNamara
parent 8e01b6314f
commit 4412753cb3
3 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ data class Attributes(
@field:Json(name = "new_download_count")
val newDownloadCount: Int?,
@field:Json(name = "ratings")
val ratings: Int = 0,
val ratings: Float = 0F,
@field:Json(name = "related_links")
val relatedLinks: List<RelatedLink?>?,
@field:Json(name = "release")
@ -93,7 +93,7 @@ data class FeatureDetails(
@field:Json(name = "imdb_id")
val imdbId: Int?,
@field:Json(name = "movie_name")
val movieName: String?,
val movieName: String,
@field:Json(name = "parent_feature_id")
val parentFeatureId: Int?,
@field:Json(name = "parent_imdb_id")

View File

@ -12,7 +12,7 @@ data class SubtitleItem(
val state: State,
var zipDownloadLink: String,
val hearingImpaired: Boolean,
val rating: Int,
val rating: Float,
val downloadNumber: Long,
var fileName: String = ""
) {

View File

@ -98,7 +98,7 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, pr
private val apiResultLiveData: MutableLiveData<List<Data>> = MutableLiveData()
private val downloadedLiveData = ExternalSubRepository.getInstance(context).getDownloadedSubtitles(mediaUri).map { list ->
list.map { SubtitleItem(it.idSubtitle, -1, mediaUri, it.subLanguageID, it.movieReleaseName, State.Downloaded, "", it.hearingImpaired, 0, 0) }
list.map { SubtitleItem(it.idSubtitle, -1, mediaUri, it.subLanguageID, it.movieReleaseName, State.Downloaded, "", it.hearingImpaired, 0F, 0) }
}
private val downloadingLiveData = ExternalSubRepository.getInstance(context).downloadingSubtitles
@ -164,7 +164,7 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, pr
openSubtitle.attributes.files.first().fileId,
mediaUri,
openSubtitle.attributes.language,
openSubtitle.attributes.featureDetails.title,
openSubtitle.attributes.featureDetails.movieName,
state,
"",
openSubtitle.attributes.hearingImpaired,