fix a crash when url or vcodes are missing for a stream
always initialize them, also initialize hardsub_locale since it might be optional too
This commit is contained in:
parent
4c55bb771f
commit
97966f5ad3
|
@ -331,7 +331,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(searchEndpoint, parameters)
|
requestGet(searchEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in search(), with query = \"$query\".", ex)
|
Log.e(TAG, "SerializationException in search(), with query = \"$query\".", ex)
|
||||||
NoneSearchResult
|
NoneSearchResult
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(episodesEndpoint, parameters)
|
requestGet(episodesEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in objects().", ex)
|
Log.e(TAG, "SerializationException in objects().", ex)
|
||||||
NoneCollection
|
NoneCollection
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(seasonListEndpoint, parameters)
|
requestGet(seasonListEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in seasonList().", ex)
|
Log.e(TAG, "SerializationException in seasonList().", ex)
|
||||||
NoneDiscSeasonList
|
NoneDiscSeasonList
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(seriesEndpoint, parameters)
|
requestGet(seriesEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in series().", ex)
|
Log.e(TAG, "SerializationException in series().", ex)
|
||||||
NoneSeries
|
NoneSeries
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(upNextSeriesEndpoint, parameters)
|
requestGet(upNextSeriesEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in upNextSeries().", ex)
|
Log.e(TAG, "SerializationException in upNextSeries().", ex)
|
||||||
NoneUpNextSeriesItem
|
NoneUpNextSeriesItem
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(seasonsEndpoint, parameters)
|
requestGet(seasonsEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in seasons().", ex)
|
Log.e(TAG, "SerializationException in seasons().", ex)
|
||||||
NoneSeasons
|
NoneSeasons
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(episodesEndpoint, parameters)
|
requestGet(episodesEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in episodes().", ex)
|
Log.e(TAG, "SerializationException in episodes().", ex)
|
||||||
NoneEpisodes
|
NoneEpisodes
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ object Crunchyroll {
|
||||||
suspend fun playback(url: String): Playback {
|
suspend fun playback(url: String): Playback {
|
||||||
return try {
|
return try {
|
||||||
requestGet("", url = url)
|
requestGet("", url = url)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in playback(), with url = $url.", ex)
|
Log.e(TAG, "SerializationException in playback(), with url = $url.", ex)
|
||||||
NonePlayback
|
NonePlayback
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ object Crunchyroll {
|
||||||
return try {
|
return try {
|
||||||
(requestGet(watchlistSeriesEndpoint, parameters) as JsonObject)
|
(requestGet(watchlistSeriesEndpoint, parameters) as JsonObject)
|
||||||
.containsKey(seriesId)
|
.containsKey(seriesId)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in isWatchlist() with seriesId = $seriesId", ex)
|
Log.e(TAG, "SerializationException in isWatchlist() with seriesId = $seriesId", ex)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(similarToEndpoint, parameters)
|
requestGet(similarToEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in similarTo().", ex)
|
Log.e(TAG, "SerializationException in similarTo().", ex)
|
||||||
NoneSimilarToResult
|
NoneSimilarToResult
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
val list: ContinueWatchingList = try {
|
val list: ContinueWatchingList = try {
|
||||||
requestGet(watchlistEndpoint, parameters)
|
requestGet(watchlistEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in watchlist().", ex)
|
Log.e(TAG, "SerializationException in watchlist().", ex)
|
||||||
NoneContinueWatchingList
|
NoneContinueWatchingList
|
||||||
}
|
}
|
||||||
|
@ -647,7 +647,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(watchlistEndpoint, parameters)
|
requestGet(watchlistEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in upNextAccount().", ex)
|
Log.e(TAG, "SerializationException in upNextAccount().", ex)
|
||||||
NoneContinueWatchingList
|
NoneContinueWatchingList
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(recommendationsEndpoint, parameters)
|
requestGet(recommendationsEndpoint, parameters)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in recommendations().", ex)
|
Log.e(TAG, "SerializationException in recommendations().", ex)
|
||||||
NoneRecommendationsList
|
NoneRecommendationsList
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ object Crunchyroll {
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
requestGet(profileEndpoint)
|
requestGet(profileEndpoint)
|
||||||
}catch (ex: SerializationException) {
|
} catch (ex: SerializationException) {
|
||||||
Log.e(TAG, "SerializationException in profile().", ex)
|
Log.e(TAG, "SerializationException in profile().", ex)
|
||||||
NoneProfile
|
NoneProfile
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,9 +380,9 @@ data class Streams(
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Stream(
|
data class Stream(
|
||||||
@SerialName("hardsub_locale") val hardsubLocale: String,
|
@SerialName("hardsub_locale") val hardsubLocale: String = "", // default/nullable value since might be optional
|
||||||
@SerialName("url") val url: String,
|
@SerialName("url") val url: String = "", // default/nullable value since optional
|
||||||
@SerialName("vcodec") val vcodec: String,
|
@SerialName("vcodec") val vcodec: String = "", // default/nullable value since optional
|
||||||
)
|
)
|
||||||
|
|
||||||
val NonePlayback = Playback(
|
val NonePlayback = Playback(
|
||||||
|
|
Loading…
Reference in New Issue