Implements the phantombot youtube player into nodecg
To install the bundle, you must have first installed NodeJS and npm. Also make sure Git is installed
Create an install directory for NodeCG. on linux: mkdir nodecg
Install the NodeCG cli npm install -g nodecg-cli
CD into the NodeCG directory cd nodecg
Run these commands
nodecg setup
nodecg install jksessions/phantombot-youtube-nodecg
cd bundles/phantombot-youtube-nodecg
nodecg defaultconfig
npm run bild
Edit the config file created in the nodecg install directory .cfg/phantombot-youtube-nodecg.json
.
This MUST be changed in order to run the bundle.
Then your ready to start. Go the the install directory and run nodecg start
.
NodeCG has replicants. This bundle uses replicants in order to share data between files. Refer to the NodeCG docs.
The replicants open are: websocket
, youtubeSonglist
, youtubePlaylist
, youtubeCurrentSong
, youtubePlayPause
, youtubePlayState
, youtubeVolume
, youtubePlayerReady
, youtubeMute
and youtubeDuration
Returns true
or false
[{
"song":"A5UXA4fKSME",
"title":"WIN THE RACE On Drums!",
"duration":"03:55",
"requester":"jksessions"
},
...
]
song
is the youtube id of the track cued.
title
as stated, the title of the song.
duration
how long the given track is.
requester
who sends the request.
Sends the following
{
"playlistname": "default",
"playlist": [{
"song": "E4R14RpWIi0",
"title": "Friends (Hyper Potions) | Concert Band | Sonic Mania",
"duration": "03:16"
},
...
]
}
playlistname
is the name of the playlist, usually default.
playlist
contains the array of the playlist.
song
is the youtube id of the track cued.
title
as stated, the title of the song.
duration
how long the given track is.
{
"id":"YS2-v6nqYQg",
"title":"The Super Mario Super Medley - A Collaborative Musical Tribute to the History of Mario | FamilyJules",
"user":"jksessions",
"duration":"19:21"}
id
is the youtube id of the track cued.
title
as stated, the title of the song.
user
who sends the request.
duration
how long the given track is.
Returns true
or false
Returns an integer
-1 - Unstarted
0 - Ended
1 - Playing
2 - Paused
3 - Buffering
5 - Video Cued // Not used in current implementation
Refer to the Youtube player API Reference
Returns an integer between 0-100
Returns true
or false
Returns true
or false
returns the following
{
"current":271.0033450915527,
"max":1160.181
}
current
is the amount of time (seconds) into the track.
max
is the amount of time (seconds) that the track plays for.
The bundle also uses NodeCG's sendMessage()
function in order to forward data onto the websocket.
Straight commands without arguments are 'skipSong'
, 'stealSong'
, 'unstealSong'
and 'shufflePlaylist'
.
Command with variables are 'setVolume'
, 'updateSong'
, 'removeSongFromPlaylist'
, 'addSongToPlaylist'
, 'removeSongFromRequest'
, 'addSongToQueue'
, 'dbQuery'
and 'dbUpdate'
.
value
integer between 0-100
value
is the youtube id of the track cued.
value
is the youtube id of the track cued.
value
is the youtube id of the track cued.
value
is the youtube id of the track cued.
value
is the youtube id of the track cued.
Sent as the following
{
command: 'dbQuery',
callback_id: 'yt_settings',
table: 'ytSettings'
}
callback_id
is the id it uses to return data.
table
is the SQLLite table it references to.
This does send a message with the given table.
Sent as the following
{
command: 'dbUpdate',
callback_id: 'max_song_up',
table: 'ytSettings',
key: 'songRequestsMaxParallel',
value: String(maxDuration)
}
callback_id
the id it references to if a callback is needed.
table
is the SQLLite table it writes to.
key
is the datapoint to change.
value
is the data to put in.