From 9f79ade627f0044606a9fbbe16ca0154661d12b9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Mar 2019 14:13:53 +0100 Subject: Refresh playlists --- server/controllers/api/video-playlist.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/controllers') diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 5b1601c4e..feba30564 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -40,6 +40,7 @@ import { VideoPlaylistElementUpdate } from '../../../shared/models/videos/playli import { copy, pathExists } from 'fs-extra' import { AccountModel } from '../../models/account/account' import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' +import { JobQueue } from '../../lib/job-queue' const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) @@ -142,6 +143,11 @@ async function listVideoPlaylists (req: express.Request, res: express.Response) function getVideoPlaylist (req: express.Request, res: express.Response) { const videoPlaylist = res.locals.videoPlaylist + if (videoPlaylist.isOutdated()) { + JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: videoPlaylist.url } }) + .catch(err => logger.error('Cannot create AP refresher job for playlist %s.', videoPlaylist.url, { err })) + } + return res.json(videoPlaylist.toFormattedJSON()) } -- cgit v1.2.3