}
function isRemoteVideoUrlValid (url: any) {
+ // FIXME: Old bug, we used the width to represent the resolution. Remove it in a few realease (currently beta.11)
+ if (url.width && !url.height) url.height = url.width
+
return url.type === 'Link' &&
(
ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 &&
isActivityPubUrlValid(url.href) &&
- validator.isInt(url.width + '', { min: 0 }) &&
+ validator.isInt(url.height + '', { min: 0 }) &&
validator.isInt(url.size + '', { min: 0 }) &&
(!url.fps || validator.isInt(url.fps + '', { min: 0 }))
) ||
(
ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 &&
isActivityPubUrlValid(url.href) &&
- validator.isInt(url.width + '', { min: 0 })
+ validator.isInt(url.height + '', { min: 0 })
) ||
(
ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 &&
validator.isLength(url.href, { min: 5 }) &&
- validator.isInt(url.width + '', { min: 0 })
+ validator.isInt(url.height + '', { min: 0 })
)
}
import { retryTransactionWrapper } from '../../helpers/database-utils'
import { logger } from '../../helpers/logger'
import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests'
-import { ACTIVITY_PUB, CONFIG, REMOTE_SCHEME, sequelizeTypescript, STATIC_PATHS, VIDEO_MIMETYPE_EXT } from '../../initializers'
+import { ACTIVITY_PUB, CONFIG, REMOTE_SCHEME, sequelizeTypescript, VIDEO_MIMETYPE_EXT } from '../../initializers'
import { AccountVideoRateModel } from '../../models/account/account-video-rate'
import { ActorModel } from '../../models/activitypub/actor'
import { TagModel } from '../../models/video/tag'
for (const fileUrl of fileUrls) {
// Fetch associated magnet uri
const magnet = videoObject.url.find(u => {
- return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.width === fileUrl.width
+ return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.height === fileUrl.height
})
if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href)
const attribute = {
extname: VIDEO_MIMETYPE_EXT[ fileUrl.mimeType ],
infoHash: parsed.infoHash,
- resolution: fileUrl.width,
+ resolution: fileUrl.height,
size: fileUrl.size,
videoId: videoCreated.id,
fps: fileUrl.fps
type: 'Link',
mimeType: VIDEO_EXT_MIMETYPE[file.extname],
href: this.getVideoFileUrl(file, baseUrlHttp),
- width: file.resolution,
+ height: file.resolution,
size: file.size,
fps: file.fps
})
type: 'Link',
mimeType: 'application/x-bittorrent',
href: this.getTorrentUrl(file, baseUrlHttp),
- width: file.resolution
+ height: file.resolution
})
url.push({
type: 'Link',
mimeType: 'application/x-bittorrent;x-scheme-handler/magnet',
href: this.generateMagnetUri(file, baseUrlHttp, baseUrlWs),
- width: file.resolution
+ height: file.resolution
})
}
type: 'Link'
mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
href: string
- width: number
+ height: number
size?: number
fps?: number