+ static async getStats () {
+ const totalLocalVideos = await VideoModel.count({
+ where: {
+ remote: false
+ }
+ })
+ const totalVideos = await VideoModel.count()
+
+ let totalLocalVideoViews = await VideoModel.sum('views', {
+ where: {
+ remote: false
+ }
+ })
+ // Sequelize could return null...
+ if (!totalLocalVideoViews) totalLocalVideoViews = 0
+
+ return {
+ totalLocalVideos,
+ totalLocalVideoViews,
+ totalVideos
+ }
+ }
+
+ private static buildActorWhereWithFilter (filter?: VideoFilter) {
+ if (filter && filter === 'local') {
+ return {
+ serverId: null
+ }
+ }
+
+ return {}
+ }
+
+ private static getCategoryLabel (id: number) {
+ let categoryLabel = VIDEO_CATEGORIES[id]
+ if (!categoryLabel) categoryLabel = 'Misc'
+
+ return categoryLabel
+ }
+
+ private static getLicenceLabel (id: number) {
+ let licenceLabel = VIDEO_LICENCES[id]
+ if (!licenceLabel) licenceLabel = 'Unknown'
+
+ return licenceLabel
+ }
+
+ private static getLanguageLabel (id: number) {
+ let languageLabel = VIDEO_LANGUAGES[id]
+ if (!languageLabel) languageLabel = 'Unknown'
+
+ return languageLabel
+ }
+