mirror of https://github.com/Chocobozzz/PeerTube
Merge branch 'release/6.0.0' into develop
commit
0a53a54ed7
|
@ -130,6 +130,7 @@ p-calendar {
|
|||
|
||||
.position {
|
||||
height: 31px;
|
||||
min-width: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<p-inputMask
|
||||
[disabled]="disabled" [(ngModel)]="timestampString" (onBlur)="onBlur()"
|
||||
[ngClass]="{ 'border-disabled': disableBorder }"
|
||||
mask="9:99:99" slotChar="0" (ngModelChange)="onModelChange()" [inputId]="inputName"
|
||||
mask="99:99:99" slotChar="0" (ngModelChange)="onModelChange()" [inputId]="inputName"
|
||||
></p-inputMask>
|
||||
|
|
|
@ -26,6 +26,8 @@ p-inputmask {
|
|||
&:not(.border-disabled) {
|
||||
::ng-deep input {
|
||||
@include peertube-input-text(80px);
|
||||
|
||||
padding: 3px 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ export class TimestampInputComponent implements ControlValueAccessor, OnInit {
|
|||
writeValue (timestamp: number) {
|
||||
this.timestamp = timestamp
|
||||
|
||||
this.timestampString = secondsToTime(this.timestamp, true, ':')
|
||||
this.timestampString = secondsToTime({ seconds: this.timestamp, fullFormat: true, symbol: ':' })
|
||||
console.log(this.timestampString)
|
||||
}
|
||||
|
||||
registerOnChange (fn: (_: any) => void) {
|
||||
|
|
|
@ -144,8 +144,8 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
|
|||
const start = playlistElement.startTimestamp
|
||||
const stop = playlistElement.stopTimestamp
|
||||
|
||||
const startFormatted = secondsToTime(start, true, ':')
|
||||
const stopFormatted = secondsToTime(stop, true, ':')
|
||||
const startFormatted = secondsToTime({ seconds: start, fullFormat: true, symbol: ':' })
|
||||
const stopFormatted = secondsToTime({ seconds: stop, fullFormat: true, symbol: ':' })
|
||||
|
||||
if (start === null && stop === null) return ''
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ class PeerTubePlugin extends Plugin {
|
|||
// In portrait screen mode, we allow player with bigger height size than width
|
||||
const portraitMode = getComputedStyle(el).getPropertyValue(this.options.autoPlayerRatio.cssPlayerPortraitModeVariable) === '1'
|
||||
|
||||
const currentRatio = !portraitMode && data.ratio < 1
|
||||
const currentRatio = isNaN(data.ratio) || (!portraitMode && data.ratio < 1)
|
||||
? defaultRatio
|
||||
: data.ratio
|
||||
|
||||
|
|
|
@ -83,29 +83,46 @@ function timeToInt (time: number | string) {
|
|||
return result
|
||||
}
|
||||
|
||||
function secondsToTime (seconds: number, full = false, symbol?: string) {
|
||||
function secondsToTime (options: {
|
||||
seconds: number
|
||||
fullFormat?: boolean // default false
|
||||
symbol?: string
|
||||
} | number) {
|
||||
let seconds: number
|
||||
let fullFormat = false
|
||||
let symbol: string
|
||||
|
||||
if (typeof options === 'number') {
|
||||
seconds = options
|
||||
} else {
|
||||
seconds = options.seconds
|
||||
fullFormat = options.fullFormat ?? false
|
||||
symbol = options.symbol
|
||||
}
|
||||
|
||||
let time = ''
|
||||
|
||||
if (seconds === 0 && !full) return '0s'
|
||||
if (seconds === 0 && !fullFormat) return '0s'
|
||||
|
||||
const hourSymbol = (symbol || 'h')
|
||||
const minuteSymbol = (symbol || 'm')
|
||||
const secondsSymbol = full ? '' : 's'
|
||||
const secondsSymbol = fullFormat ? '' : 's'
|
||||
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
if (hours >= 1) time = hours + hourSymbol
|
||||
else if (full) time = '0' + hourSymbol
|
||||
if (hours >= 1 && hours < 10 && fullFormat) time = '0' + hours + hourSymbol
|
||||
else if (hours >= 1) time = hours + hourSymbol
|
||||
else if (fullFormat) time = '00' + hourSymbol
|
||||
|
||||
seconds %= 3600
|
||||
const minutes = Math.floor(seconds / 60)
|
||||
if (minutes >= 1 && minutes < 10 && full) time += '0' + minutes + minuteSymbol
|
||||
if (minutes >= 1 && minutes < 10 && fullFormat) time += '0' + minutes + minuteSymbol
|
||||
else if (minutes >= 1) time += minutes + minuteSymbol
|
||||
else if (full) time += '00' + minuteSymbol
|
||||
else if (fullFormat) time += '00' + minuteSymbol
|
||||
|
||||
seconds %= 60
|
||||
if (seconds >= 1 && seconds < 10 && full) time += '0' + seconds + secondsSymbol
|
||||
if (seconds >= 1 && seconds < 10 && fullFormat) time += '0' + seconds + secondsSymbol
|
||||
else if (seconds >= 1) time += seconds + secondsSymbol
|
||||
else if (full) time += '00'
|
||||
else if (fullFormat) time += '00'
|
||||
|
||||
return time
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ async function processVideoLiveEnding (job: Job) {
|
|||
return cleanupLiveAndFederate({ permanentLive, video, streamingPlaylistId: payload.streamingPlaylistId })
|
||||
}
|
||||
|
||||
if (await hasReplayFiles(payload.replayDirectory) !== true) {
|
||||
logger.info(`No replay files found for live ${video.uuid}, skipping video replay creation.`, { ...lTags(video.uuid) })
|
||||
|
||||
return cleanupLiveAndFederate({ permanentLive, video, streamingPlaylistId: payload.streamingPlaylistId })
|
||||
}
|
||||
|
||||
if (permanentLive) {
|
||||
await saveReplayToExternalVideo({
|
||||
liveVideo: video,
|
||||
|
@ -305,3 +311,7 @@ async function cleanupLiveAndFederate (options: {
|
|||
function createStoryboardJob (video: MVideo) {
|
||||
return JobQueue.Instance.createJob(buildStoryboardJobIfNeeded({ video, federate: true }))
|
||||
}
|
||||
|
||||
async function hasReplayFiles (replayDirectory: string) {
|
||||
return (await readdir(replayDirectory)).length !== 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue