# lg-netcast

> Node package to interact with LG netcast TVs (2012, 2013)

Latest version **1.2.2** (published 2020-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install lg-netcast
pnpm add lg-netcast
yarn add lg-netcast
bun add lg-netcast
```

Provides the command `netcast-cli`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2020-11-24 |
| First published | 2020-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 44.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | David Mohl |
| Maintainers | dvcrn |

## Links

- npm: https://www.npmjs.com/package/lg-netcast
- Repository: https://github.com/dvcrn/lg-netcast
- Homepage: https://github.com/dvcrn/lg-netcast#readme
- Issues: https://github.com/dvcrn/lg-netcast/issues
- npm.io page: https://npm.io/package/lg-netcast

## Dependencies (5)

- [flags](https://npm.io/package/flags.md) ^0.1.3
- [xml-js](https://npm.io/package/xml-js.md) ^1.6.11
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [@types/node](https://npm.io/package/@types/node.md) ^14.14.6
- [timeout-signal](https://npm.io/package/timeout-signal.md) ^1.1.0

## Recent versions

- 1.2.2 (latest) — 2020-11-24
- 1.1.2 — 2020-11-08
- 1.1.1 — 2020-11-08
- 1.1.0 — 2020-11-05
- 1.0.6 — 2020-11-05
- 1.0.5 — 2020-11-05
- 1.0.4 — 2020-11-05
- 1.0.3 — 2020-11-05
- 1.0.2 — 2020-11-05
- 1.0.1 — 2020-11-05
- 1.0.0 — 2020-11-05

## README

# lg-netcast

Netcast client written in js/ts

## Installation

```
npm install lg-netcast
```

## Usage Example

Initialize the client with the API host. By default the port is `:8080`, make sure you add that to your API_HOST

Get current channel information

```typescript
const client = new NetcastClient(API_HOST);
client.get_session(access_token).then(async (session_id) => {
    const cur_channel = await client.get_current_channel(session_id);
    console.log(cur_channel);
});
```

Check the [API docs](./docs.md) for general usage on this package

## Authentication

To interact with the TV, you need a valid `access_token`. The access token is actually just the pair code of the TV, you can get that with `client.display_pair_code()`.

## CLI

This package comes with a very simple CLI to query TV information

```bash
Usage: netcast-cli [options]

Options:
  --host: Host of the TV
    (default: "192.168.1.1:8080")
  --access_token: Pair code of the TV
    (default: "123456")
    (an integer)
  --command: command to issue
    (default: "current_channel")
```

```bash
❯ netcast-cli --host 192.168.1.14:8080 --access_token 1234567
Querying current channel
{
  chtype: 'satellite',
  sourceIndex: '7',
  physicalNum: '265',
  major: '200',
  displayMajor: '200',
  minor: '65535',
  displayMinor: '-1',
  chname: 'スターチャンネル１',
  progName: 'エスケープ・ルーム（２０１９）',
  audioCh: '0',
  inputSourceName: 'TV',
  inputSourceType: '0',
  labelName: {},
  inputSourceIdx: '0'
}
```

## License

MIT

---
_Source: https://npm.io/package/lg-netcast · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
