diff --git a/css/style1.css b/css/style.css
similarity index 91%
rename from css/style1.css
rename to css/style.css
index 5dbd12b..2b3ace9 100644
--- a/css/style1.css
+++ b/css/style.css
@@ -1,9 +1,11 @@
body {
background-color: rgb(62, 50, 64);
+/*
background-image: url("/pic/bg.jpg");
background-repeat: no-repeat;
+ background-attachment: fixed;
background-position: center center;
- background-size: cover;
+ background-size: cover; */
}
.parent {
@@ -11,12 +13,15 @@ body {
height: 100%;
position: fixed;
top: 0;
+ background: url(/pic/bg.jpg) no-repeat center center / cover;
left: 0;
display: flex;
align-items: center;
align-content: center;
justify-content: center;
overflow: auto;
+
+
}
#song{
diff --git a/index.html b/index.html
index ce5655e..17316ec 100755
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
+
My Test Radio
-
+
diff --git a/js/audio.js b/js/audio.js
index 3210b82..2dcc213 100644
--- a/js/audio.js
+++ b/js/audio.js
@@ -14,6 +14,7 @@ pause.addEventListener('click', function() {
audio.pause();
}, false);
+/*
audio.addEventListener("timeupdate", function() {
var duration = document.getElementById('duration');
var s = parseInt(audio.currentTime % 60);
@@ -24,6 +25,7 @@ audio.addEventListener("timeupdate", function() {
if (h < 10) h = '0' + h;
duration.innerHTML = h + ':' + m + ':' + s;
}, false);
+*/
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
diff --git a/js/radio.js b/js/radio.js
index ab3fc9b..3a902e6 100644
--- a/js/radio.js
+++ b/js/radio.js
@@ -1,3 +1,11 @@
+var lastfm = new LastFM({
+ apiKey : '59ab8307ec00a5ec90574ac91885798e',
+ apiSecret : 'e09bec215fdc3100ff998167e5b401f8',
+});
+
+var MPDartist, MPDsong, MPDfile, MPDCurr;
+MPDartist = MPDsong = MPDfile = MPDCurr = 'empty';
+
function show()
{
@@ -17,8 +25,7 @@ function show()
xmlHttpRequest()
.then(function(temp){
- var MPDartist, MPDsong, MPDfile;
- MPDartist = MPDsong = MPDfile = 'empty';
+ // Получение информации из файла
var array = temp.toString().split("\n");
// вывод в консоль информации о файле
/*
@@ -26,18 +33,20 @@ function show()
console.log(array[i]);} */
// .replace - удаление пробелов в начале и конце строки
- MPDartist = array[0].replace(/^\s*/,'').replace(/\s*$/,'');
+ MPDartist = array[0];
MPDsong = array[1];
MPDfile = array[2].replace(/^vk_kun\//,'').replace(/\.mp3/,'');
//console.log(MPDartist);
- if (MPDartist == '') {
- $('#title').html(MPDfile);
- } else {
+ if (MPDartist == '' && MPDCurr != MPDfile) {
+ MPDartist = MPDfile.replace(/\s-.*/,'').replace(/^\s*/,'').replace(/\s*$/,'');
+ MPDsong = MPDfile.replace(/^.*\s-/,'').replace(/^\s*/,'').replace(/\s*$/,'');
+ getLastFM_url(MPDartist, MPDsong);
+ } else if (MPDCurr != MPDfile) {
getLastFM_url(MPDartist, MPDsong);
}
+ MPDCurr = MPDfile;
});
-
}
$(document).ready(
@@ -49,19 +58,13 @@ $(document).ready(
function getLastFM_url(FMartist, FMsong)
{
- var lastfm = new LastFM({
- apiKey : '59ab8307ec00a5ec90574ac91885798e',
- apiSecret : 'e09bec215fdc3100ff998167e5b401f8',
- });
-
lastfm.artist.getInfo({artist: FMartist}, {success: function(data){
- var artistLink = data.artist.url;
+ console.log(data.artist.url);
// формируем ссылку на артиста в LastFM
- document.querySelector('a[name="lastFMlink"]').setAttribute('href', artistLink);
+ document.querySelector('a[name="lastFMlink"]').setAttribute('href', data.artist.url);
// выводим название артиста и трека ссылкой
$('#title').html(FMartist+' - '+FMsong);
}, error: function(code, message){
console.log('Error #'+code+': '+message);}
});
- console.log('WHAT??!')
}
diff --git a/js/radio.js.bak b/js/radio.js.bak
deleted file mode 100644
index 4bf01df..0000000
--- a/js/radio.js.bak
+++ /dev/null
@@ -1,28 +0,0 @@
-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);
- }
-);