Skip to content

Commit

Permalink
v.4.8
Browse files Browse the repository at this point in the history
- Мелкие фиксы
  • Loading branch information
SmoKE585 committed May 26, 2020
1 parent c1d98ac commit 4f4d8a5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
35 changes: 21 additions & 14 deletions modules/yamusic/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,28 @@
$sqlQuery = "SELECT * FROM `terminals` WHERE `NAME` = '" . DBSafe($terminal) . "' OR `TITLE` = '" . DBSafe($terminal) . "' ORDER BY `ID` ASC";
$terminals = SQLSelect($sqlQuery);
$type = $terminals[0]['PLAYER_TYPE'];

include_once (DIR_MODULES . 'app_player/app_player.class.php');
$player = new app_player();
$player->play_terminal = $terminal;
// Имя терминала
$player->command = $cmd;
// Команда
$player->param = $value;
// Параметр
$player->ajax = TRUE;
$player->intCall = TRUE;
$player->usual($out);
$status = $player->json['message'];

if($type == 'vlcweb' && $cmd == 'status') {
$xml = simplexml_load_string(file_get_contents('http://'.$terminals[0]['PLAYER_USERNAME'].':'.$terminals[0]['PLAYER_PASSWORD'].'@'.$terminals[0]['HOST'].':'.$terminals[0]['PLAYER_PORT'].'/requests/status.xml'), "SimpleXMLElement", LIBXML_NOCDATA);

echo '<pre>';
var_dump($xml);
die();
} else {
include_once (DIR_MODULES . 'app_player/app_player.class.php');
$player = new app_player();
$player->play_terminal = $terminal;
// Имя терминала
$player->command = $cmd;
// Команда
if($value) $player->param = $value;
// Параметр
$player->ajax = TRUE;
$player->intCall = TRUE;
$player->usual($out);
$status = $player->json['message'];
}
}

if($_GET['action'] == 'genPLS') {
$playlist = urldecode(strip_tags($_GET['playlist']));
$owner = urldecode(strip_tags($_GET['owner']));
Expand Down
7 changes: 6 additions & 1 deletion modules/yamusic/pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@

$array = json_decode(file_get_contents('http://'.$_SERVER["SERVER_ADDR"].'/modules/yamusic/json.php?mode=track&playlist='.$playlistID.'&owner='.$owner.'&songID='.$songID), TRUE);

header("Location: ".$array[0]['LINK']);
header('Content-Type: audio/mpeg');
header('Cache-Control: no-cache');

readfile($array[0]['LINK']);

//header("Location: ".$array[0]['LINK']);
?>
5 changes: 2 additions & 3 deletions modules/yamusic/yamusic.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function __construct() {
$this->name="yamusic";
$this->title="Яндекс.Музыка";
$this->module_category="<#LANG_SECTION_APPLICATIONS#>";
$this->version = '4.7';
$this->version = '4.8';
$this->checkInstalled();
}

Expand Down Expand Up @@ -343,10 +343,9 @@ function generatePlaylistM3U($playlistID, $owner) {
';

foreach($selectMusic as $key => $value) {
$string .= '#EXTINF:'.($value['DURATION']*1000).', '.$value['NAMESONG'].' - '.$value['ARTISTS'].'
$string .= '#EXTINF:0, '.$value['ARTISTS'].' - '.$value['NAMESONG'].'
';
$string .= 'http://'.$_SERVER["SERVER_ADDR"].'/modules/yamusic/pl.php?playlistID='.$playlistID.'&owner='.$owner.'&songID='.$value['SONGID'].'
';
}

Expand Down
7 changes: 4 additions & 3 deletions templates/yamusic/action_admin_success.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ <h4>Мои плейлисты ([#TOTAL_PLAYLIST#] шт.)</h4>
});
}

function sendCmd(cmd, value) {
function sendCmd(cmd, value = '') {
terminalName = $('#terminalName').val();
if(value) value = '&value='+value;
$.getJSON({
url: '/modules/yamusic/ajax.php?action=sendCmd&cmd='+cmd+'&value='+value+'&terminal='+terminalName,
url: '/modules/yamusic/ajax.php?action=sendCmd&cmd='+cmd+value+'&terminal='+terminalName,
success: function(responce) {
console.log(responce);
},
Expand Down Expand Up @@ -575,7 +576,7 @@ <h4 class="modal-title">Настройки терминалов</h4>
Проверить работу
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12" style="">
<span style="color: #fff;background-color: #5cb85c;border-color: #4cae4c;padding: 8px;border-radius: 3px;cursor: pointer;" onClick="sendOnTerminal('[#FULL_PATH_FOR_PLAYLIST_M3U#]', $('#terminalName').val());" id="testBtnTerminal"><i class="las la-play-circle"></i> Отправить на терминал: <span id="terminalNameTest">[#MAIN_TERMINAL#]</span></span>
<span style="color: #fff;background-color: #5cb85c;border-color: #4cae4c;padding: 8px;border-radius: 3px;cursor: pointer;font-size: 1rem;" onClick="sendOnTerminal('[#FULL_PATH_FOR_PLAYLIST_M3U#]', $('#terminalName').val());" id="testBtnTerminal"><i class="las la-play-circle"></i> Отправить на терминал: <span id="terminalNameTest">[#MAIN_TERMINAL#]</span></span>
</div>
</div>
<div class="row" style="margin-top: 25px;">
Expand Down

0 comments on commit 4f4d8a5

Please sign in to comment.