Skip to content

Commit

Permalink
Added getExtendedMetaData, wakeupEvent, debounced search a bit longer
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalopitz committed Nov 27, 2016
1 parent 8f7c8ce commit 621514c
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 44 deletions.
1 change: 1 addition & 0 deletions app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ body #queue-container li[data-is-current=true] {
text-overflow: ellipsis;
}

#browser-container li div p.creator,
#browser-container li div p.artist,
#queue-container li div p.artist {
color: #aaa;
Expand Down
5 changes: 4 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const { app, Menu, BrowserWindow } = electron;
const path = require('path')
const url = require('url')

const wakeEvent = require('wake-event');


let win;

function createWindow () {
Expand Down Expand Up @@ -88,7 +91,7 @@ function createWindow () {
win = null;
});

electron.powerMonitor.on('resume', () => {
wakeEvent(() => {
if (win) {
win.reload();
}
Expand Down
5 changes: 3 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonos-controller-unofficial",
"description": "Unoffical sonos controller for linux.",
"version": "0.0.4",
"version": "0.0.5",
"author": "Pascal Opitz <[email protected]>",
"main": "main.js",
"dependencies": {
Expand All @@ -16,6 +16,7 @@
"react": "^15.4.0",
"react-dom": "^15.4.0",
"request": "^2.79.0",
"uuid": "^3.0.0"
"uuid": "^3.0.0",
"wake-event": "^0.0.1"
}
}
7 changes: 6 additions & 1 deletion app/yarn.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


ansi-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"
Expand Down Expand Up @@ -484,11 +486,14 @@ [email protected]:
dependencies:
extsprintf "1.0.2"

wake-event@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/wake-event/-/wake-event-0.0.1.tgz#84ff6f321ddf42e98d1a01a27e33c9853ea668e4"

whatwg-fetch@>=0.10.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.0.0.tgz#01c2ac4df40e236aaa18480e3be74bd5c8eb798e"

xtend@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sonos-controller-unofficial",
"version": "0.0.4",
"version": "0.0.5",
"description": "Unoffical sonos controller for linux",
"main": "app/main.js",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/ui/actions/BrowserListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default {
});
}


return client.getMediaURI(item.id)
.then((uri) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/SearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let term;

let func = _.debounce(() => {
SearchBarActions.search(term);
}, 100);
}, 200);

class SearchBar extends React.Component {

Expand Down
35 changes: 35 additions & 0 deletions src/ui/services/MusicServiceClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,41 @@ class MusicServiceClient {
});
}

getExtendedMetadata(id) {

let headers = ['<ns:credentials>',
'<ns:deviceId>', RUNTIME_ID ,'</ns:deviceId>',
'<ns:deviceProvider>', deviceProviderName, '</ns:deviceProvider>',
'<ns:loginToken>',
'<ns:token>', this.authToken ,'</ns:token>',
'<ns:key>', this.key ,'</ns:key>',
'<ns:householdId>', SonosService.householdId, '</ns:householdId>',
'</ns:loginToken>',
'</ns:credentials>'].join('');

let body = ['<ns:getExtendedMetadata>',
'<ns:id>', id, '</ns:id>',
'</ns:getExtendedMetadata>'].join('');

return new Promise((resolve, reject) => {
this._doRequest(this._serviceDefinition.SecureUri, 'getExtendedMetadata', body, headers)
.then((res) => {
let resp = xml2json(stripNamespaces(res));
let obj = resp['Envelope']['Body']['getExtendedMetadataResponse']['getExtendedMetadataResult'];
resolve(obj);
})
.catch((authToken) => {
if(authToken) {
this.getExtendedMetadata(id).then((obj) => {
resolve(obj);
});
} else {
reject();
}
});
});
}

search(id, term, index=0, count=200) {

let headers = ['<ns:credentials>',
Expand Down
75 changes: 38 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"7zip-bin-linux@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/7zip-bin-linux/-/7zip-bin-linux-1.0.3.tgz#66724d7bb7526381574393888f62566ed537151c"
Expand Down Expand Up @@ -774,17 +776,17 @@ [email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"

concat-stream@^1.4.6:
version "1.5.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266"
concat-stream@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.0.tgz#53f7d43c51c5e43f81c8fdd03321c631be68d611"
dependencies:
inherits "~2.0.1"
readable-stream "~2.0.0"
typedarray "~0.0.5"

concat-stream@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.0.tgz#53f7d43c51c5e43f81c8fdd03321c631be68d611"
concat-stream@^1.4.6:
version "1.5.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266"
dependencies:
inherits "~2.0.1"
readable-stream "~2.0.0"
Expand Down Expand Up @@ -861,6 +863,10 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"

[email protected]:
version "0.7.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"

debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@^2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
Expand All @@ -873,10 +879,6 @@ debug@~2.2.0:
dependencies:
ms "0.7.1"

[email protected]:
version "0.7.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"

debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
Expand Down Expand Up @@ -1097,7 +1099,7 @@ es6-set@~0.1.3:
es6-symbol "3"
event-emitter "~0.3.4"

es6-symbol@~3.1, es6-symbol@~3.1.0, es6-symbol@3:
es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa"
dependencies:
Expand Down Expand Up @@ -1597,7 +1599,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"

inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@2:
inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"

Expand Down Expand Up @@ -1774,14 +1776,14 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"

isarray@^1.0.0, isarray@~1.0.0, [email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"

[email protected], isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"

isbinaryfile@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-3.0.1.tgz#6e99573675372e841a0520c036b41513d783e79e"
Expand Down Expand Up @@ -2027,32 +2029,32 @@ mime@^1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53"

minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, "minimatch@2 || 3":
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
dependencies:
brace-expansion "^1.0.0"

minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

[email protected]:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"
minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

[email protected]:
version "0.5.0"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12"
dependencies:
minimist "0.0.8"

"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"

[email protected]:
version "0.7.1"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
Expand Down Expand Up @@ -2622,7 +2624,7 @@ restore-cursor@^1.0.1:
exit-hook "^1.0.0"
onetime "^1.0.0"

rimraf@^2.2.8, rimraf@~2.5.1, rimraf@~2.5.4, rimraf@2:
rimraf@2, rimraf@^2.2.8, rimraf@~2.5.1, rimraf@~2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04"
dependencies:
Expand Down Expand Up @@ -2650,7 +2652,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"

semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0, "semver@2 || 3 || 4 || 5":
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"

Expand Down Expand Up @@ -2745,10 +2747,6 @@ sshpk@^1.7.0:
jsbn "~0.1.0"
tweetnacl "~0.14.0"

string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"

string-width@^1.0.1, string-width@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
Expand All @@ -2768,6 +2766,10 @@ string.prototype.codepointat@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.0.tgz#6b26e9bd3afcaa7be3b4269b526de1b82000ac78"

string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"

stringstream@~0.0.4:
version "0.0.5"
resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878"
Expand Down Expand Up @@ -2865,17 +2867,17 @@ [email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-0.0.2.tgz#cfedf88e60c00dd9697b61fdd2a8343a9b680eaf"

through@^2.3.6:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

through2@~0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f"
dependencies:
readable-stream "~1.1.9"
xtend "~2.1.1"

through@^2.3.6:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

timed-out@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-3.0.0.tgz#ff88de96030ce960eabd42487db61d3add229273"
Expand Down Expand Up @@ -3126,4 +3128,3 @@ zip-stream@^1.1.0:
compress-commons "^1.1.0"
lodash "^4.8.0"
readable-stream "^2.0.0"

0 comments on commit 621514c

Please sign in to comment.