iobroker.squeezeboxrpc 1.3.6 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2020 oweitman
3
+ Copyright (c) 2019-2021 oweitman
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -183,6 +183,15 @@ https://github.com/elParaguayo/LMS-CLI-Documentation/blob/master/LMS-CLI.md
183
183
 
184
184
  ## Changelog
185
185
 
186
+ ### 1.3.10
187
+ * getalbumartist as artist if setting of TPE2/TPE3 in LMS are changed"
188
+ ### 1.3.9
189
+ * fix error with deleting favorites
190
+ * fix wrong type for datapoint
191
+ ### 1.3.8
192
+ * fix forward button widget
193
+ ### 1.3.7
194
+ * fix object creation of states in player modul
186
195
  ### 1.3.6
187
196
  * fix object creation of states
188
197
  ### 1.3.5
@@ -299,8 +308,6 @@ https://github.com/elParaguayo/LMS-CLI-Documentation/blob/master/LMS-CLI.md
299
308
  ## License
300
309
  MIT License
301
310
 
302
- Copyright (c) 2019-2020 oweitman
303
-
304
311
  Permission is hereby granted, free of charge, to any person obtaining a copy
305
312
  of this software and associated documentation files (the "Software"), to deal
306
313
  in the Software without restriction, including without limitation the rights
@@ -318,3 +325,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
318
325
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
319
326
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
320
327
  SOFTWARE.
328
+
329
+ Copyright (c) 2019-2021 oweitman
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "squeezeboxrpc",
4
- "version": "1.3.6",
4
+ "version": "1.3.10",
5
5
  "news": {
6
+ "1.3.10": {
7
+ "en": "* getalbumartist as artist if setting of TPE2/TPE3 in LMS are changed"
8
+ },
9
+ "1.3.9": {
10
+ "en": "* fix error with deleting favorites * fix wrong type for datapoint"
11
+ },
12
+ "1.3.8": {
13
+ "en": "* fix object forward btn widget"
14
+ },
15
+ "1.3.7": {
16
+ "en": "* fix object creation of states in player modul"
17
+ },
6
18
  "1.3.6": {
7
19
  "en": "* fix object creation of states"
8
20
  },
@@ -23,40 +35,9 @@
23
35
  },
24
36
  "1.3.0": {
25
37
  "en": "* fix problem wit setting own icon in player widget / * add infos about alarms to a player datapoint"
26
- },
27
- "1.2.1": {
28
- "en": "* fix small issues in last version"
29
- },
30
- "1.2.0": {
31
- "en": "* improve handling of imageproxy artwork"
32
- },
33
- "1.1.0": {
34
- "en": "* make request of favorites configurable"
35
- },
36
- "1.0.1": {
37
- "en": " * change setstate/createobject logic * fix role and type for Mode-state * update tests * update dependency versions * improve io-package.json"
38
- },
39
- "1.0.0": {
40
- "en": "prepare for stable repository"
41
- },
42
- "0.8.32": {
43
- "en": "the adapter function iobroker.deleteChannel didnt works as expected. it didnt delete the whole subtree of states. now i implement my own delete function"
44
- },
45
- "0.8.31": {
46
- "en": "change behaviour of deleting favorites"
47
- },
48
- "0.8.30": {
49
- "en": "change from the issue of the adapter checker"
50
- },
51
- "0.8.29": {
52
- "en": "optimize handling of player state power and connected"
53
- },
54
- "0.8.28": {
55
- "en": "add advanced signaling function with telnet and fix some more authorization issues with LMS"
56
38
  }
57
39
  },
58
40
  "title": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
