iobroker.squeezeboxrpc 1.3.5 → 1.3.9

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.9
187
+ * fix error with deleting favorites
188
+ * fix wrong type for datapoint
189
+ ### 1.3.8
190
+ * fix forward button widget
191
+ ### 1.3.7
192
+ * fix object creation of states in player modul
193
+ ### 1.3.6
194
+ * fix object creation of states
186
195
  ### 1.3.5
187
196
  * fix object creation for favorites
188
197
  ### 1.3.4
@@ -297,8 +306,6 @@ https://github.com/elParaguayo/LMS-CLI-Documentation/blob/master/LMS-CLI.md
297
306
  ## License
298
307
  MIT License
299
308
 
300
- Copyright (c) 2019-2020 oweitman
301
-
302
309
  Permission is hereby granted, free of charge, to any person obtaining a copy
303
310
  of this software and associated documentation files (the "Software"), to deal
304
311
  in the Software without restriction, including without limitation the rights
@@ -316,3 +323,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
316
323
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
317
324
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
318
325
  SOFTWARE.
326
+
327
+ 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.5",
4
+ "version": "1.3.9",
5
5
  "news": {
6
+ "1.3.9": {
7
+ "en": "* fix error with deleting favorites * fix wrong type for datapoint"
8
+ },
9
+ "1.3.8": {
10
+ "en": "* fix object forward btn widget"
11
+ },
12
+ "1.3.7": {
13
+ "en": "* fix object creation of states in player modul"
14
+ },
15
+ "1.3.6": {
16
+ "en": "* fix object creation of states"
17
+ },
6
18
  "1.3.5": {
7
19
  "en": "* fix object creation for favorites"
8
20
  },
@@ -20,40 +32,9 @@
20
32
  },
21
33
  "1.3.0": {
22
34
  "en": "* fix problem wit setting own icon in player widget / * add infos about alarms to a player datapoint"
23
- },
24
- "1.2.1": {
25
- "en": "* fix small issues in last version"
26
- },
27
- "1.2.0": {
28
- "en": "* improve handling of imageproxy artwork"
29
- },
30
- "1.1.0": {
31
- "en": "* make request of favorites configurable"
32
- },
33
- "1.0.1": {
34
- "en": " * change setstate/createobject logic * fix role and type for Mode-state * update tests * update dependency versions * improve io-package.json"
35
- },
36
- "1.0.0": {
37
- "en": "prepare for stable repository"
38
- },
39
- "0.8.32": {
40
- "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"
41
- },
42
- "0.8.31": {
43
- "en": "change behaviour of deleting favorites"
44
- },
45
- "0.8.30": {
46
- "en": "change from the issue of the adapter checker"
47
- },
48
- "0.8.29": {
49
- "en": "optimize handling of player state power and connected"
50
- },
51
- "0.8.28": {
52
- "en": "add advanced signaling function with telnet and fix some more authorization issues with LMS"
53
35
  }
54
36
  },
55
37
  "title": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
56
- "desc": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
57
38
  "desc": {
58
39
  "en": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
59
40
  "de": "SqueezeboxRPC: Controller for Logitech media Server over RPC-protokol",
@@ -87,6 +68,8 @@
87
68
  "type": "multimedia",
88
69
  "compact": true,
89
70
  "materialize": true,
71
+ "connectionType":"local",
72
+ "dataSource":"poll",
90
73
  "restartAdapters": [
91
74
  "vis"
92
75
  ],
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
  },
