Skip to content

Commit 5898eb2

Browse files
authored
Enable deprecations in SubtitleHelper (#2036)
1 parent 4270f15 commit 5898eb2

File tree

2 files changed

+21
-14
lines changed
  • app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers
  • library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils

2 files changed

+21
-14
lines changed

app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/SubSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SubSourceApi : SubtitleAPI() {
2929

3030
//Only supports Imdb Id search for now
3131
if (query.imdbId == null) return null
32-
val queryLang = SubtitleHelper.fromTwoLettersToLanguage(query.lang!!)
32+
val queryLang = SubtitleHelper.fromTagToEnglishLanguageName(query.lang)
3333
val type = if ((query.seasonNumber ?: 0) > 0) TvType.TvSeries else TvType.Movie
3434

3535
val searchRes = app.post(

library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/SubtitleHelper.kt

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ object SubtitleHelper {
103103
return langMetadata
104104
}
105105

106-
// @Deprecated(
107-
// "Default language code changed to IETF BCP 47 tag",
108-
// replaceWith = ReplaceWith("fromLanguageToTagIETF(input, looseCheck)"))
106+
@Deprecated(
107+
"Default language code changed to IETF BCP 47 tag",
108+
replaceWith = ReplaceWith("fromLanguageToTagIETF(input, looseCheck)"),
109+
level = DeprecationLevel.WARNING
110+
)
109111
/**
110112
* Language name (english or native) -> ISO_639_1
111113
* @param input language name
@@ -115,10 +117,11 @@ object SubtitleHelper {
115117
return getLanguageDataFromName(input, looseCheck)?.ISO_639_1
116118
}
117119

118-
119-
// @Deprecated(
120-
// "Default language code changed to IETF BCP 47 tag",
121-
// replaceWith = ReplaceWith("fromLanguageToTagIETF(input)"))
120+
@Deprecated(
121+
"Default language code changed to IETF BCP 47 tag",
122+
replaceWith = ReplaceWith("fromLanguageToTagIETF(input)"),
123+
level = DeprecationLevel.WARNING
124+
)
122125
/**
123126
* Language name (english or native) -> ISO_639_3
124127
*/
@@ -154,19 +157,23 @@ object SubtitleHelper {
154157
return languages.getOrNull(index)
155158
}
156159

157-
// @Deprecated(
158-
// "Default language code changed to IETF BCP 47 tag",
159-
// replaceWith = ReplaceWith("fromTagToLanguageName(input)"))
160+
@Deprecated(
161+
"Default language code changed to IETF BCP 47 tag",
162+
replaceWith = ReplaceWith("fromTagToEnglishLanguageName(input)"),
163+
level = DeprecationLevel.WARNING
164+
)
160165
/**
161166
* Language code -> language english name
162167
*/
163168
fun fromTwoLettersToLanguage(input: String): String? {
164169
return getLanguageDataFromCode(input)?.languageName
165170
}
166171

167-
// @Deprecated(
168-
// "Default language code changed to IETF BCP 47 tag",
169-
// replaceWith = ReplaceWith("fromTagToLanguageName(input)"))
172+
@Deprecated(
173+
"Default language code changed to IETF BCP 47 tag",
174+
replaceWith = ReplaceWith("fromTagToEnglishLanguageName(input)"),
175+
level = DeprecationLevel.WARNING
176+
)
170177
/**
171178
* Language code -> language english name
172179
*/

0 commit comments

Comments
 (0)