From 2960e74781dd44518c88c276e8eea4aec245795b Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Wed, 28 Sep 2016 20:38:48 +0300 Subject: [PATCH 1/1] =?utf8?q?=D0=9F=D0=BE=D0=B4=D1=82=D0=B2=D0=B5=D1=80?= =?utf8?q?=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB?= =?utf8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D0=BF=D1=80=D0=BE=D1=87?= =?utf8?q?=D0=B8=D0=B5=20=D0=B2=D0=B8=D0=B7=D1=83=D0=B0=D0=BB=D1=8C=D0=BD?= =?utf8?q?=D1=8B=D0=B5=20=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?utf8?q?=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ajax/editplaylist.php | 4 ++-- ajax/mpd.js | 12 +++++++++++- ajax/mpd.php | 2 +- ajax/trackinfo.php | 23 ++++++++++++++++------- css/general.css | 10 +++++++++- index.php | 2 +- system/mpd_class.php | 2 +- view/default/tmpl/playlistmenu.php | 2 +- 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/ajax/editplaylist.php b/ajax/editplaylist.php index b7e8bf4..28a6d3a 100644 --- a/ajax/editplaylist.php +++ b/ajax/editplaylist.php @@ -18,7 +18,7 @@ $dir = $_REQUEST['dir'];
- +
@@ -65,7 +65,7 @@ $dir = $_REQUEST['dir'];
- +
diff --git a/ajax/mpd.js b/ajax/mpd.js index 5d64a92..1fe1a82 100644 --- a/ajax/mpd.js +++ b/ajax/mpd.js @@ -142,6 +142,11 @@ function PlaylistEditCommand(cmd,item) { var req = new XMLHttpRequest(); +req.onreadystatechange = function () { + if (this.readyState != 4 || this.status != 200) return; + RefreshPageStatus(); +}; + req.open("GET", "ajax/playlist-command.php?item="+item+"&task="+cmd, true); req.send(); @@ -189,10 +194,15 @@ params=selected.map(function(el) { return 'itemlist[]=' + encodeURIComponent(el); }).join('&'); +req.onreadystatechange = function () { + if (this.readyState != 4 || this.status != 200) return; + RefreshPageStatus(); +}; + req.open("POST", "ajax/playlist-command.php?dir="+dir+"&task="+cmd, true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.send(params); } -// setInterval(RefreshPageStatus, 5000); +setInterval(RefreshPageStatus, 10000); diff --git a/ajax/mpd.php b/ajax/mpd.php index 9f435e2..86ea78e 100644 --- a/ajax/mpd.php +++ b/ajax/mpd.php @@ -7,7 +7,7 @@ include('../system/helper.php'); $mpd = new mpd($mpd_host,$mpd_port,$mpd_password); if($mpd->connected != 1){ - echo "Not Connected to Server"; + echo "Нет соединения с сервером!"; exit(1); } diff --git a/ajax/trackinfo.php b/ajax/trackinfo.php index e5cc464..f1c4b36 100644 --- a/ajax/trackinfo.php +++ b/ajax/trackinfo.php @@ -2,16 +2,25 @@ include('mpd.php'); -$cur_track= $mpd->current_track_id; -$playlist= $mpd->playlist; -if($cur_track !=-1) +$cur_track = $mpd->current_track_id; +$playlist = $mpd->playlist; +$playlist_count = $mpd->playlist_count; + +if($cur_track !=-1) { + + $trackno=$cur_track+1; + + echo "
#$trackno/$playlist_count
"; if ($playlist[$cur_track]['name']==$playlist[$cur_track]['title']) { - echo htmlentities(cut_file($playlist[$cur_track]['name'])); + echo "
".htmlentities(cut_file($playlist[$cur_track]['name']))."
"; } else { - echo htmlentities($playlist[$cur_track]['title']); + echo "
".htmlentities($playlist[$cur_track]['title'])."
"; } -else - echo "No Track selected"; + +} else { + echo "
#-/$playlist_count
"; + echo "
Трек не выбран
"; +} ?> diff --git a/css/general.css b/css/general.css index 19078d4..b41b3ec 100644 --- a/css/general.css +++ b/css/general.css @@ -49,6 +49,13 @@ padding : 0px; cursor : pointer; } +.trackno +{ +text-align: right; +vertical-align: top; +padding: 0px 0px 5px 0px; +} + #heading_tbl { width: 400px } @@ -75,7 +82,8 @@ cursor : pointer; text-align: center; border: 1px solid #525356; width: 380px; - padding: 30px 0px 30px 0px; + height: 60px; + padding: 10px 0px 5px 0px; background:url(../images/playing_bg.png); font-weight: bold; color: #fff; diff --git a/index.php b/index.php index 40c64d8..7ed34f3 100644 --- a/index.php +++ b/index.php @@ -6,7 +6,7 @@ include('system/helper.php'); $mpd = new mpd($mpd_host,$mpd_port,$mpd_password); if($mpd->connected != 1){ - echo "Not Connected to Server"; + echo "Нет соединения с сервером!"; exit(1); } diff --git a/system/mpd_class.php b/system/mpd_class.php index 8ffddcd..6f9f1ac 100644 --- a/system/mpd_class.php +++ b/system/mpd_class.php @@ -852,7 +852,7 @@ class mpd { // Get the Playlist $plStr = $this->SendCommand(MPD_CMD_PLLIST); $this->playlist = $this->_parseFileListResponse($plStr); - $this->playlist_count = count($this->playlist); + $this->playlist_count = count($this->playlist); // Set Misc Other Variables $this->state = $status['state']; diff --git a/view/default/tmpl/playlistmenu.php b/view/default/tmpl/playlistmenu.php index bc0f8f0..cb8113a 100644 --- a/view/default/tmpl/playlistmenu.php +++ b/view/default/tmpl/playlistmenu.php @@ -2,7 +2,7 @@
- +
-- 2.34.1