-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
3,161 additions
and
4,358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.nyc_output | ||
/examples | ||
/node_modules | ||
/src | ||
/test-result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
test-result/** | ||
node_modules/** | ||
dist/** | ||
coverage/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,46 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": 2017 | ||
"ecmaVersion": 2018 | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"semi": "error", | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-console": [ | ||
"indent": [ | ||
"error", | ||
{ | ||
"allow": ["log"] | ||
} | ||
], | ||
"no-constant-condition": [ | ||
"warn" | ||
4 | ||
] | ||
} | ||
} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"test/**/*.spec.ts" | ||
], | ||
"rules": { | ||
"@typescript-eslint/ban-ts-ignore": "off", | ||
"@typescript-eslint/ban-ts-comment": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.DS_Store | ||
/node_modules/ | ||
/coverage/ | ||
|
||
/node_modules | ||
/dist | ||
/coverage | ||
/.idea/ | ||
/test-result | ||
/.nyc_output | ||
/test-result |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require: | ||
- ts-node/register | ||
- source-map-support/register | ||
full-trace: true | ||
extension: | ||
- ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"cache": false, | ||
"check-coverage": true, | ||
"extension": [ | ||
".ts" | ||
], | ||
"include": [ | ||
"lib/**/*.ts" | ||
], | ||
"exclude": [ | ||
"coverage/**", | ||
"node_modules/**" | ||
], | ||
"temp-directory": "./coverage/.nyc_output", | ||
"sourceMap": true, | ||
"reporter": [ | ||
"text", | ||
"text-summary", | ||
"cobertura", | ||
"html" | ||
], | ||
"all": true, | ||
"instrument": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu:latest | ||
|
||
# ensure local python is preferred over distribution python | ||
ENV PATH /usr/local/bin:$PATH | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y python3-dev python3-pip curl sudo && \ | ||
pip3 install pyatv && \ | ||
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash - && \ | ||
sudo apt-get install -y nodejs | ||
|
||
COPY package*.json "/app/" | ||
WORKDIR "/app" | ||
RUN npm ci | ||
|
||
COPY . "/app/" | ||
CMD ["npm", "run", "test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
import NodePyATVInstance from '../lib/instance'; | ||
|
||
(async () => { | ||
try { | ||
await NodePyATVInstance.check(); | ||
|
||
console.log(''); | ||
console.log('✔ node-pyatv seems to be ready to use!'); | ||
console.log(' Thank you and have a great day. Or night. Whatever.'); | ||
console.log(''); | ||
} | ||
catch(error) { | ||
console.log(''); | ||
console.log('#'.repeat(60)); | ||
console.log('#' + ' '.repeat(58) + '#'); | ||
console.log('# ⚠ Warning: node-pyatv is not ready to be used!' + ' '.repeat(10) + '#'); | ||
console.log('#' + ' '.repeat(58) + '#'); | ||
console.log('# To use the JavaScript module, pyatv >= 0.6.0 must be #'); | ||
console.log('# installed. Unfortunately this could not be found. During #'); | ||
console.log('# the check following error message was reported: #'); | ||
console.log('#' + ' '.repeat(58) + '#'); | ||
console.log( | ||
String(error) | ||
.replace('Error: ', '') | ||
.replace(/(.{1,54})/g, '$1\n') | ||
.split('\n') | ||
.map(l => l.trim()) | ||
.filter(l => Boolean(l)) | ||
.map(l => `# > ${l}${' '.repeat(55 - l.length)}#`) | ||
.join('\n') | ||
); | ||
console.log('#' + ' '.repeat(58) + '#'); | ||
console.log('# You can probably find more information here: #'); | ||
console.log('# https://github.com/sebbo2002/node-pyatv #'); | ||
console.log('#' + ' '.repeat(58) + '#'); | ||
console.log('#'.repeat(60)); | ||
console.log(''); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
import {NodePyATVDeviceOptions, NodePyATVProtocol} from './types'; | ||
|
||
export default class NodePyATVDevice { | ||
private readonly options: NodePyATVDeviceOptions; | ||
|
||
constructor(options: NodePyATVDeviceOptions) { | ||
this.options = Object.assign({}, options); | ||
|
||
// @todo basic validation | ||
} | ||
|
||
get name(): string { | ||
return this.options.name; | ||
} | ||
|
||
get host(): string { | ||
return this.options.host; | ||
} | ||
|
||
get id(): string | undefined { | ||
return this.options.id; | ||
} | ||
|
||
get protocol(): NodePyATVProtocol | undefined { | ||
return this.options.protocol; | ||
} | ||
|
||
get debug(): true | ((msg: string) => void) | undefined { | ||
return this.options.debug; | ||
} | ||
|
||
set debug(debug: true | ((msg: string) => void) | undefined) { | ||
if(typeof debug === 'function') { | ||
this.options.debug = debug; | ||
} else { | ||
this.options.debug = Boolean(debug) || undefined; | ||
} | ||
} | ||
|
||
toJSON(): { name: string; host: string; id: string | undefined; protocol: NodePyATVProtocol | undefined } { | ||
return { | ||
name: this.name, | ||
host: this.host, | ||
id: this.id, | ||
protocol: this.protocol | ||
}; | ||
} | ||
|
||
toString(): string { | ||
return `NodePyATVDevice(${this.name}, ${this.host})`; | ||
} | ||
|
||
/*async getState(options: NodePyATVGetStatusOptions) { | ||
} | ||
async getMediaType(options: NodePyATVGetStatusOptions) { | ||
const state = await this.getState(options); | ||
return state.mediaType; | ||
}*/ | ||
} |
Oops, something went wrong.