mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #6168 from Bnyro/master
fix: crash when playing video without upload date
This commit is contained in:
commit
309427148c
@ -19,7 +19,8 @@ data class Streams(
|
|||||||
|
|
||||||
@Serializable(SafeInstantSerializer::class)
|
@Serializable(SafeInstantSerializer::class)
|
||||||
@SerialName("uploadDate")
|
@SerialName("uploadDate")
|
||||||
val uploadTimestamp: Instant,
|
val uploadTimestamp: Instant?,
|
||||||
|
val uploaded: Long? = null,
|
||||||
|
|
||||||
val uploader: String,
|
val uploader: String,
|
||||||
val uploaderUrl: String,
|
val uploaderUrl: String,
|
||||||
@ -91,9 +92,9 @@ data class Streams(
|
|||||||
uploaderName = uploader,
|
uploaderName = uploader,
|
||||||
uploaderUrl = uploaderUrl,
|
uploaderUrl = uploaderUrl,
|
||||||
uploaderAvatar = uploaderAvatar,
|
uploaderAvatar = uploaderAvatar,
|
||||||
uploadedDate = uploadTimestamp.toLocalDateTime(TimeZone.currentSystemDefault()).date
|
uploadedDate = uploadTimestamp?.toLocalDateTime(TimeZone.currentSystemDefault())?.date
|
||||||
.toString(),
|
?.toString(),
|
||||||
uploaded = uploadTimestamp.toEpochMilliseconds(),
|
uploaded = uploaded ?: uploadTimestamp?.toEpochMilliseconds() ?: 0,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
views = views,
|
views = views,
|
||||||
uploaderVerified = uploaderVerified,
|
uploaderVerified = uploaderVerified,
|
||||||
|
@ -120,7 +120,7 @@ class DownloadService : LifecycleService() {
|
|||||||
streams.description,
|
streams.description,
|
||||||
streams.uploader,
|
streams.uploader,
|
||||||
streams.duration,
|
streams.duration,
|
||||||
streams.uploadTimestamp.toLocalDateTime(TimeZone.currentSystemDefault()).date,
|
streams.uploadTimestamp?.toLocalDateTime(TimeZone.currentSystemDefault())?.date,
|
||||||
thumbnailTargetPath
|
thumbnailTargetPath
|
||||||
)
|
)
|
||||||
Database.downloadDao().insertDownload(download)
|
Database.downloadDao().insertDownload(download)
|
||||||
|
@ -681,7 +681,6 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
commentsViewModel.setCommentSheetExpand(null)
|
commentsViewModel.setCommentSheetExpand(null)
|
||||||
|
|
||||||
updateResolutionOnFullscreenChange(true)
|
updateResolutionOnFullscreenChange(true)
|
||||||
|
|
||||||
openOrCloseFullscreenDialog(true)
|
openOrCloseFullscreenDialog(true)
|
||||||
|
|
||||||
binding.player.updateMarginsByFullscreenMode()
|
binding.player.updateMarginsByFullscreenMode()
|
||||||
@ -691,7 +690,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
fun unsetFullscreen() {
|
fun unsetFullscreen() {
|
||||||
viewModel.isFullscreen.value = false
|
viewModel.isFullscreen.value = false
|
||||||
|
|
||||||
if (!PlayerHelper.autoFullscreenEnabled) {
|
if (!PlayerHelper.autoFullscreenEnabled && activity != null) {
|
||||||
mainActivity.requestedOrientation = mainActivity.screenOrientationPref
|
mainActivity.requestedOrientation = mainActivity.screenOrientationPref
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,9 +143,10 @@ class DescriptionLayout(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun localizeDate(streams: Streams): String {
|
private fun localizeDate(streams: Streams): String {
|
||||||
if (streams.livestream) return ""
|
if (streams.livestream || streams.uploadTimestamp == null) return ""
|
||||||
|
|
||||||
val date = streams.uploadTimestamp.toLocalDateTime(TimeZone.currentSystemDefault()).date
|
val date = streams.uploadTimestamp.toLocalDateTime(TimeZone.currentSystemDefault()).date
|
||||||
|
|
||||||
return TextUtils.SEPARATOR + TextUtils.localizeDate(date)
|
return TextUtils.SEPARATOR + TextUtils.localizeDate(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user