+ .pipe(catchError(err => this.restExtractor.handleError(err)))
+ }
+
+ extractVideos (result: ResultList<VideoServerModel>) {
+ return this.serverService.getServerLocale()
+ .pipe(
+ map(translations => {
+ const videosJson = result.data
+ const totalVideos = result.total
+ const videos: Video[] = []
+
+ for (const videoJson of videosJson) {
+ videos.push(new Video(videoJson, translations))
+ }
+
+ return { total: totalVideos, data: videos }
+ })
+ )
+ }
+
+ explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[]) {
+ const base = [
+ {
+ id: VideoPrivacy.PRIVATE,
+ label: this.i18n('Only I can see this video')
+ },
+ {
+ id: VideoPrivacy.UNLISTED,
+ label: this.i18n('Only people with the private link can see this video')
+ },
+ {
+ id: VideoPrivacy.PUBLIC,
+ label: this.i18n('Anyone can see this video')
+ },
+ {
+ id: VideoPrivacy.INTERNAL,
+ label: this.i18n('Only users of this instance can see this video')
+ }
+ ]
+
+ return base.filter(o => !!privacies.find(p => p.id === o.id))