diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-11 11:33:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-11 13:45:39 +0200 |
commit | 6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch) | |
tree | b47de7efb8c6c611c63a15a971c6125a278f547a /server/lib/video-transcoding.ts | |
parent | 2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff) | |
download | PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip |
Move config in its own file
Diffstat (limited to 'server/lib/video-transcoding.ts')
-rw-r--r-- | server/lib/video-transcoding.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index dbc22816c..11098dca3 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers' | 1 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' | 3 | import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' |
4 | import { ensureDir, move, remove, stat } from 'fs-extra' | 4 | import { ensureDir, move, remove, stat } from 'fs-extra' |
@@ -9,6 +9,7 @@ import { VideoModel } from '../models/video/video' | |||
9 | import { updateMasterHLSPlaylist, updateSha256Segments } from './hls' | 9 | import { updateMasterHLSPlaylist, updateSha256Segments } from './hls' |
10 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' | 10 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' |
11 | import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type' | 11 | import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type' |
12 | import { CONFIG } from '../initializers/config' | ||
12 | 13 | ||
13 | async function optimizeVideofile (video: VideoModel, inputVideoFileArg?: VideoFileModel) { | 14 | async function optimizeVideofile (video: VideoModel, inputVideoFileArg?: VideoFileModel) { |
14 | const videosDirectory = CONFIG.STORAGE.VIDEOS_DIR | 15 | const videosDirectory = CONFIG.STORAGE.VIDEOS_DIR |
@@ -111,12 +112,12 @@ async function generateHlsPlaylist (video: VideoModel, resolution: VideoResoluti | |||
111 | await updateMasterHLSPlaylist(video) | 112 | await updateMasterHLSPlaylist(video) |
112 | await updateSha256Segments(video) | 113 | await updateSha256Segments(video) |
113 | 114 | ||
114 | const playlistUrl = CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid) | 115 | const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid) |
115 | 116 | ||
116 | await VideoStreamingPlaylistModel.upsert({ | 117 | await VideoStreamingPlaylistModel.upsert({ |
117 | videoId: video.id, | 118 | videoId: video.id, |
118 | playlistUrl, | 119 | playlistUrl, |
119 | segmentsSha256Url: CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid), | 120 | segmentsSha256Url: WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid), |
120 | p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles), | 121 | p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles), |
121 | p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION, | 122 | p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION, |
122 | 123 | ||