WIP - trial mode + better music tag library

This commit is contained in:
lone-cloud 2015-09-04 13:57:43 -07:00
parent 8d6c160c88
commit 89942a4639
10 changed files with 87 additions and 43 deletions

View file

@ -4,7 +4,7 @@
"window", "window",
"-Promise", "-Promise",
"Dancer", "Dancer",
"id3" "ID3"
], ],
"browser": true, "browser": true,
"boss": true, "boss": true,

View file

@ -2,7 +2,7 @@ import Em from 'ember';
export default Em.Component.extend({ export default Em.Component.extend({
bridgeIp: null, bridgeIp: null,
manualBridgeIp: null,
bridgeUsername: null, bridgeUsername: null,
updateGroupsData: true, updateGroupsData: true,
@ -17,9 +17,11 @@ export default Em.Component.extend({
init: function() { init: function() {
this._super(); 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(){ onUpdateGroupsDataChange: function(){

View file

@ -1,9 +1,11 @@
import Em from 'ember'; import Em from 'ember';
export default Em.Component.extend({ export default Em.Component.extend({
classNames: ['container'], classNames: ['container', 'center-block'],
bridgeIp: null, elementId: 'finderContainer',
bridgeIp: null,
trial: false,
bridgeUsername: null, bridgeUsername: null,
bridgeFindStatus: null, bridgeFindStatus: null,
@ -22,6 +24,16 @@ export default Em.Component.extend({
actions: { actions: {
retry: function(){ retry: function(){
this.onBridgeIpChange(); 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 // try to authenticate against the bridge here
onBridgeIpChange: function () { onBridgeIpChange: function () {
this.setProperties({ if(!this.get('trial')) {
bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')), this.setProperties({
bridgeUserNamePingIntervalProgress: 0 bridgePingIntervalHandle: setInterval(this.pingBridgeUser.bind(this), this.get('bridgeUsernamePingIntervalTime')),
}); bridgeUserNamePingIntervalProgress: 0
});
}
}.observes('bridgeIp'), }.observes('bridgeIp'),
pingBridgeUser: function () { pingBridgeUser: function () {

View file

@ -248,7 +248,8 @@ export default Em.Component.extend({
Em.$('#fileInput').on('change', function () { Em.$('#fileInput').on('change', function () {
var files = this.files, 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 }); playQueue.push({filaneme: this.name, url: URL.createObjectURL(this), artist: tags.artist, title: tags.title });
self.notifyPropertyChange('playQueue'); self.notifyPropertyChange('playQueue');
@ -258,11 +259,11 @@ export default Em.Component.extend({
if (files.hasOwnProperty(key)) { if (files.hasOwnProperty(key)) {
var file = files[key]; var file = files[key];
id3(file, updatePlayQueue.bind(file) ); ID3.loadTags("local", updatePlayQueue.bind(file),{
dataReader: FileAPIReader(file)
});
} }
} }
}); });
Em.$('[data-toggle="tooltip"]').tooltip(); Em.$('[data-toggle="tooltip"]').tooltip();

View file

@ -5,6 +5,8 @@ export default Em.Component.extend({
bridgeUsername: null, bridgeUsername: null,
trial: false,
init: function(){ init: function(){
this._super(); this._super();

View file

@ -8,9 +8,30 @@ $playerHeight: 400px;
$playListBackgroundColor: #1E1E1E; $playListBackgroundColor: #1E1E1E;
$playerDefaultIconColor: #BBBBBB; $playerDefaultIconColor: #BBBBBB;
// BRIDGE FINDER // BRIDGE FINDER
#finderContainer { #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 { #pressButtonBridgeImg {

View file

@ -1,28 +1,32 @@
<div id="finderContainer" class="center-block"> <span class="title">Huegasm</span>
{{#unless bridgeUsername}} {{#unless bridgeUsername}}
{{#if bridgeIp}} {{#if bridgeIp}}
<img src="assets/images/pressButtonBridge.png" id="pressButtonBridgeImg"> <img src="assets/images/pressButtonBridge.png" id="pressButtonBridgeImg">
{{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}} {{paper-progress-linear warn=true value=bridgeUserNamePingIntervalProgress}}
{{#if isAuthenticating}} {{#if isAuthenticating}}
<p>Your bridge IP is <b>{{bridgeIp}}</b></p> <p>Your bridge IP is <b>{{bridgeIp}}</b>
<p>Press the button on your bridge to authenticate this application.</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}}
{{else}} {{else}}
{{#unless bridgeFindStatus}} <p>You failed to press the button. <a class="noTextDecoration" href="#" {{action 'retry'}}>RETRY</a></p>
{{paper-progress-circular}} {{/if}}
<p>Trying to find your bridge's IP.</p> {{else}}
{{/unless}} {{#unless bridgeFindStatus}}
{{paper-progress-circular}}
<p>Trying to find your bridge's IP.</p>
{{/unless}}
{{#if bridgeFindMultiple}} {{#if bridgeFindMultiple}}
<p>Found multiple bridge IPs.</p> <p>Found multiple hue bridges.</p>
{{else}} {{else}}
{{#if bridgeFindFail}} {{#if bridgeFindFail}}
{{paper-progress-circular}} <p>A hue bridge was not found on your network :( <br>
<p>Trying to find your bridge's IP.</p> Enter one manually?</p>
{{/if}}
<span id="bridgeInput">
{{paper-input label="Hue Bridge IP Address" value=manualBridgeIp}}
{{#paper-button action="findBridgeByIp" primary=true }}Find{{/paper-button}}
</span>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}} {{/if}}
</div> {{/unless}}

View file

@ -1,5 +1,5 @@
{{#liquid-if bridgeUsername}} {{#liquid-if bridgeUsername}}
{{bridge-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername}} {{bridge-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}}
{{else}} {{else}}
{{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername}} {{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}}
{{/liquid-if}} {{/liquid-if}}

View file

@ -11,7 +11,7 @@
"ember-qunit-notifications": "0.0.7", "ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18", "ember-resolver": "~0.1.18",
"hammerjs": "~2.0.4", "hammerjs": "~2.0.4",
"id3js": "id3#~1.0.2", "JavaScript-ID3-Reader": "https://github.com/aadsm/JavaScript-ID3-Reader.git",
"jquery": "^1.11.1", "jquery": "^1.11.1",
"loader.js": "ember-cli/loader.js#3.2.0", "loader.js": "ember-cli/loader.js#3.2.0",
"nouislider": "^8.0.1", "nouislider": "^8.0.1",

View file

@ -8,7 +8,7 @@ module.exports = function(defaults) {
app.import('vendor/dancer.js'); app.import('vendor/dancer.js');
app.import('bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.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 // Use `app.import` to add additional libraries to the generated
// output files. // output files.