Backend changes
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
body {
|
||||
background-color: rgb(62, 50, 64);
|
||||
background-image: url("/pic/bg.png");
|
||||
background-image: url("/pic/bg.jpg");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top center;
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ body {
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#song{
|
||||
|
||||
75
index.html
75
index.html
@@ -11,7 +11,8 @@
|
||||
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
|
||||
<script src="js/lastfm.api.md5.js" type="text/javascript"></script>
|
||||
<script src="js/lastfm.api.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -23,7 +24,7 @@
|
||||
|
||||
<div id="myPlay">-</div>
|
||||
|
||||
<div id="title">title</div>
|
||||
<a name="lastFMlink" href="" target="_blank"><div id="title">title</div></a>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -48,77 +49,11 @@
|
||||
|
||||
<span id="duration"></span>
|
||||
<br>
|
||||
<br>
|
||||
<div id="listeners">title</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script language="JavaScript">
|
||||
var audio = new Audio('http://stream.santic-zombie.ru');
|
||||
|
||||
var play = document.getElementById('play');
|
||||
play.addEventListener('click', function() {
|
||||
$("#myPlay").text("Now playing:");
|
||||
audio.play();
|
||||
}, false);
|
||||
|
||||
var pause = document.getElementById('pause');
|
||||
pause.addEventListener('click', function() {
|
||||
$("#myPlay").text("Paused");
|
||||
audio.pause();
|
||||
}, false);
|
||||
|
||||
audio.addEventListener("timeupdate", function() {
|
||||
var duration = document.getElementById('duration');
|
||||
var s = parseInt(audio.currentTime % 60);
|
||||
var m = parseInt((audio.currentTime / 60) % 60);
|
||||
var h = parseInt((audio.currentTime / 3600) % 60);
|
||||
if (s < 10) s = '0' + s;
|
||||
if (m < 10) m = '0' + m;
|
||||
if (h < 10) h = '0' + h;
|
||||
duration.innerHTML = h + ':' + m + ':' + s;
|
||||
}, false);
|
||||
|
||||
$("#volume").mousemove(function(){
|
||||
audio.volume = parseFloat(this.value / 10);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script language="JavaScript">
|
||||
function show()
|
||||
{
|
||||
$.ajax({
|
||||
url: '/trackname.php',
|
||||
cache: false,
|
||||
success: function(html){
|
||||
$('#title').html(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
show();
|
||||
setInterval('show()',5000);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script language="JavaScript">
|
||||
function show1()
|
||||
{
|
||||
$.ajax({
|
||||
url: '/online.php',
|
||||
cache: false,
|
||||
success: function(html){
|
||||
$('#listeners').html(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
show1();
|
||||
setInterval('show1()',5000);
|
||||
});
|
||||
</script>
|
||||
<script src="js/audio.js" type="text/javascript"></script>
|
||||
<script src="js/radio.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
var audio = new Audio('http://stream.santic-zombie.ru');
|
||||
var stream_url = 'http://stream.santic-zombie.ru';
|
||||
|
||||
var audio = new Audio(stream_url);
|
||||
|
||||
var play = document.getElementById('play');
|
||||
play.addEventListener('click', function() {
|
||||
@@ -26,3 +28,5 @@ audio.addEventListener("timeupdate", function() {
|
||||
$("#volume").mousemove(function(){
|
||||
audio.volume = parseFloat(this.value / 10);
|
||||
});
|
||||
|
||||
//audio.muted = true;
|
||||
|
||||
25
js/info.js
25
js/info.js
@@ -1,25 +0,0 @@
|
||||
/* Create a cache object */
|
||||
//var cache = new LastFMCache();
|
||||
|
||||
/* Create a LastFM object */
|
||||
var lastfm = new LastFM({
|
||||
apiKey : '59ab8307ec00a5ec90574ac91885798e',
|
||||
apiSecret : 'e09bec215fdc3100ff998167e5b401f8',
|
||||
// cache : cache
|
||||
});
|
||||
|
||||
/* Load some artist info. */
|
||||
/*
|
||||
lastfm.artist.getInfo({artist: 'Boris'}, {success: function(data){
|
||||
$('#curr_artist').html(
|
||||
$('#lastfmTemplateArtistInfo').render(data.artist));
|
||||
}, error: function(code, message){
|
||||
alert('Error #'+code+': '+message);
|
||||
}});
|
||||
*/
|
||||
|
||||
lastfm.artist.getInfo({artist: 'Boris'}, {success: function(data){
|
||||
alert(data.artist.url)
|
||||
}, error: function(code, message){
|
||||
alert('Error #'+code+': '+message);
|
||||
}});
|
||||
63
js/radio.js
63
js/radio.js
@@ -1,19 +1,56 @@
|
||||
function show()
|
||||
{
|
||||
$.ajax({
|
||||
url: '../trackname.php',
|
||||
cache: false,
|
||||
success: function(html){
|
||||
$('#title').html(html);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '../online.php',
|
||||
cache: false,
|
||||
success: function(html){
|
||||
$('#listeners').html(html);
|
||||
}
|
||||
|
||||
var lastfm = new LastFM({
|
||||
apiKey : '59ab8307ec00a5ec90574ac91885798e',
|
||||
apiSecret : 'e09bec215fdc3100ff998167e5b401f8',
|
||||
});
|
||||
|
||||
let xmlHttpRequest = function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '../trackname');
|
||||
var temp = 'empty';
|
||||
xhr.onload = function (e) {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
resolve(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
|
||||
xmlHttpRequest()
|
||||
.then(function(temp){
|
||||
var MPDartist, MPDsong, MPDfile;
|
||||
MPDartist = MPDsong = MPDfile = 'empty';
|
||||
var array = temp.toString().split("\n");
|
||||
// вывод в консоль информации о файле
|
||||
for(i in array) {
|
||||
console.log(array[i]);}
|
||||
// .replace - удаление пробелов в начале и конце строки
|
||||
MPDartist = array[0].replace(/^\s*/,'').replace(/\s*$/,'');
|
||||
MPDsong = array[1];
|
||||
MPDfile = array[2].replace(/^vk_kun\//,'').replace(/\.mp3/,'');
|
||||
console.log(MPDfile);
|
||||
|
||||
if (MPDartist !== null) {
|
||||
lastfm.artist.getInfo({artist: MPDartist}, {success: function(data){
|
||||
var artistLink = data.artist.url;
|
||||
// формируем ссылку на артиста в LastFM
|
||||
document.querySelector('a[name="lastFMlink"]').setAttribute('href', artistLink);
|
||||
// выводим название артиста и трека ссылкой
|
||||
$('#title').html(MPDartist+' - '+MPDsong);
|
||||
}, error: function(code, message){
|
||||
console.log('Error #'+code+': '+message);
|
||||
MPDartist = null;
|
||||
}});}
|
||||
else {
|
||||
//document.querySelector('a[name="lastFMlink"]').setAttribute('href', null);
|
||||
//$('#title').html(MPDfile);
|
||||
alert('WTF!?');}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(
|
||||
|
||||
28
js/radio.js.bak
Normal file
28
js/radio.js.bak
Normal file
@@ -0,0 +1,28 @@
|
||||
function show()
|
||||
{
|
||||
/*
|
||||
// php-scrip exec mpc current command
|
||||
$.ajax({
|
||||
url: '../trackname.php',
|
||||
cache: false,
|
||||
success: function(data){
|
||||
$('#title').html(data);
|
||||
}
|
||||
}); */
|
||||
|
||||
$.ajax({
|
||||
url: '../online.php',
|
||||
cache: false,
|
||||
success: function(html){
|
||||
$('#listeners').html(html);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(
|
||||
() => {
|
||||
show();
|
||||
setInterval(show, 5000);
|
||||
}
|
||||
);
|
||||
BIN
pic/bg.jpg
Normal file
BIN
pic/bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 KiB |
BIN
pic/bg.png
BIN
pic/bg.png
Binary file not shown.
|
Before Width: | Height: | Size: 333 KiB |
Reference in New Issue
Block a user