WIP - trial mode + better music tag library
This commit is contained in:
parent
8d6c160c88
commit
89942a4639
10 changed files with 87 additions and 43 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"window",
|
||||
"-Promise",
|
||||
"Dancer",
|
||||
"id3"
|
||||
"ID3"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import Em from 'ember';
|
|||
|
||||
export default Em.Component.extend({
|
||||
bridgeIp: null,
|
||||
|
||||
manualBridgeIp: null,
|
||||
bridgeUsername: null,
|
||||
|
||||
updateGroupsData: true,
|
||||
|
|
@ -17,9 +17,11 @@ export default Em.Component.extend({
|
|||
|
||||
init: function() {
|
||||
this._super();
|
||||
this.doUpdateGroupsData();
|
||||
|
||||
this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 1000));
|
||||
if(!this.get('trial')) {
|
||||
this.doUpdateGroupsData();
|
||||
this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 1000));
|
||||
}
|
||||
},
|
||||
|
||||
onUpdateGroupsDataChange: function(){
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import Em from 'ember';
|
||||
|
||||
export default Em.Component.extend({
|
||||
classNames: ['container'],
|
||||
bridgeIp: null,
|
||||
classNames: ['container', 'center-block'],
|
||||
elementId: 'finderContainer',
|
||||
|
||||
bridgeIp: null,
|
||||
trial: false,
|
||||
bridgeUsername: null,
|
||||
|
||||
bridgeFindStatus: null,
|
||||
|
|
@ -22,6 +24,16 @@ export default Em.Component.extend({
|
|||
actions: {
|
||||
retry: function(){
|
||||
this.onBridgeIpChange();
|
||||
},
|
||||
|
||||
findBridgeByIp: function() {
|
||||
if (this.get('manualBridgeIp').toLowerCase() === 'trial') {
|
||||
this.setProperties({
|
||||
trial: true,
|
||||
bridgeIp: 'trial',
|
||||
bridgeUsername: 'trial'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -52,10 +64,12 @@ export default Em.Component.extend({
|
|||
|
||||
// try to authenticate against the bridge here
|
||||
onBridgeIpChange: function () {
|
||||
this.setProperties({
|
||||
bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')),
|
||||
bridgeUserNamePingIntervalProgress: 0
|
||||
});
|
||||
if(!this.get('trial')) {
|
||||
this.setProperties({
|
||||
bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')),
|
||||
bridgeUserNamePingIntervalProgress: 0
|
||||
});
|
||||
}
|
||||
}.observes('bridgeIp'),
|
||||
|
||||
pingBridgeUser: function () {
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ export default Em.Component.extend({
|
|||
|
||||
Em.$('#fileInput').on('change', function () {
|
||||
var files = this.files,
|
||||
updatePlayQueue = function(err, tags){
|
||||
updatePlayQueue = function(){
|
||||
var tags = ID3.getAllTags("local");
|
||||
playQueue.push({filaneme: this.name, url: URL.createObjectURL(this), artist: tags.artist, title: tags.title });
|
||||
|
||||
self.notifyPropertyChange('playQueue');
|
||||
|
|
@ -258,11 +259,11 @@ export default Em.Component.extend({
|
|||
if (files.hasOwnProperty(key)) {
|
||||
var file = files[key];
|
||||
|
||||
id3(file, updatePlayQueue.bind(file) );
|
||||
ID3.loadTags("local", updatePlayQueue.bind(file),{
|
||||
dataReader: FileAPIReader(file)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
Em.$('[data-toggle="tooltip"]').tooltip();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ export default Em.Component.extend({
|
|||
|
||||
bridgeUsername: null,
|
||||
|
||||
trial: false,
|
||||
|
||||
init: function(){
|
||||
this._super();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,30 @@ $playerHeight: 400px;
|
|||
$playListBackgroundColor: #1E1E1E;
|
||||
$playerDefaultIconColor: #BBBBBB;
|
||||
|
||||
// BRIDGE FINDER
|
||||
// BRIDGE FINDER
|
||||
#finderContainer {
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
#finderContainer .title {
|
||||
font-family: 'Slabo 27px', serif;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
#bridgeInput {
|
||||
md-input-container {
|
||||
max-width: 200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
#finderContainer p {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
md-progress-circular {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#pressButtonBridgeImg {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,32 @@
|
|||
<div id="finderContainer" class="center-block">
|
||||
{{#unless bridgeUsername}}
|
||||
{{#if bridgeIp}}
|
||||
<img src="assets/images/pressButtonBridge.png" id="pressButtonBridgeImg">
|
||||
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
|
||||
{{#if isAuthenticating}}
|
||||
<p>Your bridge IP is <b>{{bridgeIp}}</b></p>
|
||||
<p>Press the button on your bridge to authenticate this application.</p>
|
||||
{{else}}
|
||||
<p>You failed to press the button. <a class="noTextDecoration" href="#" {{action 'retry'}}>RETRY</a></p>
|
||||
{{/if}}
|
||||
<span class="title">Huegasm</span>
|
||||
{{#unless bridgeUsername}}
|
||||
{{#if bridgeIp}}
|
||||
<img src="assets/images/pressButtonBridge.png" id="pressButtonBridgeImg">
|
||||
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
|
||||
{{#if isAuthenticating}}
|
||||
<p>Your bridge IP is <b>{{bridgeIp}}</b>
|
||||
Press the button on your bridge to authenticate this application.</p>
|
||||
{{else}}
|
||||
{{#unless bridgeFindStatus}}
|
||||
{{paper-progress-circular}}
|
||||
<p>Trying to find your bridge's IP.</p>
|
||||
{{/unless}}
|
||||
<p>You failed to press the button. <a class="noTextDecoration" href="#" {{action 'retry'}}>RETRY</a></p>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#unless bridgeFindStatus}}
|
||||
{{paper-progress-circular}}
|
||||
<p>Trying to find your bridge's IP.</p>
|
||||
{{/unless}}
|
||||
|
||||
{{#if bridgeFindMultiple}}
|
||||
<p>Found multiple bridge IPs.</p>
|
||||
{{else}}
|
||||
{{#if bridgeFindFail}}
|
||||
{{paper-progress-circular}}
|
||||
<p>Trying to find your bridge's IP.</p>
|
||||
{{/if}}
|
||||
{{#if bridgeFindMultiple}}
|
||||
<p>Found multiple hue bridges.</p>
|
||||
{{else}}
|
||||
{{#if bridgeFindFail}}
|
||||
<p>A hue bridge was not found on your network :( <br>
|
||||
Enter one manually?</p>
|
||||
|
||||
<span id="bridgeInput">
|
||||
{{paper-input label="Hue Bridge IP Address" value=manualBridgeIp}}
|
||||
{{#paper-button action="findBridgeByIp" primary=true }}Find{{/paper-button}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{{#liquid-if bridgeUsername}}
|
||||
{{bridge-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername}}
|
||||
{{bridge-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}}
|
||||
{{else}}
|
||||
{{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername}}
|
||||
{{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}}
|
||||
{{/liquid-if}}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
"ember-qunit-notifications": "0.0.7",
|
||||
"ember-resolver": "~0.1.18",
|
||||
"hammerjs": "~2.0.4",
|
||||
"id3js": "id3#~1.0.2",
|
||||
"JavaScript-ID3-Reader": "https://github.com/aadsm/JavaScript-ID3-Reader.git",
|
||||
"jquery": "^1.11.1",
|
||||
"loader.js": "ember-cli/loader.js#3.2.0",
|
||||
"nouislider": "^8.0.1",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module.exports = function(defaults) {
|
|||
|
||||
app.import('vendor/dancer.js');
|
||||
app.import('bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js');
|
||||
app.import('bower_components/id3js/dist/id3.js');
|
||||
app.import('bower_components/JavaScript-ID3-Reader/dist/id3-minimized.js');
|
||||
|
||||
// Use `app.import` to add additional libraries to the generated
|
||||
// output files.
|
||||
|
|
|
|||
Reference in a new issue