59
- "desc": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
60
41
  "desc": {
61
42
  "en": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
62
43
  "de": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
@@ -90,6 +71,8 @@
90
71
  "type": "multimedia",
91
72
  "compact": true,
92
73
  "materialize": true,
74
+ "connectionType":"local",
75
+ "dataSource":"poll",
93
76
  "restartAdapters": [
94
77
  "vis"
95
78
  ],
package/lib/iosbplayer.js CHANGED
@@ -70,7 +70,7 @@ function ioSBPlayer(server,playerdata) {
70
70
  name: 'Mode',
71
71
  read: true,
72
72
  write: false,
73
- type: 'number',
73
+ type: 'string',
74
74
  role: 'media.state',
75
75
  exist: false
76
76
  },
@@ -248,6 +248,14 @@ function ioSBPlayer(server,playerdata) {
248
248
  role: 'media.artist',
249
249
  exist: false
250
250
  },
251
+ 'albumartist': {
252
+ name: 'Artist',
253
+ read: true,
254
+ write: false,
255
+ type: 'string',
256
+ role: 'media.artist',
257
+ exist: false
258
+ },
251
259
  'url': {
252
260
  name: 'Url',
253
261
  read: true,
@@ -496,7 +504,7 @@ function ioSBPlayer(server,playerdata) {
496
504
  this.doAlarmsUpdateStatus = function(result) {
497
505
  this.log.silly('doAlarmsUpdateStatus');
498
506
  let alarmdata = JSON.stringify(result.result);
499
- this.setState(this.sbPlayerStatusMain['alarms'].name,alarmdata,this.statePath,this.playername);
507
+ this.setState(this.sbPlayerStatusMain['alarms'].name,this.convertState(this.sbPlayerStatusMain['alarms'],alarmdata),this.statePath,this.playername);
500
508
  };
501
509
  this.doPlayerUpdateStatus = function(result) {
502
510
  this.log.silly('doPlayerUpdateStatus');
@@ -504,7 +512,7 @@ function ioSBPlayer(server,playerdata) {
504
512
  let playerdata = result.result;
505
513
 
506
514
  for (const key in this.sbPlayerStatusMain) {
507
- let value = null;
515
+ let value = "";
508
516
  if (key == 'state') continue;
509
517
  if (key == 'playlist') continue;
510
518
  if (key == 'playerid') continue;
@@ -529,13 +537,13 @@ function ioSBPlayer(server,playerdata) {
529
537
  if (key == 'remote') value = 0;
530
538
  if (key == 'remote') this.remote = 0;
531
539
  }
532
- this.setState(this.sbPlayerStatusMain[key].name,value,this.statePath,this.playername);
540
+ this.setState(this.sbPlayerStatusMain[key].name,this.convertState(this.sbPlayerStatusMain[key],value),this.statePath,this.playername);
533
541
  }
534
- this.setState(this.sbPlayerStatusMain['playerid'].name,this.playerid,this.statePath,this.playername);
542
+ this.setState(this.sbPlayerStatusMain['playerid'].name,this.convertState(this.sbPlayerStatusMain['playerid'],this.playerid),this.statePath,this.playername);
535
543
  if (!result.result.playlist_loop) return;
536
544
  playerdata = result.result.playlist_loop.find(function(el){return el['playlist index']==this.playlist_cur_index;}.bind(result.result));
537
545
  for (const key in this.sbPlayerStatusLoop) {
538
- let value = null;
546
+ let value = "";
539
547
  if (playerdata.hasOwnProperty(key)) {
540
548
  value = playerdata[key];
541
549
  if (key == 'coverid') {
@@ -555,12 +563,12 @@ function ioSBPlayer(server,playerdata) {
555
563
  value = decodeURIComponent(m[1]);
556
564
  }
557
565
  }
558
- this.setState(this.sbPlayerStatusLoop[key].name,value,this.statePath,this.playername);
566
+ this.setState(this.sbPlayerStatusLoop[key].name,this.convertState(this.sbPlayerStatusLoop[key],value),this.statePath,this.playername);
559
567
  } else {
560
568
  if (key == 'remote_title' && this.remote == 0 ) {
561
569
  value = '';
562
570
  }
563
- if (fullStatus) this.setState(this.sbPlayerStatusLoop[key].name,value,this.statePath,this.playername);
571
+ if (fullStatus) this.setState(this.sbPlayerStatusLoop[key].name,this.convertState(this.sbPlayerStatusLoop[key],value),this.statePath,this.playername);
564
572
  }
565
573
  }
566
574
  if (fullStatus) {
@@ -596,9 +604,9 @@ function ioSBPlayer(server,playerdata) {
596
604
  pla.push(pli);
597
605
  }
598
606
  if (this.adapter.config.useplaylist) {
599
- this.setState(this.sbPlayerStatusMain['playlist'].name,JSON.stringify(pla),this.statePath,this.playername);
607
+ this.setState(this.sbPlayerStatusMain['playlist'].name,this.convertState(this.sbPlayerStatusMain['playlist'],JSON.stringify(pla)),this.statePath,this.playername);
600
608
  } else {
601
- this.setState(this.sbPlayerStatusMain['playlist'].name,'',this.statePath,this.playername);
609
+ this.setState(this.sbPlayerStatusMain['playlist'].name,this.convertState(this.sbPlayerStatusMain['playlist'],''),this.statePath,this.playername);
602
610
  }
603
611
  }
604
612
  return;
@@ -622,7 +630,8 @@ function ioSBPlayer(server,playerdata) {
622
630
  this.sbPlayerStatusMain[key]=this.createObject(stateTemplate,this.statePath, this.playername);
623
631
  }
624
632
  }
625
- for (const key in this.sbPlayerStatusLoop ) {
633
+ for (var key in this.sbPlayerStatusLoop ) {
634
+ if (key=="albumartist") key="artist";
626
635
  const stateTemplate = this.sbPlayerStatusLoop[key];
627
636
  if (!stateTemplate.exist) {
628
637
  this.sbPlayerStatusLoop[key]=this.createObject(stateTemplate,this.statePath, this.playername);
@@ -772,11 +781,6 @@ function ioSBPlayer(server,playerdata) {
772
781
  stateTemplate.exist = true;
773
782
  return stateTemplate;
774
783
  }
775
-
776
-
777
-
778
-
779
-
780
784
  this.request = function(playerid,params, callback) {
781
785
  if (this.connected) this.server.request(playerid, params, callback);
782
786
  };
@@ -793,6 +797,12 @@ function ioSBPlayer(server,playerdata) {
793
797
  this.adapter.setState(name, value, true);
794
798
  }
795
799
  };
800
+ this.convertState = function(stateTemplate,value) {
801
+ if (stateTemplate.type == "string") return String(value);
802
+ if (stateTemplate.type == "number") return Number(value);
803
+ this.log.debug('Missing conversion function for type ' + stateTemplate.type + ' Please report.');
804
+ return value;
805
+ }
796
806
  this.log.silly = function(s) {
797
807
  if (this.logsilly) this.adapter.log.silly(s);
798
808
  }.bind(this);
package/lib/iosbserver.js CHANGED
@@ -417,15 +417,12 @@ function IoSbServer(adapter) {
417
417
  this.checkServerstatusStates(result);
418
418
  for (const key in this.sbServerStatus){
419
419
  if (result.result.hasOwnProperty(key)) {
420
- this.setState(this.sbServerStatus[key].name,result.result[key],this.ServerStatePath);
420
+ this.setState(this.sbServerStatus[key].name,this.convertState(this.sbServerStatus[key],result.result[key]),this.ServerStatePath);
421
421
  }
422
422
  }
423
423
  this.checkNewPlayer(result.result.players_loop);
424
424
  this.checkPlayer(result.result.players_loop);
425
425
  };
426
-
427
-
428
-
429
426
  this.newgetFavorites = function() {
430
427
  this.log.silly('newgetFavorites');
431
428
  this.newgetFavoritesDP(
@@ -469,7 +466,7 @@ function IoSbServer(adapter) {
469
466
  }
470
467
  Promise.all(promises).then(function(){
471
468
  this.log.debug(`All favorite objects deleted`);
472
- callback();
469
+ if (callback) callback();
473
470
  }.bind(this));
474
471
  };
475
472
  this.newsetFavoritesDP = function(favorites) {
@@ -490,7 +487,7 @@ function IoSbServer(adapter) {
490
487
  }
491
488
  const stateTemplate = this.sbFavoritesState[key];
492
489
  this.createObject(stateTemplate,this.FavoritesStatePath,id,
493
- ()=>this.setState(this.sbFavoritesState[key].name,favorite[key],this.FavoritesStatePath,id,false)
490
+ ()=>this.setState(this.sbFavoritesState[key].name,this.convertState(this.sbFavoritesState[key],favorite[key]),this.FavoritesStatePath,id,false)
494
491
  );
495
492
  }
496
493
  }
@@ -754,13 +751,12 @@ function IoSbServer(adapter) {
754
751
  stateTemplate.exist = true;
755
752
  return stateTemplate;
756
753
  };
757
-
758
-
759
-
760
-
761
-
762
- this.test = function() {
763
- };
754
+ this.convertState = function(stateTemplate,value) {
755
+ if (stateTemplate.type == "string") return String(value);
756
+ if (stateTemplate.type == "number") return Number(value);
757
+ this.log.debug('Missing conversion function for type ' + stateTemplate.type + ' Please report.');
758
+ return value;
759
+ }
764
760
  this.log.silly = function(s) {
765
761
  if (this.logsilly) this.adapter.log.silly(s);
766
762
  }.bind(this);
@@ -773,7 +769,6 @@ function IoSbServer(adapter) {
773
769
  this.log.info = function(s) {
774
770
  this.adapter.log.info(s);
775
771
  }.bind(this);
776
- this.test();
777
772
  this.getDiscoverServers();
778
773
  this.sbServer.on('register', this.init.bind(this));
779
774
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.squeezeboxrpc",
3
- "version": "1.3.6",
3
+ "version": "1.3.10",
4
4
  "description": "ioBroker Logitech Squeezebox Adapter over JSON/RPC-Protocol",
5
5
  "author": {
6
6
  "name": "oweitman",
@@ -673,7 +673,7 @@ vis.binds["squeezeboxrpc"] = {
673
673
  var data = event.data.data;
674
674
  var self = event.data.self;
675
675
  var playername = vis.binds["squeezeboxrpc"].getPlayerName(data.widgetPlayer);
676
- var stateid = data.ainstance.join('.')+".Players"+"."+playername+".btnRewind";
676
+ var stateid = data.ainstance.join('.')+".Players"+"."+playername+".btnForward";
677
677
  var state = true
678
678
  vis.setValue(stateid,state);
679
679
  },
@@ -221,4 +221,3 @@
221
221
  %>
222
222
  </div>
223
223
  </script>
224
-