@@ -496,7 +496,7 @@ function ioSBPlayer(server,playerdata) {
496
496
  this.doAlarmsUpdateStatus = function(result) {
497
497
  this.log.silly('doAlarmsUpdateStatus');
498
498
  let alarmdata = JSON.stringify(result.result);
499
- this.setState(this.sbPlayerStatusMain['alarms'].name,alarmdata,this.statePath,this.playername);
499
+ this.setState(this.sbPlayerStatusMain['alarms'].name,this.convertState(this.sbPlayerStatusMain['alarms'],alarmdata),this.statePath,this.playername);
500
500
  };
501
501
  this.doPlayerUpdateStatus = function(result) {
502
502
  this.log.silly('doPlayerUpdateStatus');
@@ -504,7 +504,7 @@ function ioSBPlayer(server,playerdata) {
504
504
  let playerdata = result.result;
505
505
 
506
506
  for (const key in this.sbPlayerStatusMain) {
507
- let value = null;
507
+ let value = "";
508
508
  if (key == 'state') continue;
509
509
  if (key == 'playlist') continue;
510
510
  if (key == 'playerid') continue;
@@ -529,13 +529,13 @@ function ioSBPlayer(server,playerdata) {
529
529
  if (key == 'remote') value = 0;
530
530
  if (key == 'remote') this.remote = 0;
531
531
  }
532
- this.setState(this.sbPlayerStatusMain[key].name,value,this.statePath,this.playername);
532
+ this.setState(this.sbPlayerStatusMain[key].name,this.convertState(this.sbPlayerStatusMain[key],value),this.statePath,this.playername);
533
533
  }
534
- this.setState(this.sbPlayerStatusMain['playerid'].name,this.playerid,this.statePath,this.playername);
534
+ this.setState(this.sbPlayerStatusMain['playerid'].name,this.convertState(this.sbPlayerStatusMain['playerid'],this.playerid),this.statePath,this.playername);
535
535
  if (!result.result.playlist_loop) return;
536
536
  playerdata = result.result.playlist_loop.find(function(el){return el['playlist index']==this.playlist_cur_index;}.bind(result.result));
537
537
  for (const key in this.sbPlayerStatusLoop) {
538
- let value = null;
538
+ let value = "";
539
539
  if (playerdata.hasOwnProperty(key)) {
540
540
  value = playerdata[key];
541
541
  if (key == 'coverid') {
@@ -555,12 +555,12 @@ function ioSBPlayer(server,playerdata) {
555
555
  value = decodeURIComponent(m[1]);
556
556
  }
557
557
  }
558
- this.setState(this.sbPlayerStatusLoop[key].name,value,this.statePath,this.playername);
558
+ this.setState(this.sbPlayerStatusLoop[key].name,this.convertState(this.sbPlayerStatusLoop[key],value),this.statePath,this.playername);
559
559
  } else {
560
560
  if (key == 'remote_title' && this.remote == 0 ) {
561
561
  value = '';
562
562
  }
563
- if (fullStatus) this.setState(this.sbPlayerStatusLoop[key].name,value,this.statePath,this.playername);
563
+ if (fullStatus) this.setState(this.sbPlayerStatusLoop[key].name,this.convertState(this.sbPlayerStatusLoop[key],value),this.statePath,this.playername);
564
564
  }
565
565
  }
566
566
  if (fullStatus) {
@@ -596,9 +596,9 @@ function ioSBPlayer(server,playerdata) {
596
596
  pla.push(pli);
597
597
  }
598
598
  if (this.adapter.config.useplaylist) {
599
- this.setState(this.sbPlayerStatusMain['playlist'].name,JSON.stringify(pla),this.statePath,this.playername);
599
+ this.setState(this.sbPlayerStatusMain['playlist'].name,this.convertState(this.sbPlayerStatusMain['playlist'],JSON.stringify(pla)),this.statePath,this.playername);
600
600
  } else {
601
- this.setState(this.sbPlayerStatusMain['playlist'].name,'',this.statePath,this.playername);
601
+ this.setState(this.sbPlayerStatusMain['playlist'].name,this.convertState(this.sbPlayerStatusMain['playlist'],''),this.statePath,this.playername);
602
602
  }
603
603
  }
604
604
  return;
@@ -772,11 +772,6 @@ function ioSBPlayer(server,playerdata) {
772
772
  stateTemplate.exist = true;
773
773
  return stateTemplate;
774
774
  }
775
-
776
-
777
-
778
-
779
-
780
775
  this.request = function(playerid,params, callback) {
781
776
  if (this.connected) this.server.request(playerid, params, callback);
782
777
  };
@@ -793,6 +788,12 @@ function ioSBPlayer(server,playerdata) {
793
788
  this.adapter.setState(name, value, true);
794
789
  }
795
790
  };
791
+ this.convertState = function(stateTemplate,value) {
792
+ if (stateTemplate.type == "string") return String(value);
793
+ if (stateTemplate.type == "number") return Number(value);
794
+ this.log.debug('Missing conversion function for type ' + stateTemplate.type + ' Please report.');
795
+ return value;
796
+ }
796
797
  this.log.silly = function(s) {
797
798
  if (this.logsilly) this.adapter.log.silly(s);
798
799
  }.bind(this);
package/lib/iosbserver.js CHANGED
@@ -13,7 +13,7 @@ function IoSbServer(adapter) {
13
13
  name: 'LastScan',
14
14
  read: true,
15
15
  write: false,
16
- type: 'number',
16
+ type: 'string',
17
17
  role: 'value',
18
18
  exist: false
19
19
  },
@@ -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.5",
3
+ "version": "1.3.9",
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
-