feat: support for video visibility and license

This commit is contained in:
Bnyro 2023-07-29 16:42:03 +02:00
parent 72846cd9d7
commit ccdfb76bdf
4 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,9 @@ data class Streams(
val uploaderAvatar: String? = null,
val thumbnailUrl: String,
val category: String,
val license: String,
val visibility: String,
val tags: List<String>,
val hls: String? = null,
val dash: String? = null,
val lbryId: String? = null,

View File

@ -984,7 +984,17 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
val description = streams.description
setupDescription(binding.playerDescription, description)
binding.videoCategory.text = "${context?.getString(R.string.category)}: ${streams.category}"
val visibility = when (streams.visibility) {
"public" -> context?.getString(R.string.visibility_public)
"unlisted" -> context?.getString(R.string.visibility_unlisted)
// currently no other visibility could be returned, might change in the future however
else -> streams.visibility.replaceFirstChar {
if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
}
}.orEmpty()
binding.additionalVideoInfo.text = "${context?.getString(R.string.category)}: ${streams.category}\n" +
"${context?.getString(R.string.license)}: ${streams.license}\n" +
"${context?.getString(R.string.visibility)}: $visibility"
binding.playerChannel.setOnClickListener {
val activity = view?.context as MainActivity

View File

@ -125,7 +125,7 @@
android:textSize="14sp" />
<TextView
android:id="@+id/video_category"
android:id="@+id/additional_video_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"

View File

@ -435,6 +435,9 @@
<string name="fallback_piped_proxy_desc">Load videos via the proxy if connecting to YouTube directly doesn\'t work for the current video (increases the initial loading times). If disabled, YouTube music content likely won\'t play due to YT restrictions.</string>
<string name="dearrow">Enable DeArrow</string>
<string name="dearrow_summary">Show more accurate and less sensationalist titles and thumbnails. Increases loading times.</string>
<string name="visibility">Visibility</string>
<string name="visibility_public">Public</string>
<string name="visibility_unlisted">Unlisted</string>
<!-- Backup & Restore Settings -->
<string name="import_subscriptions_from">Import subscriptions from</string>