jbilcke-hf HF staff commited on
Commit
2feb1a6
1 Parent(s): f28a151
Files changed (5) hide show
  1. database.json +11 -26
  2. package.json +1 -0
  3. scripts/channel_sf.sh +13 -0
  4. src/twitchBot.mts +30 -3
  5. start.sh +1 -1
database.json CHANGED
@@ -10,7 +10,7 @@
10
  "audioPrompt": "electronic goal music from the 90s",
11
  "tags": [
12
  "trailer",
13
- "cgi"
14
  ],
15
  "channel": "main",
16
  "shots": [
@@ -164,7 +164,7 @@
164
  "audioPrompt": "electronic goal music from the 90s",
165
  "tags": [
166
  "trailer",
167
- "cgi"
168
  ],
169
  "channel": "main",
170
  "shots": [
@@ -430,8 +430,7 @@
430
  "audioPrompt": "energic pop cinematic orchestra",
431
  "tags": [
432
  "trailer",
433
- "comedy",
434
- "animation"
435
  ],
436
  "channel": "main",
437
  "shots": [
@@ -529,8 +528,7 @@
529
  "audioPrompt": "electronic ambient music",
530
  "tags": [
531
  "trailer",
532
- "comedy",
533
- "animation"
534
  ],
535
  "channel": "main",
536
  "shots": [
@@ -902,9 +900,6 @@
902
  "audioPrompt": "intense and fast-paced electronic and orchestra music for a space opera with synthetisers, electronic drum machine",
903
  "tags": [
904
  "trailer",
905
- "comedy",
906
- "action",
907
- "adventure",
908
  "science-fiction"
909
  ],
910
  "channel": "main",
@@ -1535,9 +1530,7 @@
1535
  "audioPrompt": "fast-paced combat music with guitars rifss and electronic drum loop",
1536
  "tags": [
1537
  "trailer",
1538
- "comedy",
1539
- "animation",
1540
- "action"
1541
  ],
1542
  "channel": "main",
1543
  "shots": [
@@ -1635,9 +1628,6 @@
1635
  "audioPrompt": "intense and fast-paced electronic and orchestra music with synthetisers, electronic drum machine",
1636
  "tags": [
1637
  "trailer",
1638
- "comedy",
1639
- "action",
1640
- "adventure",
1641
  "science-fiction"
1642
  ],
1643
  "channel": "main",
@@ -1722,9 +1712,6 @@
1722
  "audioPrompt": "intense and fast-paced electronic and orchestra music for a space opera with synthetisers, electronic drum machine",
1723
  "tags": [
1724
  "trailer",
1725
- "comedy",
1726
- "action",
1727
- "adventure",
1728
  "science-fiction"
1729
  ],
1730
  "channel": "main",
@@ -1964,8 +1951,7 @@
1964
  "audioPrompt": "soundtrack for a movie, with orchestra, calming, whale sounds and wood drums, flute",
1965
  "tags": [
1966
  "trailer",
1967
- "animation",
1968
- "adventure"
1969
  ],
1970
  "channel": "main",
1971
  "shots": [
@@ -2049,7 +2035,6 @@
2049
  "audioPrompt": "soundtrack for an action movie, energetic, fast-paced, drums, trumpet, strings, safari animals",
2050
  "tags": [
2051
  "trailer",
2052
- "action",
2053
  "adventure"
2054
  ],
2055
  "channel": "main",
@@ -2220,8 +2205,7 @@
2220
  "audioPrompt": "soundtrack for an action movie, energetic, fast-paced, drums, trumpet, strings, safari animals",
2221
  "tags": [
2222
  "trailer",
2223
- "action",
2224
- "adventure"
2225
  ],
2226
  "channel": "main",
2227
  "shots": [
@@ -2430,7 +2414,6 @@
2430
  "audioPrompt": "epic music for a pirate movie, lot of energy, adventure, action",
2431
  "tags": [
2432
  "trailer",
2433
- "action",
2434
  "adventure"
2435
  ],
2436
  "channel": "main",
@@ -5302,7 +5285,8 @@
5302
  "videoPrompt": "a 3D film similar to Pixar movies, with a rat in New York",
5303
  "audioPrompt": "ambient deep house, drum machine, synth",
5304
  "tags": [
5305
- "trailer"
 
5306
  ],
5307
  "channel": "main",
5308
  "shots": [
@@ -6483,7 +6467,8 @@
6483
  "videoPrompt": "an anime movie in the style of Studio Ghibli and Miyazaki, showing a magical panda becoming friend with a black cat. The panda can transform into various people and objects. Set in feudal japan, they go on adventures in beautiful japanese landscape. We can see leaves of cherry blossom, beautify japanese mountains, plains, rivers, traditional japanese settings. In nearly all scenes we should have dynamic camera effects (eg. rotating around the scene), as well as mist, haze or fog effect. To add to the mystic, each some scenes should have dramatic light effects, such as golden hour, god's ray.",
6484
  "audioPrompt": "ambient deep house, drum machine, synth",
6485
  "tags": [
6486
- "trailer"
 
6487
  ],
6488
  "channel": "main",
6489
  "shots": [
 
10
  "audioPrompt": "electronic goal music from the 90s",
11
  "tags": [
12
  "trailer",
13
+ "abstract"
14
  ],
15
  "channel": "main",
16
  "shots": [
 
164
  "audioPrompt": "electronic goal music from the 90s",
165
  "tags": [
166
  "trailer",
167
+ "abstract"
168
  ],
169
  "channel": "main",
170
  "shots": [
 
430
  "audioPrompt": "energic pop cinematic orchestra",
431
  "tags": [
432
  "trailer",
433
+ "comedy"
 
434
  ],
435
  "channel": "main",
436
  "shots": [
 
528
  "audioPrompt": "electronic ambient music",
529
  "tags": [
530
  "trailer",
531
+ "comedy"
 
532
  ],
533
  "channel": "main",
534
  "shots": [
 
900
  "audioPrompt": "intense and fast-paced electronic and orchestra music for a space opera with synthetisers, electronic drum machine",
901
  "tags": [
902
  "trailer",
 
 
 
903
  "science-fiction"
904
  ],
905
  "channel": "main",
 
1530
  "audioPrompt": "fast-paced combat music with guitars rifss and electronic drum loop",
1531
  "tags": [
1532
  "trailer",
1533
+ "comedy"
 
 
1534
  ],
1535
  "channel": "main",
1536
  "shots": [
 
1628
  "audioPrompt": "intense and fast-paced electronic and orchestra music with synthetisers, electronic drum machine",
1629
  "tags": [
1630
  "trailer",
 
 
 
1631
  "science-fiction"
1632
  ],
1633
  "channel": "main",
 
1712
  "audioPrompt": "intense and fast-paced electronic and orchestra music for a space opera with synthetisers, electronic drum machine",
1713
  "tags": [
1714
  "trailer",
 
 
 
1715
  "science-fiction"
1716
  ],
1717
  "channel": "main",
 
1951
  "audioPrompt": "soundtrack for a movie, with orchestra, calming, whale sounds and wood drums, flute",
1952
  "tags": [
1953
  "trailer",
1954
+ "comedy"
 
1955
  ],
1956
  "channel": "main",
1957
  "shots": [
 
2035
  "audioPrompt": "soundtrack for an action movie, energetic, fast-paced, drums, trumpet, strings, safari animals",
2036
  "tags": [
2037
  "trailer",
 
2038
  "adventure"
2039
  ],
2040
  "channel": "main",
 
2205
  "audioPrompt": "soundtrack for an action movie, energetic, fast-paced, drums, trumpet, strings, safari animals",
2206
  "tags": [
2207
  "trailer",
2208
+ "comedy"
 
2209
  ],
2210
  "channel": "main",
2211
  "shots": [
 
2414
  "audioPrompt": "epic music for a pirate movie, lot of energy, adventure, action",
2415
  "tags": [
2416
  "trailer",
 
2417
  "adventure"
2418
  ],
2419
  "channel": "main",
 
5285
  "videoPrompt": "a 3D film similar to Pixar movies, with a rat in New York",
5286
  "audioPrompt": "ambient deep house, drum machine, synth",
5287
  "tags": [
5288
+ "trailer",
5289
+ "comedy"
5290
  ],
5291
  "channel": "main",
5292
  "shots": [
 
6467
  "videoPrompt": "an anime movie in the style of Studio Ghibli and Miyazaki, showing a magical panda becoming friend with a black cat. The panda can transform into various people and objects. Set in feudal japan, they go on adventures in beautiful japanese landscape. We can see leaves of cherry blossom, beautify japanese mountains, plains, rivers, traditional japanese settings. In nearly all scenes we should have dynamic camera effects (eg. rotating around the scene), as well as mist, haze or fog effect. To add to the mystic, each some scenes should have dramatic light effects, such as golden hour, god's ray.",
6468
  "audioPrompt": "ambient deep house, drum machine, synth",
6469
  "tags": [
6470
+ "trailer",
6471
+ "comedy"
6472
  ],
6473
  "channel": "main",
6474
  "shots": [
package.json CHANGED
@@ -5,6 +5,7 @@
5
  "main": "src/index.mts",
6
  "scripts": {
7
  "start": "node --loader ts-node/esm src/index.mts",
 
8
  "batch:interpolate": "node --loader ts-node/esm src/batch/interpolate_legacy.mts",
9
  "docker": "npm run docker:build && npm run docker:run",
10
  "docker:build": "docker build -t media-server .",
 
5
  "main": "src/index.mts",
6
  "scripts": {
7
  "start": "node --loader ts-node/esm src/index.mts",
8
+ "bot": "node --loader ts-node/esm src/twitchBot.mts",
9
  "batch:interpolate": "node --loader ts-node/esm src/batch/interpolate_legacy.mts",
10
  "docker": "npm run docker:build && npm run docker:run",
11
  "docker:build": "docker build -t media-server .",
scripts/channel_sf.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ echo "Starting FFMPEG live stream for channel sf"
4
+ while true; do
5
+ if [ -f channel_sf.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_science-fiction.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/sf
9
+ else
10
+ echo "Files do not exist, waiting for files"
11
+ sleep 1 # check every second
12
+ fi
13
+ done
src/twitchBot.mts CHANGED
@@ -1,10 +1,23 @@
1
  import { ChatClient } from "@kararty/dank-twitch-irc"
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  const client = new ChatClient({
4
- username: process.env.WEBTV_TWITCH_USERNAME,
5
- password: `oauth:${process.env.WEBTV_TWITCH_API_KEY}`,
6
  })
7
 
 
 
8
  client.on("ready", () => {
9
  console.log("Successfully connected to chat")
10
  })
@@ -17,8 +30,22 @@ client.on("close", (error) => {
17
 
18
  client.on("PRIVMSG", (msg) => {
19
  console.log(`[#${msg.channelName}] ${msg.displayName}: ${msg.messageText}`)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  })
21
 
22
  // See below for more events
23
  client.connect()
24
- client.join("flngr")
 
1
  import { ChatClient } from "@kararty/dank-twitch-irc"
2
 
3
+ const promptQueue: string[] = []
4
+
5
+ const lowerCaseName = process.env.WEBTV_TWITCH_BOT_USERNAME
6
+ const username = lowerCaseName
7
+ const channel = lowerCaseName
8
+
9
+ const fullCaseName = "AI_WebTV"
10
+
11
+ // https://dev.twitch.tv/docs/irc/authenticate-bot/
12
+ // ex to generate a token:
13
+ // https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=<CLIENTID>&redirect_uri=http://localhost&scope=chat%3Aread+chat%3Aedit
14
  const client = new ChatClient({
15
+ username,
16
+ password: `oauth:${process.env.WEBTV_TWITCH_BOT_TOKEN}`,
17
  })
18
 
19
+
20
+
21
  client.on("ready", () => {
22
  console.log("Successfully connected to chat")
23
  })
 
30
 
31
  client.on("PRIVMSG", (msg) => {
32
  console.log(`[#${msg.channelName}] ${msg.displayName}: ${msg.messageText}`)
33
+ const words = msg.messageText.split(" ")
34
+ const [command, ...rest] = words
35
+
36
+ if (msg.channelName === channel && words.includes(`@${fullCaseName}`)) {
37
+ console.log("We have been directly mentioned")
38
+ // client.say(channel, "yes, my lord?")
39
+ // TODO: we should use a chatbot eg. HuggingChat to add prompts to the queue
40
+
41
+ if (command === "!queue") {
42
+ client.say(channel, `there are ${promptQueue.length} prompts in the queue`)
43
+ } else if (command === "!add") {
44
+ client.say(channel, "adding prompts to the queue isn't supported yet")
45
+ }
46
+ }
47
  })
48
 
49
  // See below for more events
50
  client.connect()
51
+ client.join("ai_webtv")
start.sh CHANGED
@@ -5,7 +5,7 @@ bash ./scripts/init.sh
5
 
6
  # ------------ UPDATE MUSIC ------------
7
  # echo "skipping new music download"
8
- # bash scripts/download_fresh_music.sh
9
 
10
  # ---------- CONTENT ALIGNMENT ---------
11
  # bash scripts/censorship.sh
 
5
 
6
  # ------------ UPDATE MUSIC ------------
7
  # echo "skipping new music download"
8
+ bash scripts/download_fresh_music.sh
9
 
10
  # ---------- CONTENT ALIGNMENT ---------
11
  # bash scripts/censorship.sh