1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Fix fetching latest elements of a playlist

This commit is contained in:
Chocobozzz 2025-08-11 14:52:09 +02:00
parent 6fce7c808c
commit b4df49b87f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 25 additions and 10 deletions

View file

@ -16,9 +16,9 @@ export async function synchronizeChannel (options: {
externalChannelUrl: string
videosCountLimit: number
channelSync?: MChannelSync
onlyAfter?: Date
skipPublishedBefore?: Date
}) {
const { channel, externalChannelUrl, videosCountLimit, onlyAfter, channelSync } = options
const { channel, externalChannelUrl, videosCountLimit, skipPublishedBefore, channelSync } = options
if (channelSync) {
channelSync.state = VideoChannelSyncState.PROCESSING
@ -58,7 +58,7 @@ export async function synchronizeChannel (options: {
logger.debug(`Import candidate: ${targetUrl}`, lTags())
try {
if (await skipImport({ channel, channelSync, targetUrl, onlyAfter })) continue
if (await skipImport({ channel, channelSync, targetUrl, skipPublishedBefore })) continue
const { job } = await buildYoutubeDLImport({
user,
@ -98,9 +98,9 @@ async function skipImport (options: {
channel: MChannelAccountDefault
channelSync: MChannelSync
targetUrl: string
onlyAfter?: Date
skipPublishedBefore?: Date
}) {
const { channel, channelSync, targetUrl, onlyAfter } = options
const { channel, channelSync, targetUrl, skipPublishedBefore } = options
if (await VideoImportModel.urlAlreadyImported({ channelId: channel.id, channelSyncId: channelSync?.id, targetUrl })) {
logger.debug(
@ -110,7 +110,7 @@ async function skipImport (options: {
return true
}
if (onlyAfter) {
if (skipPublishedBefore) {
const youtubeDL = new YoutubeDLWrapper(
targetUrl,
ServerConfigManager.Instance.getEnabledResolutions('vod'),
@ -119,7 +119,7 @@ async function skipImport (options: {
const videoInfo = await youtubeDL.getInfoForDownload()
const onlyAfterWithoutTime = new Date(onlyAfter)
const onlyAfterWithoutTime = new Date(skipPublishedBefore)
onlyAfterWithoutTime.setHours(0, 0, 0, 0)
if (videoInfo.originallyPublishedAtWithoutTime.getTime() < onlyAfterWithoutTime.getTime()) {