diff options
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 76338ea3c..938eed0ef 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -131,12 +131,20 @@ async function processVideo (parameters: { | |||
131 | const videoInfo = await fetchObject(youtubeInfo) | 131 | const videoInfo = await fetchObject(youtubeInfo) |
132 | log.debug('Fetched object.', videoInfo) | 132 | log.debug('Fetched object.', videoInfo) |
133 | 133 | ||
134 | if (options.since && videoInfo.originallyPublishedAt && videoInfo.originallyPublishedAt.getTime() < options.since.getTime()) { | 134 | if ( |
135 | options.since && | ||
136 | videoInfo.originallyPublishedAtWithoutTime && | ||
137 | videoInfo.originallyPublishedAtWithoutTime.getTime() < options.since.getTime() | ||
138 | ) { | ||
135 | log.info('Video "%s" has been published before "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.since)) | 139 | log.info('Video "%s" has been published before "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.since)) |
136 | return true | 140 | return true |
137 | } | 141 | } |
138 | 142 | ||
139 | if (options.until && videoInfo.originallyPublishedAt && videoInfo.originallyPublishedAt.getTime() > options.until.getTime()) { | 143 | if ( |
144 | options.until && | ||
145 | videoInfo.originallyPublishedAtWithoutTime && | ||
146 | videoInfo.originallyPublishedAtWithoutTime.getTime() > options.until.getTime() | ||
147 | ) { | ||
140 | log.info('Video "%s" has been published after "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.until)) | 148 | log.info('Video "%s" has been published after "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.until)) |
141 | return true | 149 | return true |
142 | } | 150 | } |
@@ -212,8 +220,8 @@ async function uploadVideoOnPeerTube (parameters: { | |||
212 | const attributes = { | 220 | const attributes = { |
213 | ...baseAttributes, | 221 | ...baseAttributes, |
214 | 222 | ||
215 | originallyPublishedAt: videoInfo.originallyPublishedAt | 223 | originallyPublishedAtWithoutTime: videoInfo.originallyPublishedAtWithoutTime |
216 | ? videoInfo.originallyPublishedAt.toISOString() | 224 | ? videoInfo.originallyPublishedAtWithoutTime.toISOString() |
217 | : null, | 225 | : null, |
218 | 226 | ||
219 | thumbnailfile, | 227 | thumbnailfile, |