stagelinq 1.0.0 → 1.0.1
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/cli/index.ts +15 -1
- package/devices/Player.ts +2 -1
- package/package.json +2 -1
- package/types/player.ts +1 -0
package/cli/index.ts
CHANGED
|
@@ -2,11 +2,14 @@ import { ActingAsDevice } from '../types';
|
|
|
2
2
|
import { DbConnection } from "../Databases";
|
|
3
3
|
import { sleep } from '../utils/sleep';
|
|
4
4
|
import { StageLinq } from '../StageLinq';
|
|
5
|
+
import * as os from 'os';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
|
|
5
9
|
require('console-stamp')(console, {
|
|
6
10
|
format: ':date(HH:MM:ss) :label',
|
|
7
11
|
});
|
|
8
12
|
|
|
9
|
-
|
|
10
13
|
(async () => {
|
|
11
14
|
|
|
12
15
|
console.log('Starting CLI');
|
|
@@ -89,6 +92,17 @@ require('console-stamp')(console, {
|
|
|
89
92
|
console.error(e);
|
|
90
93
|
}
|
|
91
94
|
}
|
|
95
|
+
|
|
96
|
+
// Example of how to download the actual track from the media.
|
|
97
|
+
try {
|
|
98
|
+
const tempfile = path.resolve(os.tmpdir(), 'media');
|
|
99
|
+
const data = await stageLinq.devices.downloadFile(status.address, status.trackPathAbsolute);
|
|
100
|
+
if (data) fs.writeFileSync(tempfile, Buffer.from(data));
|
|
101
|
+
console.log(`Downloaded ${status.trackPathAbsolute} to ${tempfile}`);
|
|
102
|
+
} catch(e) {
|
|
103
|
+
console.error(`Could not download ${status.trackPathAbsolute}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
console.log('New track loaded:', status);
|
|
93
107
|
});
|
|
94
108
|
|
package/devices/Player.ts
CHANGED
|
@@ -104,7 +104,8 @@ export class Player extends EventEmitter {
|
|
|
104
104
|
: (/Track\/TrackNetworkPath$/.test(name)) ? {
|
|
105
105
|
trackNetworkPath: json.string,
|
|
106
106
|
source: this.getSourceAndTrackPath(json.string).source,
|
|
107
|
-
trackPath: this.getSourceAndTrackPath(json.string).trackPath
|
|
107
|
+
trackPath: this.getSourceAndTrackPath(json.string).trackPath,
|
|
108
|
+
trackPathAbsolute: `/${this.getSourceAndTrackPath(json.string).source}/Engine Library/${this.getSourceAndTrackPath(json.string).trackPath}`
|
|
108
109
|
}
|
|
109
110
|
: (/Track\/SongLoaded$/.test(name)) ? { songLoaded: json.state }
|
|
110
111
|
: (/Track\/SongName$/.test(name)) ? { title: json.string }
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stagelinq",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Typescript library to connect to Denon StageLinq devices",
|
|
5
|
+
"homepage": "https://github.com/chrisle/StageLinq",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
8
|
"start": "node dist/cli/index.js",
|