aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-09-16 09:52:50 +0200
committerChocobozzz <me@florianbigard.com>2022-09-16 09:52:50 +0200
commitcbdd81da96ece934acac0735362f534fbc307bfd (patch)
tree52f808a46ad55043d8fd9d1d6834e02149e52171
parent3204f4d17dec79413a94eae8a71b72e0c7ec7ba5 (diff)
downloadPeerTube-cbdd81da96ece934acac0735362f534fbc307bfd.tar.gz
PeerTube-cbdd81da96ece934acac0735362f534fbc307bfd.tar.zst
PeerTube-cbdd81da96ece934acac0735362f534fbc307bfd.zip
Fix import script
-rw-r--r--server/tools/peertube-import-videos.ts16
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,