+ if (options.resolution !== undefined) {
+ dataInput.push({
+ type: 'new-resolution-to-webtorrent' as 'new-resolution-to-webtorrent',
+ videoUUID: video.uuid,
+
+ createHLSIfNeeded: true,
+
+ // FIXME: check the file has audio
+ hasAudio: true,
+
+ isNewVideo: false,
+ resolution: parseInt(options.resolution)
+ })
+ } else {
+ if (video.VideoFiles.length === 0) {
+ console.error('Cannot regenerate webtorrent files with a HLS only video.')
+ return
+ }
+
+ dataInput.push({
+ type: 'optimize-to-webtorrent' as 'optimize-to-webtorrent',
+ videoUUID: video.uuid,
+ isNewVideo: false
+ })
+ }