-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmitry
committed
Aug 14, 2024
1 parent
fa3ebc8
commit 5c986bc
Showing
13 changed files
with
191 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = crlf | ||
indent_style = tab | ||
tab_width = 3 | ||
max_line_length = 80 | ||
insert_final_newline = true | ||
|
||
[*.{json,yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
{ | ||
"tabWidth": 3, | ||
"singleQuote": false, | ||
"semi": true, | ||
"overrides": [ | ||
{ | ||
"files": ["*.yml", "*.json"], | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
"semi": true, | ||
"singleQuote": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { audioSocketHandler } from "./socket-handlers/audio.js"; | ||
|
||
export const main = (io) => { | ||
const onConnection = (socket) => { | ||
audioSocketHandler(socket); | ||
}; | ||
const onConnection = (socket) => { | ||
audioSocketHandler(socket); | ||
}; | ||
|
||
io.on("connection", onConnection); | ||
io.on("connection", onConnection); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import fs from "fs"; | ||
|
||
export const getAudioData = (filePath) => { | ||
const data = fs.readFileSync(filePath).toString(); | ||
const dataJSON = JSON.parse(data); | ||
return dataJSON; | ||
const data = fs.readFileSync(filePath).toString(); | ||
const dataJSON = JSON.parse(data); | ||
return dataJSON; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { getAudioData } from "./get-audio-data.js"; | ||
|
||
export const getMusicPause = async () => { | ||
const musicPauses = await getAudioData("./audio-data/music-pauses.json"); | ||
const musicPauses = await getAudioData("./audio-data/music-pauses.json"); | ||
|
||
const count = Object.keys(musicPauses).length; | ||
const number = Math.floor(Math.random() * count); | ||
const musicPause = musicPauses[number]; | ||
return musicPause; | ||
const count = Object.keys(musicPauses).length; | ||
const number = Math.floor(Math.random() * count); | ||
const musicPause = musicPauses[number]; | ||
return musicPause; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { getAudioData } from "./get-audio-data.js"; | ||
|
||
export const getSong = async () => { | ||
const songs = await getAudioData("./audio-data/songs.json"); | ||
const songs = await getAudioData("./audio-data/songs.json"); | ||
|
||
const authors = Object.keys(songs); | ||
const authorsCount = Object.keys(authors).length; | ||
const authorNumber = Math.floor(Math.random() * authorsCount); | ||
const authorName = authors[authorNumber]; | ||
const author = songs[authorName]; | ||
const authors = Object.keys(songs); | ||
const authorsCount = Object.keys(authors).length; | ||
const authorNumber = Math.floor(Math.random() * authorsCount); | ||
const authorName = authors[authorNumber]; | ||
const author = songs[authorName]; | ||
|
||
const songsCount = author.length; | ||
const songNumber = Math.floor(Math.random() * songsCount); | ||
const song = author[songNumber]; | ||
const name = song.name; | ||
const url = song.url; | ||
const songsCount = author.length; | ||
const songNumber = Math.floor(Math.random() * songsCount); | ||
const song = author[songNumber]; | ||
const name = song.name; | ||
const url = song.url; | ||
|
||
const songData = { | ||
url, | ||
name, | ||
authorName, | ||
}; | ||
const songData = { | ||
url, | ||
name, | ||
authorName, | ||
}; | ||
|
||
return songData; | ||
return songData; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.