aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html19
-rw-r--r--client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.scss8
-rw-r--r--client/src/app/videos/+video-edit/video-import.component.html2
-rw-r--r--server/lib/job-queue/handlers/video-import.ts3
-rw-r--r--server/lib/job-queue/job-queue.ts5
-rw-r--r--server/models/video/video-import.ts6
-rw-r--r--shared/models/videos/video-import.model.ts2
7 files changed, 38 insertions, 7 deletions
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html
index 74ca33fa3..00b2d7cb0 100644
--- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html
+++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.html
@@ -1,9 +1,10 @@
1<p-table 1<p-table
2 [value]="videoImports" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" 2 [value]="videoImports" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" 3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
4> 4>
5 <ng-template pTemplate="header"> 5 <ng-template pTemplate="header">
6 <tr> 6 <tr>
7 <th style="width: 40px;"></th>
7 <th i18n>URL</th> 8 <th i18n>URL</th>
8 <th i18n>Video</th> 9 <th i18n>Video</th>
9 <th i18n style="width: 150px">State</th> 10 <th i18n style="width: 150px">State</th>
@@ -12,9 +13,15 @@
12 </tr> 13 </tr>
13 </ng-template> 14 </ng-template>
14 15
15 <ng-template pTemplate="body" let-videoImport> 16 <ng-template pTemplate="body" let-expanded="expanded" let-videoImport>
16 <tr> 17 <tr>
17 <td> 18 <td>
19 <span *ngIf="videoImport.error" class="expander" [pRowToggler]="videoImport">
20 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
21 </span>
22 </td>
23
24 <td>
18 <a [href]="videoImport.targetUrl" target="_blank" rel="noopener noreferrer">{{ videoImport.targetUrl }}</a> 25 <a [href]="videoImport.targetUrl" target="_blank" rel="noopener noreferrer">{{ videoImport.targetUrl }}</a>
19 </td> 26 </td>
20 27
@@ -34,4 +41,12 @@
34 </td> 41 </td>
35 </tr> 42 </tr>
36 </ng-template> 43 </ng-template>
44
45 <ng-template pTemplate="rowexpansion" let-videoImport>
46 <tr class="video-import-error" *ngIf="videoImport.error">
47 <td colspan="6">
48 <pre>{{ videoImport.error }}</pre>
49 </td>
50 </tr>
51 </ng-template>
37</p-table> 52</p-table>
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.scss b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.scss
index 5e6774739..bdd2f8270 100644
--- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.scss
+++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.scss
@@ -1,2 +1,10 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3
4pre {
5 font-size: 11px;
6}
7
8.video-import-error {
9 color: red;
10} \ No newline at end of file
diff --git a/client/src/app/videos/+video-edit/video-import.component.html b/client/src/app/videos/+video-edit/video-import.component.html
index d59c6a23a..cfad5e289 100644
--- a/client/src/app/videos/+video-edit/video-import.component.html
+++ b/client/src/app/videos/+video-edit/video-import.component.html
@@ -6,7 +6,7 @@
6 <label i18n for="targetUrl">URL</label> 6 <label i18n for="targetUrl">URL</label>
7 <my-help 7 <my-help
8 helpType="custom" i18n-customHtml 8 helpType="custom" i18n-customHtml
9 customHtml="You can import any URL <a href='https://rg3.github.io/youtube-dl/supportedsites.html'>supported by youtube-dl</a> or URL that points to a raw MP4 file. Failure to secure these rights could cause legal trouble to yourself and your instance." 9 customHtml="You can import any URL <a href='https://rg3.github.io/youtube-dl/supportedsites.html' target='_blank' rel='noopener noreferrer'>supported by youtube-dl</a> or URL that points to a raw MP4 file. Failure to secure these rights could cause legal trouble to yourself and your instance."
10 ></my-help> 10 ></my-help>
11 11
12 <input type="text" id="targetUrl" [(ngModel)]="targetUrl" /> 12 <input type="text" id="targetUrl" [(ngModel)]="targetUrl" />
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 5a7722153..4f2faab7d 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -35,7 +35,7 @@ async function processVideoImport (job: Bull.Job) {
35 35
36 // Get information about this video 36 // Get information about this video
37 const { videoFileResolution } = await getVideoFileResolution(tempVideoPath) 37 const { videoFileResolution } = await getVideoFileResolution(tempVideoPath)
38 const fps = await getVideoFileFPS(tempVideoPath + 's') 38 const fps = await getVideoFileFPS(tempVideoPath)
39 const stats = await statPromise(tempVideoPath) 39 const stats = await statPromise(tempVideoPath)
40 const duration = await getDurationFromVideoFile(tempVideoPath) 40 const duration = await getDurationFromVideoFile(tempVideoPath)
41 41
@@ -115,6 +115,7 @@ async function processVideoImport (job: Bull.Job) {
115 logger.error('Cannot cleanup files after a video import error.', { err: errUnlink }) 115 logger.error('Cannot cleanup files after a video import error.', { err: errUnlink })
116 } 116 }
117 117
118 videoImport.error = err.message
118 videoImport.state = VideoImportState.FAILED 119 videoImport.state = VideoImportState.FAILED
119 await videoImport.save() 120 await videoImport.save()
120 121
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 2e14867f2..ffd948b5f 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -79,7 +79,10 @@ class JobQueue {
79 const handler = handlers[handlerName] 79 const handler = handlers[handlerName]
80 80
81 queue.process(JOB_CONCURRENCY[handlerName], handler) 81 queue.process(JOB_CONCURRENCY[handlerName], handler)
82 .catch(err => logger.error('Cannot execute job queue %s.', handlerName, { err })) 82
83 queue.on('failed', (job, err) => {
84 logger.error('Cannot execute job %d in queue %s.', job.id, handlerName, { payload: job.data, err })
85 })
83 86
84 queue.on('error', err => { 87 queue.on('error', err => {
85 logger.error('Error in job queue %s.', handlerName, { err }) 88 logger.error('Error in job queue %s.', handlerName, { err })
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index 6b8a16b65..c2e55509c 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -26,7 +26,7 @@ import { TagModel } from './tag'
26 include: [ 26 include: [
27 { 27 {
28 model: () => VideoModel, 28 model: () => VideoModel,
29 required: true, 29 required: false,
30 include: [ 30 include: [
31 { 31 {
32 model: () => VideoChannelModel, 32 model: () => VideoChannelModel,
@@ -112,7 +112,7 @@ export class VideoImportModel extends Model<VideoImportModel> {
112 include: [ 112 include: [
113 { 113 {
114 model: VideoModel, 114 model: VideoModel,
115 required: true, 115 required: false,
116 include: [ 116 include: [
117 { 117 {
118 model: VideoChannelModel, 118 model: VideoChannelModel,
@@ -157,11 +157,13 @@ export class VideoImportModel extends Model<VideoImportModel> {
157 : undefined 157 : undefined
158 158
159 return { 159 return {
160 id: this.id,
160 targetUrl: this.targetUrl, 161 targetUrl: this.targetUrl,
161 state: { 162 state: {
162 id: this.state, 163 id: this.state,
163 label: VideoImportModel.getStateLabel(this.state) 164 label: VideoImportModel.getStateLabel(this.state)
164 }, 165 },
166 error: this.error,
165 updatedAt: this.updatedAt.toISOString(), 167 updatedAt: this.updatedAt.toISOString(),
166 createdAt: this.createdAt.toISOString(), 168 createdAt: this.createdAt.toISOString(),
167 video 169 video
diff --git a/shared/models/videos/video-import.model.ts b/shared/models/videos/video-import.model.ts
index b23e6b245..c8dea0246 100644
--- a/shared/models/videos/video-import.model.ts
+++ b/shared/models/videos/video-import.model.ts
@@ -3,10 +3,12 @@ import { VideoConstant } from './video-constant.model'
3import { VideoImportState } from '../../index' 3import { VideoImportState } from '../../index'
4 4
5export interface VideoImport { 5export interface VideoImport {
6 id: number
6 targetUrl: string 7 targetUrl: string
7 createdAt: string 8 createdAt: string
8 updatedAt: string 9 updatedAt: string
9 state: VideoConstant<VideoImportState> 10 state: VideoConstant<VideoImportState>
11 error?: string
10 12
11 video?: Video & { tags: string[] } 13 video?: Video & { tags: string[] }
12} 14}