} from '../../lib/activitypub/url'
import {
MStreamingPlaylistRedundanciesOpt,
+ MVideo,
MVideoAP,
MVideoFile,
MVideoFormattable,
- MVideoFormattableDetails,
- MVideoWithHost
+ MVideoFormattableDetails
} from '../../types/models'
import { MVideoFileRedundanciesOpt } from '../../types/models/video/video-file'
import { VideoModel } from './video'
label: videoFile.resolution + 'p'
},
- magnetUri: includeMagnet
+ magnetUri: includeMagnet && videoFile.hasTorrent()
? generateMagnetUri(video, videoFile, trackerUrls)
: undefined,
function addVideoFilesInAPAcc (
acc: ActivityUrlObject[] | ActivityTagObject[],
- video: MVideoWithHost,
+ video: MVideo,
files: MVideoFile[]
) {
const trackerUrls = video.getTrackerUrls()
fps: file.fps
})
- acc.push({
- type: 'Link',
- mediaType: 'application/x-bittorrent' as 'application/x-bittorrent',
- href: file.getTorrentUrl(),
- height: file.resolution
- })
-
- acc.push({
- type: 'Link',
- mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet',
- href: generateMagnetUri(video, file, trackerUrls),
- height: file.resolution
- })
+ if (file.hasTorrent()) {
+ acc.push({
+ type: 'Link',
+ mediaType: 'application/x-bittorrent' as 'application/x-bittorrent',
+ href: file.getTorrentUrl(),
+ height: file.resolution
+ })
+
+ acc.push({
+ type: 'Link',
+ mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet',
+ href: generateMagnetUri(video, file, trackerUrls),
+ height: file.resolution
+ })
+ }
}
}