aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/friends.ts4
-rw-r--r--server/lib/jobs/handlers/video-transcoder.ts4
-rw-r--r--server/lib/request/request-video-event-scheduler.ts16
-rw-r--r--server/lib/request/request-video-qadu-scheduler.ts16
4 files changed, 20 insertions, 20 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts
index a65820191..cbdc60441 100644
--- a/server/lib/friends.ts
+++ b/server/lib/friends.ts
@@ -43,8 +43,8 @@ import {
43 Pod as FormatedPod 43 Pod as FormatedPod
44} from '../../shared' 44} from '../../shared'
45 45
46type QaduParam = { videoId: string, type: RequestVideoQaduType } 46type QaduParam = { videoId: number, type: RequestVideoQaduType }
47type EventParam = { videoId: string, type: RequestVideoEventType } 47type EventParam = { videoId: number, type: RequestVideoEventType }
48 48
49const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] 49const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS]
50 50
diff --git a/server/lib/jobs/handlers/video-transcoder.ts b/server/lib/jobs/handlers/video-transcoder.ts
index eeb2d57b0..0d32dfd2f 100644
--- a/server/lib/jobs/handlers/video-transcoder.ts
+++ b/server/lib/jobs/handlers/video-transcoder.ts
@@ -3,8 +3,8 @@ import { logger } from '../../../helpers'
3import { addVideoToFriends } from '../../../lib' 3import { addVideoToFriends } from '../../../lib'
4import { VideoInstance } from '../../../models' 4import { VideoInstance } from '../../../models'
5 5
6function process (data: { id: string }) { 6function process (data: { videoUUID: string }) {
7 return db.Video.loadAndPopulateAuthorAndPodAndTags(data.id).then(video => { 7 return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => {
8 return video.transcodeVideofile().then(() => video) 8 return video.transcodeVideofile().then(() => video)
9 }) 9 })
10} 10}
diff --git a/server/lib/request/request-video-event-scheduler.ts b/server/lib/request/request-video-event-scheduler.ts
index 8a008c51b..680232732 100644
--- a/server/lib/request/request-video-event-scheduler.ts
+++ b/server/lib/request/request-video-event-scheduler.ts
@@ -12,7 +12,7 @@ import { RequestVideoEventType, RemoteVideoEventRequest, RemoteVideoEventType }
12 12
13export type RequestVideoEventSchedulerOptions = { 13export type RequestVideoEventSchedulerOptions = {
14 type: RequestVideoEventType 14 type: RequestVideoEventType
15 videoId: string 15 videoId: number
16 count?: number 16 count?: number
17 transaction?: Sequelize.Transaction 17 transaction?: Sequelize.Transaction
18} 18}
@@ -49,7 +49,7 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
49 */ 49 */
50 const eventsPerVideoPerPod: { 50 const eventsPerVideoPerPod: {
51 [ podId: string ]: { 51 [ podId: string ]: {
52 [ videoRemoteId: string ]: { 52 [ videoUUID: string ]: {
53 views?: number 53 views?: number
54 likes?: number 54 likes?: number
55 dislikes?: number 55 dislikes?: number
@@ -74,10 +74,10 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
74 requestsToMakeGrouped[toPodId].ids.push(eventToProcess.id) 74 requestsToMakeGrouped[toPodId].ids.push(eventToProcess.id)
75 75
76 const eventsPerVideo = eventsPerVideoPerPod[toPodId] 76 const eventsPerVideo = eventsPerVideoPerPod[toPodId]
77 const remoteId = eventToProcess.video.remoteId 77 const uuid = eventToProcess.video.uuid
78 if (!eventsPerVideo[remoteId]) eventsPerVideo[remoteId] = {} 78 if (!eventsPerVideo[uuid]) eventsPerVideo[uuid] = {}
79 79
80 const events = eventsPerVideo[remoteId] 80 const events = eventsPerVideo[uuid]
81 if (!events[eventToProcess.type]) events[eventToProcess.type] = 0 81 if (!events[eventToProcess.type]) events[eventToProcess.type] = 0
82 82
83 events[eventToProcess.type] += eventToProcess.count 83 events[eventToProcess.type] += eventToProcess.count
@@ -88,13 +88,13 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler<RequestsVideoE
88 Object.keys(eventsPerVideoPerPod).forEach(toPodId => { 88 Object.keys(eventsPerVideoPerPod).forEach(toPodId => {
89 const eventsForPod = eventsPerVideoPerPod[toPodId] 89 const eventsForPod = eventsPerVideoPerPod[toPodId]
90 90
91 Object.keys(eventsForPod).forEach(remoteId => { 91 Object.keys(eventsForPod).forEach(uuid => {
92 const eventsForVideo = eventsForPod[remoteId] 92 const eventsForVideo = eventsForPod[uuid]
93 93
94 Object.keys(eventsForVideo).forEach(eventType => { 94 Object.keys(eventsForVideo).forEach(eventType => {
95 requestsToMakeGrouped[toPodId].datas.push({ 95 requestsToMakeGrouped[toPodId].datas.push({
96 data: { 96 data: {
97 remoteId, 97 uuid,
98 eventType: eventType as RemoteVideoEventType, 98 eventType: eventType as RemoteVideoEventType,
99 count: +eventsForVideo[eventType] 99 count: +eventsForVideo[eventType]
100 } 100 }
diff --git a/server/lib/request/request-video-qadu-scheduler.ts b/server/lib/request/request-video-qadu-scheduler.ts
index 988165170..afb9d5c23 100644
--- a/server/lib/request/request-video-qadu-scheduler.ts
+++ b/server/lib/request/request-video-qadu-scheduler.ts
@@ -21,8 +21,8 @@ interface RequestsObjectsCustom<U> extends RequestsObjects<U> {
21 datas: U[] 21 datas: U[]
22 22
23 videos: { 23 videos: {
24 [ id: string ]: { 24 [ uuid: string ]: {
25 remoteId: string 25 uuid: string
26 likes?: number 26 likes?: number
27 dislikes?: number 27 dislikes?: number
28 views?: number 28 views?: number
@@ -33,7 +33,7 @@ interface RequestsObjectsCustom<U> extends RequestsObjects<U> {
33 33
34export type RequestVideoQaduSchedulerOptions = { 34export type RequestVideoQaduSchedulerOptions = {
35 type: RequestVideoQaduType 35 type: RequestVideoQaduType
36 videoId: string 36 videoId: number
37 transaction?: Sequelize.Transaction 37 transaction?: Sequelize.Transaction
38} 38}
39 39
@@ -78,7 +78,7 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
78 78
79 // Maybe another attribute was filled for this video 79 // Maybe another attribute was filled for this video
80 let videoData = requestsToMakeGrouped[hashKey].videos[video.id] 80 let videoData = requestsToMakeGrouped[hashKey].videos[video.id]
81 if (!videoData) videoData = { remoteId: null } 81 if (!videoData) videoData = { uuid: null }
82 82
83 switch (request.type) { 83 switch (request.type) {
84 case REQUEST_VIDEO_QADU_TYPES.LIKES: 84 case REQUEST_VIDEO_QADU_TYPES.LIKES:
@@ -98,8 +98,8 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
98 return 98 return
99 } 99 }
100 100
101 // Do not forget the remoteId so the remote pod can identify the video 101 // Do not forget the uuid so the remote pod can identify the video
102 videoData.remoteId = video.id 102 videoData.uuid = video.uuid
103 requestsToMakeGrouped[hashKey].ids.push(request.id) 103 requestsToMakeGrouped[hashKey].ids.push(request.id)
104 104
105 // Maybe there are multiple quick and dirty update for the same video 105 // Maybe there are multiple quick and dirty update for the same video
@@ -110,8 +110,8 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
110 110
111 // Now we deduped similar quick and dirty updates, we can build our requests datas 111 // Now we deduped similar quick and dirty updates, we can build our requests datas
112 Object.keys(requestsToMakeGrouped).forEach(hashKey => { 112 Object.keys(requestsToMakeGrouped).forEach(hashKey => {
113 Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoId => { 113 Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => {
114 const videoData = requestsToMakeGrouped[hashKey].videos[videoId] 114 const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID]
115 115
116 requestsToMakeGrouped[hashKey].datas.push({ 116 requestsToMakeGrouped[hashKey].datas.push({
117 data: videoData 117 data: videoData