Skip to content
Permalink
Browse files

Added source files

  • Loading branch information...
thesoultaker48 committed Sep 16, 2018
0 parents commit ea4caa0bf7769041e8b89047d0ade255dfef5f98
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
@@ -0,0 +1,2 @@
# Notepad++ files
nppBackup/
@@ -0,0 +1,7 @@
# Музыкальный плеер (модуль для MajorDoMo)

Музыкальный проигрыватель для умного дома. На данный момент работает только на alpha ветке MajorDoMo. Поддерживает плееры VLC (HTTP) и Music Player Daemon (MPD). Позволяет воспроизводить музыку в пределах текущего плейлиста.

# Music Player (module for MajorDoMo)

Music player for smart home. Currently works only on alpha branch of MajorDoMo. Supports VLC (HTTP) and Music Player Daemon (MPD) players. Allows you to play music within the current playlist.
Binary file not shown.
@@ -0,0 +1 @@
1
@@ -0,0 +1,162 @@
<?php
/*
Music Player for MajorDoMo
Author: Sergey Avdeev <thesoultaker48@gmail.com>
URL: https://github.com/thesoultaker48/majordomo-app_music
*/
class app_music extends module {
// Constructor
function app_music() {
$this->name = 'app_music';
$this->title = 'Музыкальный плеер';
$this->module_category = '<#LANG_SECTION_APPLICATIONS#>';
$this->checkInstalled();
}
// saveParams
function saveParams($data=0) {
$p = array();
if(isset($this->id)) {
$p['id'] = $this->id;
}
if(isset($this->view_mode)) {
$p['view_mode'] = $this->view_mode;
}
if(isset($this->edit_mode)) {
$p['edit_mode'] = $this->edit_mode;
}
if(isset($this->tab)) {
$p['tab'] = $this->tab;
}
return parent::saveParams($p);
}
// getParams
function getParams() {
global $id, $mode, $view_mode, $edit_mode, $tab;
if(isset($id)) {
$this->id = $id;
}
if(isset($mode)) {
$this->mode = $mode;
}
if(isset($view_mode)) {
$this->view_mode = $view_mode;
}
if(isset($edit_mode)) {
$this->edit_mode = $edit_mode;
}
if(isset($tab)) {
$this->tab = $tab;
}
}
// run
function run() {
global $session;
$out = array();
if($this->action == 'admin') {
$this->admin($out);
} else {
$this->usual($out);
}
if(isset($this->owner->action)) {
$out['PARENT_ACTION'] = $this->owner->action;
}
if(isset($this->owner->name)) {
$out['PARENT_NAME']=$this->owner->name;
}
$out['ID'] = $this->id;
$out['VIEW_MODE'] = $this->view_mode;
$out['EDIT_MODE'] = $this->edit_mode;
$out['MODE'] = $this->mode;
$out['ACTION'] = $this->action;
$this->data = $out;
$p = new parser(DIR_TEMPLATES.$this->name.'/'.$this->name.'.html', $this->data, $this);
$this->result = $p->result;
}
// BackEnd
function admin(&$out) {
}
// Scan directory for audio files
/*
function scanDirectory($directory, $results=array()) {
if($dir = openDir($directory)) {
while($file = readDir($dir)) {
if(($file == '.') || ($file=='..')) {
continue;
}
if(Is_Dir($directory.'/'.$file)) {
$results = $this->scanDirectory($directory.'/'.$file, $results);
} else {
if(in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), array('mp3'))) {
$results[] = $directory.'/'.$file;
}
}
}
closeDir($dir);
}
asort($results);
return $results;
}
*/
// FrontEnd
function usual(&$out) {
/*
global $ajax;
if(!empty($ajax)) {
global $command;
$json = array('error'=>0, 'message'=>NULL, 'data'=>NULL);
switch($command) {
case 'get_volume':
// FIXME
break;
case 'get_playlist':
global $id;
if($collection = SQLSelectOne('SELECT `PATH` FROM `collections` WHERE `ID` = '.intval($id))) {
if($tracks = $this->scanDirectory($collection['PATH'])) {
$json['data'] = $tracks;
} else {
$json['error'] = TRUE;
$json['message'] = 'Can\'t get playlist!';
}
} else {
$json['error'] = TRUE;
$json['message'] = 'Unknown ID!';
}
break;
default:
$json['error'] = TRUE;
$json['message'] = 'Unknown command!';
}
die(json_encode($json));
} else {
$collections = SQLSelect("SELECT * FROM `collections` ORDER BY `TITLE`");
$out['COLLECTIONS'] = $collections;
}
*/
}
// Install
function install($parent_name='') {
parent::install($parent_name);
}
// Uninstall
function uninstall() {
parent::uninstall();
}
// dbInstall
function dbInstall($data) {
parent::dbInstall($data);
}
}
?>
@@ -0,0 +1,62 @@
<!-- Thanks Rodrigo for a great player: https://github.com/rtone1/audioUI -->

<link rel="stylesheet" href="/templates/app_music/stylesheets/styles.css">
<script type="text/javascript" src="/templates/app_music/javascripts/jquery-ui.min.js"></script>
<script type="text/javascript" src="/templates/app_music/javascripts/app_music.js"></script>

<div id="app_music" class="playerContainer unselectable">
<div class="app_music_loading_screen"></div>
<div class="imageDisplay">
<div class="hamIcon">
<div class="top"></div>
<div class="middle"></div>
<div class="bottom"></div>
</div>
<div class="shadow"></div>
</div>
<div class="audioPlaylist">
<div class="nowPlaying">
<h2>Сейчас играет</h2>
<p class="app_music_track_title_text"></p>
<p class="duration"><em class="app_music_track_time_text">00:00</em> / <em class="app_music_track_length_text">00:00</em></p>
<div class="arrow"></div>
<div class="listShadow"></div>
</div>
<div class="songList">
<ol class="app_music_tracklist_list">
</ol>
</div>
</div>
<div class="controlsContainer" >
<div class="topControls">
<div class="shuffle app_music_pl_random_button" title="Случайный порядок"></div>
<div class="progressMeter" >
<div class="progressBar app_music_track_progress_element"></div>
<div class="thumbScrubber app_music_track_scrubber_element"></div>
<div class="currentTime app_music_track_time_text">00:00</div>
<div class="totalTime app_music_track_length_text">00:00</div>
</div>
<div class="loop app_music_pl_loop_repeat_button" title="Режим повтора: всё, одна дорожка, без повтора"></div>
</div>
<div class="descriptionCtn">
<div class="songDescription app_music_track_title_text marquee"></div>
<div class="songDescription app_music_track_title_text marqueetwo"></div>
</div>
<div class="playPause">
<div class="prev app_music_previous_button" title="Предыдущий трек"></div>
<div class="play_pause app_music_pause_button active" title="Воспроизведение / Пауза"></div>
<div class="next app_music_next_button" title="Следующий трек"></div>
</div>
</div>
</div>

<script type="text/javascript">
var music_player = new app_music('MAIN');
$(document).ready(function () {
music_player.init_player(function() {
$(music_player.container).find('.arrow,.hamIcon').on('click', function() {
$(music_player.container).find('.audioPlaylist').slideToggle(500, 'swing');
});
});
});
</script>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit ea4caa0

Please sign in to comment.
You can’t perform that action at this time.