init commit
This commit is contained in:
350
libs/phantombot/web/playlist/css/style.css
Normal file
350
libs/phantombot/web/playlist/css/style.css
Normal file
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2020 phantombot.github.io/PhantomBot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#logo {
|
||||
height: 65px;
|
||||
margin-left: 15px;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
margin-top: 17px;
|
||||
}
|
||||
|
||||
.container {
|
||||
position:relative;
|
||||
padding:0 0 0 25px;
|
||||
}
|
||||
|
||||
#container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: #6441a5;
|
||||
margin-top: -20px;
|
||||
margin-bottom: 10px;
|
||||
max-width: 100%;
|
||||
height: 85px;
|
||||
-webkit-box-shadow: 0 3px 5px #000;
|
||||
-moz-box-shadow: 0 3px 5px #000;
|
||||
box-shadow: 0 3px 5px #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #6441a5;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: rgb(20, 20, 20);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: white;
|
||||
padding-top: 20px;
|
||||
margin-left: 15px;
|
||||
font-size: 26px;
|
||||
font-family: "Roboto", arial, sans-serif;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.chat {
|
||||
width: 300px;
|
||||
height: 600px;
|
||||
padding-top: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.chatFrame {
|
||||
border-style: solid;
|
||||
border-color: #6441a5;
|
||||
height: 600px;
|
||||
width: 300px;
|
||||
order: 1;
|
||||
}
|
||||
|
||||
#main {
|
||||
display: inline;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
width: 720px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
#player {
|
||||
vertical-align: middle;
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
|
||||
option:hover {
|
||||
background-color:#cd201f;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#selected {
|
||||
background-color: #000;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: Transparent;
|
||||
background-repeat: no-repeat;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#songlist {
|
||||
display: inline;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#playlist {
|
||||
display: inline;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
#copyright {
|
||||
font-family: "Roboto", arial, sans-serif;
|
||||
display: inline;
|
||||
float: left;
|
||||
width: 100%;
|
||||
background-color: rgb(34, 34, 34);
|
||||
color: grey;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
#playerLink {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#currentSong {
|
||||
background-color: #444444;
|
||||
color: #ffffff;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.currentSong-small {
|
||||
color: #ffffff;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#currentSongTable tr:nth-child(even) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #CCC;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#currentSongTable tr:nth-child(odd) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #FFF;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#currentSongTable td {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#currentSongTable th {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
#songTable tr:nth-child(even) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #CCC;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#songTable tr:nth-child(odd) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #FFF;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#songTable td {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#songTable th {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#playerTable tr {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #444444;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#playerTable td {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.songTableTitle {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #7451b5;
|
||||
color: white;
|
||||
font-size:14px;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#playlistTableTitle {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #7451b5;
|
||||
color: white;
|
||||
font-size:14px;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#playlistTable tr:nth-child(even) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #CCC;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#playlistTable tr:nth-child(odd) {
|
||||
font-family: "Roboto", sans-serif;
|
||||
background: #FFF;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#playlistTable td {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#playlistTable th {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#songProgressBar {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#volumeControl {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.controlTable {
|
||||
box-shadow: 10px 10px 5px #111111;
|
||||
background-color: #333333;
|
||||
margin-top: 20px;
|
||||
width: 300px;
|
||||
}
|
||||
.controlTable td {
|
||||
background-color: #333333;
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ui-slider .ui-slider-handle {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.alert-danger {
|
||||
clear: left;
|
||||
position: fixed;
|
||||
right: 15px;
|
||||
top: 14px;
|
||||
height: 40px;
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
clear: left;
|
||||
position: fixed;
|
||||
right: 15px;
|
||||
top: 14px;
|
||||
height: 40px;
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
color: #6441a5;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
background-color: #444444;
|
||||
color: #dddddd;
|
||||
}
|
||||
77
libs/phantombot/web/playlist/index.html
Normal file
77
libs/phantombot/web/playlist/index.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<!--
|
||||
|
||||
Copyright (C) 2016-2020 phantombot.github.io/PhantomBot
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>PhantomBot YouTube Player Playlist Viewer</title>
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/common/js/jquery-ui/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<script src="/common/js/jquery-ui/external/jquery/jquery.min.js"></script>
|
||||
<script src="/common/js/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="/playlist/js/playerConfig.js"></script>
|
||||
<script type="text/javascript" src="/playlist/js/ytPlaylist.js"></script>
|
||||
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="/playlist/css/style.css">
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="header">
|
||||
<img id="logo" alt="Logo" src="common/images/logo.png"/>
|
||||
<div id="newAlert" class="alert" style="display:none"></div>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: top">
|
||||
|
||||
<div id="currentsong">
|
||||
<div class="songTableTitle">Currently Playing</div>
|
||||
<table id="currentSongTable"> </table>
|
||||
</div>
|
||||
|
||||
<div id="songlist">
|
||||
<div class="songTableTitle">Song Request Queue</div>
|
||||
<table id="songTable"> </table>
|
||||
</div>
|
||||
|
||||
<div id="playlist">
|
||||
<div id="playlistTableTitle">Current Playlist</div>
|
||||
<table id="playlistTable"> </table>
|
||||
</div>
|
||||
|
||||
<div id="copyright">
|
||||
YouTube Player Playlist Viewer by:
|
||||
<a href="https://phantombot.github.io/PhantomBot">phantombot.github.io/PhantomBot</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
11
libs/phantombot/web/playlist/js/playerConfig.js
Normal file
11
libs/phantombot/web/playlist/js/playerConfig.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//Configuration for YTPlayer
|
||||
//Automatically Generated by PhantomBot at Startup
|
||||
//Do NOT Modify! Overwritten when PhantomBot is restarted!
|
||||
var playerPort = 25000;
|
||||
var channelName = "zino1337";
|
||||
var auth="ltxY1HsG0pV7Hthk3uX7STmuMRREpD";
|
||||
var http="https://";
|
||||
function getPlayerPort() { return playerPort; }
|
||||
function getChannelName() { return channelName; }
|
||||
function getAuth() { return auth; }
|
||||
function getProtocol() { return http; }
|
||||
167
libs/phantombot/web/playlist/js/ytPlaylist.js
Normal file
167
libs/phantombot/web/playlist/js/ytPlaylist.js
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2020 phantombot.github.io/PhantomBot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ytPlaylist.js
|
||||
* -------------
|
||||
* Produces a GUI for the playlists in YouTube Player
|
||||
*/
|
||||
var DEBUG_MODE = false;
|
||||
var connectedToWS = false;
|
||||
|
||||
var url = window.location.host.split(":");
|
||||
var addr = (getProtocol() === 'https://' || window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + '/ws/ytplayer';
|
||||
var connection = new WebSocket(addr, []);
|
||||
var currentVolume = 0;
|
||||
|
||||
function debugMsg(message) {
|
||||
if (DEBUG_MODE)
|
||||
console.log("ytPlaylist::DEBUG::" + message);
|
||||
}
|
||||
function logMsg(message) {
|
||||
console.log('ytPlaylist::' + message);
|
||||
}
|
||||
|
||||
connection.onopen = function (data) {
|
||||
var jsonObject = {};
|
||||
|
||||
debugMsg("connection.onopen()");
|
||||
connectedToWS = true;
|
||||
|
||||
jsonObject["authenticate"] = getAuth();
|
||||
connection.send(JSON.stringify(jsonObject));
|
||||
debugMsg("onPlayerReady::connection.send(" + JSON.stringify(jsonObject) + ")");
|
||||
}
|
||||
|
||||
connection.onclose = function (data) {
|
||||
debugMsg("connection.onclose()");
|
||||
connectedToWS = false;
|
||||
}
|
||||
|
||||
connection.onmessage = function (e) {
|
||||
try {
|
||||
var messageObject = JSON.parse(e.data);
|
||||
} catch (ex) {
|
||||
logMsg('connection.onmessage: badJson(' + e.data + '): ' + ex.message);
|
||||
return;
|
||||
}
|
||||
|
||||
debugMsg('connection.onmessage(' + e.data + ')');
|
||||
|
||||
if (messageObject.ping !== undefined) {
|
||||
connection.send(JSON.stringify({
|
||||
pong: "pong"
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageObject['authresult'] === 'false') {
|
||||
if (!messageObject['authresult']) {
|
||||
newAlert('WS Auth Failed', 'Reload page, if that fails, let the caster know', 'danger', 0);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (messageObject['authresult'] === 'true') {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
if (messageObject['command'] !== undefined) {
|
||||
if (messageObject['command']['play'] !== undefined) {
|
||||
handleNewSong(messageObject['command']['title'], messageObject['command']['duration'], messageObject['command']['requester']);
|
||||
refreshData();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (messageObject['currentsong'] !== undefined) {
|
||||
handleNewSong(messageObject['currentsong']['title'], messageObject['currentsong']['duration'],
|
||||
messageObject['currentsong']['requester'], messageObject['currentsong']['song']);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageObject['songlist'] !== undefined) {
|
||||
handleSongList(messageObject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageObject['playlist'] !== undefined) {
|
||||
handlePlayList(messageObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function handleNewSong(title, duration, requester, id) {
|
||||
debugMsg('handleNewSong(' + title + ', ' + duration + ', ' + requester + ')');
|
||||
$('#currentSongTable').html('<tr><th>Song Title</th><th>Requester</th><th>Duration</th><th>YouTube ID</th></tr>' +
|
||||
'<tr><td>' + title + '</td><td>' + requester + '</td><td>' + duration + '</td><td>' + id + '</td></tr>');
|
||||
}
|
||||
|
||||
function handlePlayList(d) {
|
||||
debugMsg('handlePlayList(' + d + ')');
|
||||
$('#playlistTableTitle').html('Current Playlist: ' + d['playlistname']);
|
||||
var tableData = '<tr><th>Song Title</th><th>Duration</th><th>YouTube ID</th></tr>';
|
||||
for (var i in d['playlist']) {
|
||||
var id = d['playlist'][i]['song'];
|
||||
var title = d['playlist'][i]['title'];
|
||||
var duration = d['playlist'][i]['duration'];
|
||||
tableData += '<tr><td>' + title + '</td><td>' + duration + '</td><td>' + id + '</td></tr>';
|
||||
}
|
||||
$('#playlistTable').html(tableData);
|
||||
}
|
||||
|
||||
function handleSongList(d) {
|
||||
debugMsg('handleSongList(' + d + ')');
|
||||
var tableData = '<tr><th>Song Title</th><th>Requester</th><th>Duration</th><th>YouTube ID</th></tr>';
|
||||
for (var i in d['songlist']) {
|
||||
var id = d['songlist'][i]['song'];
|
||||
var title = d['songlist'][i]['title'];
|
||||
var duration = d['songlist'][i]['duration'];
|
||||
var requester = d['songlist'][i]['requester'];
|
||||
tableData += '<tr><td>' + title + '</td><td>' + requester + '</td><td>' + duration + '</td><td>' + id + '</td></tr>';
|
||||
}
|
||||
$('#songTable').html(tableData);
|
||||
}
|
||||
|
||||
// Type is: success (green), info (blue), warning (yellow), danger (red)
|
||||
function newAlert(message, title, type, timeout) {
|
||||
debugMsg('newAlert(' + message + ', ' + title + ', ' + type + ', ' + timeout + ')');
|
||||
$('.alert').fadeIn(1000);
|
||||
$('#newAlert').show().html('<div class="alert alert-' + type + '"><button type="button" ' +
|
||||
'class="close" data-dismiss="alert" aria-hidden="true"></button><span>' +
|
||||
message + ' [' + title + ']</span></div>');
|
||||
if (timeout != 0) {
|
||||
$('.alert-' + type).delay(timeout).fadeOut(1000, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function refreshData() {
|
||||
var jsonObject = {};
|
||||
if (!connectedToWS) {
|
||||
return;
|
||||
}
|
||||
jsonObject['query'] = 'currentsong';
|
||||
connection.send(JSON.stringify(jsonObject));
|
||||
jsonObject['query'] = 'songlist';
|
||||
connection.send(JSON.stringify(jsonObject));
|
||||
jsonObject['query'] = 'playlist';
|
||||
connection.send(JSON.stringify(jsonObject));
|
||||
}
|
||||
setInterval(refreshData, 20000);
|
||||
|
||||
Reference in New Issue
Block a user