aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/models/video.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/models/video.js b/server/models/video.js
index 0eef4114c..029cb6d7c 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -544,11 +544,7 @@ function listForApi (start, count, sort, callback) {
544 544
545 this.sequelize.models.Tag 545 this.sequelize.models.Tag
546 ], 546 ],
547 where: { 547 where: createBaseVideosWhere.call(this)
548 id: { $notIn: this.sequelize.literal(
549 '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
550 )}
551 }
552 } 548 }
553 549
554 return this.findAndCountAll(query).asCallback(function (err, result) { 550 return this.findAndCountAll(query).asCallback(function (err, result) {
@@ -656,11 +652,7 @@ function searchAndPopulateAuthorAndPodAndTags (value, field, start, count, sort,
656 } 652 }
657 653
658 const query = { 654 const query = {
659 where: { 655 where: createBaseVideosWhere.call(this),
660 id: { $notIn: this.sequelize.literal(
661 '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
662 )}
663 },
664 offset: start, 656 offset: start,
665 limit: count, 657 limit: count,
666 distinct: true, // For the count, a video can have many tags 658 distinct: true, // For the count, a video can have many tags
@@ -715,6 +707,16 @@ function searchAndPopulateAuthorAndPodAndTags (value, field, start, count, sort,
715 707
716// --------------------------------------------------------------------------- 708// ---------------------------------------------------------------------------
717 709
710function createBaseVideosWhere () {
711 return {
712 id: {
713 $notIn: this.sequelize.literal(
714 '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
715 )
716 }
717 }
718}
719
718function removeThumbnail (video, callback) { 720function removeThumbnail (video, callback) {
719 const thumbnailPath = pathUtils.join(constants.CONFIG.STORAGE.THUMBNAILS_DIR, video.getThumbnailName()) 721 const thumbnailPath = pathUtils.join(constants.CONFIG.STORAGE.THUMBNAILS_DIR, video.getThumbnailName())
720 fs.unlink(thumbnailPath, callback) 722 fs.unlink(thumbnailPath, callback)