playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
playlist.type = VideoStreamingPlaylistType.HLS
- playlist.assignP2PMediaLoaderInfoHashes(video, allResolutions)
-
playlist.storage = CONFIG.OBJECT_STORAGE.ENABLED
? VideoStorage.OBJECT_STORAGE
: VideoStorage.FILE_SYSTEM
+ playlist.assignP2PMediaLoaderInfoHashes(video, allResolutions)
+
return playlist.save()
}
const url = await storeHLSFileFromFilename(this.streamingPlaylist, this.streamingPlaylist.playlistFilename)
this.streamingPlaylist.playlistUrl = url
+ this.streamingPlaylist.assignP2PMediaLoaderInfoHashes(this.videoLive.Video, this.allResolutions)
+
await this.streamingPlaylist.save()
} catch (err) {
logger.error('Cannot upload live master file to object storage.', { err, ...this.lTags() })
import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
+import { sha1 } from '@shared/extra-utils'
async function checkLiveCleanup (options: {
server: PeerTubeServer
segmentName,
hlsPlaylist
})
+
+ if (originServer.internalServerNumber === server.internalServerNumber) {
+ const infohash = sha1(`${2 + hlsPlaylist.playlistUrl}+V${i}`)
+ const dbInfohashes = await originServer.sql.getPlaylistInfohash(hlsPlaylist.id)
+
+ expect(dbInfohashes).to.include(infohash)
+ }
}
}
}
expect(sha256(segmentBody)).to.equal(shaBody[videoName][range])
}
+// ---------------------------------------------------------------------------
+
async function checkLiveSegmentHash (options: {
server: PeerTubeServer
baseUrlSegment: string
expect(sha256(segmentBody)).to.equal(shaBody[segmentName])
}
+// ---------------------------------------------------------------------------
+
async function checkResolutionsInMasterPlaylist (options: {
server: PeerTubeServer
playlistUrl: string
return seq.query(query, options)
}
+ // ---------------------------------------------------------------------------
+
setPluginField (pluginName: string, field: string, value: string) {
const seq = this.getSequelize()
return this.setPluginField(pluginName, 'latestVersion', newVersion)
}
+ // ---------------------------------------------------------------------------
+
+ async getPlaylistInfohash (playlistId: number) {
+ const result = await this.selectQuery('SELECT "p2pMediaLoaderInfohashes" FROM "videoStreamingPlaylist" WHERE id = ' + playlistId)
+ if (!result || result.length === 0) return []
+
+ return result[0].p2pMediaLoaderInfohashes
+ }
+
+ // ---------------------------------------------------------------------------
+
setActorFollowScores (newScore: number) {
const seq = this.getSequelize()