File size: 1,248 Bytes
07ae658
 
 
fad0005
 
 
80c5d2a
fad0005
80c5d2a
fad0005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80c5d2a
 
 
 
 
fad0005
 
 
 
07ae658
80c5d2a
 
 
 
 
07ae658
fad0005
 
 
80c5d2a
fad0005
80c5d2a
fad0005
07ae658
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { promises as fs } from 'node:fs'

export const getStats = async () => {
  let nbVideos1 = 0
  let nbVideos2 = 0
  let nbVideos3 = 0
  let nbArchivedVideos3 = 0
  let nbVideos4 = 0
  let nbArchivedVideos4 = 0

  try {
    const video1 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_1)
    nbVideos1 = video1.length
  } catch (err) {}

  try {
    const video2 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_2)
    nbVideos2 = video2.length
  } catch (err) {}

  try {
    const video3 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_3)
    nbVideos3 = video3.length
  } catch (err) {}

  try {
    const archivedVideo3 = await fs.readdir(process.env.WEBTV_VIDEO_ARCHIVE_PATH_CHANNEL_3)
    nbArchivedVideos3 = archivedVideo3.length
  } catch (err) {}

  try {
    const video4 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_4)
    nbVideos4 = video4.length
  } catch (err) {}

  try {
    const archivedVideo4 = await fs.readdir(process.env.WEBTV_VIDEO_ARCHIVE_PATH_CHANNEL_4)
    nbArchivedVideos4 = archivedVideo4.length
  } catch (err) {}

  return {
     nbVideos1,
     nbVideos2,
     nbVideos3,
     nbArchivedVideos3,
     nbVideos4,
     nbArchivedVideos4,
  
  }
}