jbilcke-hf HF staff commited on
Commit
fad0005
·
1 Parent(s): 36cf416

update stats file

Browse files
Files changed (2) hide show
  1. src/getStats.mts +29 -6
  2. src/index.mts +1 -2
src/getStats.mts CHANGED
@@ -1,13 +1,36 @@
1
  import { promises as fs } from 'node:fs'
2
 
3
  export const getStats = async () => {
4
- const videoFilePaths = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_NEXT)
5
- const legacyVideoFilePaths = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH)
6
- const legacyAudioFilePaths = await fs.readdir(process.env.WEBTV_AUDIO_STORAGE_PATH)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  return {
9
- nbVideoFiles: videoFilePaths.length,
10
- nbLegacyVideoFiles: legacyVideoFilePaths.length,
11
- nbLegacyAudioFiles: legacyAudioFilePaths.length,
 
 
12
  }
13
  }
 
1
  import { promises as fs } from 'node:fs'
2
 
3
  export const getStats = async () => {
4
+ let nbVideos1 = 0
5
+ let nbVideos2 = 0
6
+ let nbVideos3 = 0
7
+ let nbVideos4 = 0
8
+
9
+ try {
10
+ const video1 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_1)
11
+ nbVideos1 = video1.length
12
+ } catch (err) {}
13
+
14
+ try {
15
+ const video2 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_2)
16
+ nbVideos2 = video2.length
17
+ } catch (err) {}
18
+
19
+ try {
20
+ const video3 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_3)
21
+ nbVideos3 = video3.length
22
+ } catch (err) {}
23
+
24
+ try {
25
+ const video4 = await fs.readdir(process.env.WEBTV_VIDEO_STORAGE_PATH_CHANNEL_4)
26
+ nbVideos4 = video4.length
27
+ } catch (err) {}
28
 
29
  return {
30
+ nbVideos1,
31
+ nbVideos2,
32
+ nbVideos3,
33
+ nbVideos4,
34
+
35
  }
36
  }
src/index.mts CHANGED
@@ -31,9 +31,8 @@ const main = async () => {
31
 
32
  console.log('Reading persistent file structure..')
33
  const stats = await getStats()
34
- console.log(`New format: We have ${stats.nbVideoFiles} video files`)
35
 
36
- console.log(`Legacy: We have ${stats.nbLegacyVideoFiles} video files and ${stats.nbLegacyAudioFiles} audio files`)
37
 
38
  console.log('Reading prompt database..')
39
  const db = await getDatabase('./database.json')
 
31
 
32
  console.log('Reading persistent file structure..')
33
  const stats = await getStats()
 
34
 
35
+ console.log('nb files:', JSON.stringify(stats, null, 2))
36
 
37
  console.log('Reading prompt database..')
38
  const db = await getDatabase('./database.json')