jbilcke-hf HF staff commited on
Commit
89425e6
·
1 Parent(s): 21c1773

we are good I think

Browse files
scripts/channel_documentary.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ echo "Starting FFMPEG live stream for channel documentary"
4
+ while true; do
5
+ if [ -f channel_documentary.txt ] && [ -f channel_1_audio.txt ]; then
6
+ echo "Files exist, starting stream"
7
+ # Note: for now we also use channel 1 for audio!
8
+ ffmpeg -y -nostdin -re -f concat -safe 0 -i channel_documentary.txt -stream_loop -1 -safe 0 -i channel_1_audio.txt -loglevel error -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -shortest -f flv rtmp://localhost/live/documentary
9
+ else
10
+ echo "Files do not exist, waiting for files"
11
+ sleep 1 # check every second
12
+ fi
13
+ done
scripts/channel_random.sh CHANGED
@@ -3,10 +3,10 @@
3
  echo "Starting FFMPEG live stream for channel random"
4
  while true; do
5
  # TODO use channel_random.txt
6
- if [ -f channel_3_video.txt ] && [ -f channel_1_audio.txt ]; then
7
  echo "Files exist, starting stream"
8
  # Note: for now we also use channel 1 for audio!
9
- ffmpeg -y -nostdin -re -f concat -safe 0 -i channel_3_video.txt -stream_loop -1 -safe 0 -i channel_1_audio.txt -loglevel error -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -shortest -f flv rtmp://localhost/live/random
10
  else
11
  echo "Files do not exist, waiting for files"
12
  sleep 1 # check every second
 
3
  echo "Starting FFMPEG live stream for channel random"
4
  while true; do
5
  # TODO use channel_random.txt
6
+ if [ -f channel_random.txt ] && [ -f channel_1_audio.txt ]; then
7
  echo "Files exist, starting stream"
8
  # Note: for now we also use channel 1 for audio!
9
+ ffmpeg -y -nostdin -re -f concat -safe 0 -i channel_random.txt -stream_loop -1 -safe 0 -i channel_1_audio.txt -loglevel error -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -shortest -f flv rtmp://localhost/live/random
10
  else
11
  echo "Files do not exist, waiting for files"
12
  sleep 1 # check every second
src/updatePlaylists.mts CHANGED
@@ -23,7 +23,7 @@ export const updatePlaylists = async (db: Database) => {
23
  randomData += `file '${filePath}'\n`
24
  })
25
  await fs.promises.writeFile("channel_random.txt", randomData)
26
- console.log("Created playlist channel_random.txt")
27
 
28
  console.log("Generating playlist for the last files..")
29
  // Filter the list for the last 400 updated files
@@ -42,7 +42,7 @@ export const updatePlaylists = async (db: Database) => {
42
  freshData += `file '${filePath}'\n`
43
  })
44
  await fs.promises.writeFile("channel_fresh.txt", freshData)
45
- console.log("Created playlist channel_fresh.txt")
46
 
47
 
48
  // Record of file paths categorized by tags
@@ -73,15 +73,14 @@ export const updatePlaylists = async (db: Database) => {
73
  }
74
  }
75
 
 
76
  // Print the stats
77
  for (const [category, filePaths] of Object.entries(categoryToFilePaths)) {
78
- console.log(
79
- `Category: ${category}; Number of Files: ${filePaths.length}; Files: ${filePaths.join(
80
- ", "
81
- )}`
82
- )
83
  }
84
 
 
 
85
  // create the new playlists
86
  for (const [category, filePaths] of Object.entries(categoryToFilePaths)) {
87
  if (filePaths.length > 0) {
 
23
  randomData += `file '${filePath}'\n`
24
  })
25
  await fs.promises.writeFile("channel_random.txt", randomData)
26
+ console.log(`Created playlist channel_random.txt with ${allFilePaths} entries`)
27
 
28
  console.log("Generating playlist for the last files..")
29
  // Filter the list for the last 400 updated files
 
42
  freshData += `file '${filePath}'\n`
43
  })
44
  await fs.promises.writeFile("channel_fresh.txt", freshData)
45
+ console.log(`Created playlist channel_fresh.txt with ${lastUpdatedFilePaths} entries`)
46
 
47
 
48
  // Record of file paths categorized by tags
 
73
  }
74
  }
75
 
76
+ const stats: Record<string, number> = {}
77
  // Print the stats
78
  for (const [category, filePaths] of Object.entries(categoryToFilePaths)) {
79
+ stats[category] = filePaths.length
 
 
 
 
80
  }
81
 
82
+ console.log(`NB FILES PER CATEGORY: ${JSON.stringify(stats, null, 2)}`)
83
+
84
  // create the new playlists
85
  for (const [category, filePaths] of Object.entries(categoryToFilePaths)) {
86
  if (filePaths.length > 0) {
start.sh CHANGED
@@ -29,7 +29,7 @@ bash scripts/audio1.sh &
29
  # bash scripts/audio2.sh &
30
 
31
  # [LEGACY] background process that creates a video stream from video files
32
- bash scripts/legacy_video3.sh &
33
 
34
  sleep 1
35
 
@@ -37,6 +37,7 @@ sleep 1
37
  bash scripts/channel_random.sh &
38
  bash scripts/channel_random_twitch.sh &
39
  bash scripts/channel_comedy.sh &
 
40
 
41
  sleep 1
42
 
 
29
  # bash scripts/audio2.sh &
30
 
31
  # [LEGACY] background process that creates a video stream from video files
32
+ # bash scripts/legacy_video3.sh &
33
 
34
  sleep 1
35
 
 
37
  bash scripts/channel_random.sh &
38
  bash scripts/channel_random_twitch.sh &
39
  bash scripts/channel_comedy.sh &
40
+ bash scripts/channel_documentary.sh &
41
 
42
  sleep 1
43