# @nowtilus/nemo-cli

> Nemo Bridge Command Line Utility

Latest version **2.1.0** (published 2022-09-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @nowtilus/nemo-cli
pnpm add @nowtilus/nemo-cli
yarn add @nowtilus/nemo-cli
bun add @nowtilus/nemo-cli
```

Provides the command `nemo`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2022-09-09 |
| First published | 2019-01-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 22 |
| Unpacked size | 100 KB |
| Known vulnerabilities | 0 (+38 in 4 direct dependencies) |
| Install scripts | no |
| Author | Sebastian Weikart |
| Maintainers | ronald_now, ingo_now |

## Links

- npm: https://www.npmjs.com/package/@nowtilus/nemo-cli
- Repository: git@git.nowtilus.net:NEMO_BRiDGE/nemo-cli
- npm.io page: https://npm.io/package/@nowtilus/nemo-cli

## Dependencies (22)

- [qs](https://npm.io/package/qs.md) 6.7.0
- [flat](https://npm.io/package/flat.md) 4.1.0
- [xlsx](https://npm.io/package/xlsx.md) 0.18.5
- [async](https://npm.io/package/async.md) ^2.5.0
- [axios](https://npm.io/package/axios.md) 0.27.2
- [colors](https://npm.io/package/colors.md) ^1.3.3
- [dotenv](https://npm.io/package/dotenv.md) 6.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [json2csv](https://npm.io/package/json2csv.md) 4.3.2
- [basic-ftp](https://npm.io/package/basic-ftp.md) 4.6.6
- [commander](https://npm.io/package/commander.md) ^2.11.0
- [csv-parser](https://npm.io/package/csv-parser.md) ^1.12.0
- [object-path](https://npm.io/package/object-path.md) 0.11.8
- [azure-storage](https://npm.io/package/azure-storage.md) 2.10.7
- [moment-timezone](https://npm.io/package/moment-timezone.md) 0.5.37
- [single-line-log](https://npm.io/package/single-line-log.md) 1.1.2
- [csv-write-stream](https://npm.io/package/csv-write-stream.md) ^2.0.0
- [@azure/storage-blob](https://npm.io/package/@azure/storage-blob.md) 12.7.0
- [@azure/ms-rest-nodeauth](https://npm.io/package/@azure/ms-rest-nodeauth.md) 3.0.10
- [countries-and-timezones](https://npm.io/package/countries-and-timezones.md) 1.0.1
- [@azure/arm-mediaservices](https://npm.io/package/@azure/arm-mediaservices.md) 9.0.0

## Recent versions

- 2.1.0 (latest) — 2022-09-09
- 2.0.12 — 2019-12-02
- 2.0.11 — 2019-09-16
- 2.0.10 — 2019-09-16
- 2.0.9 — 2019-07-09
- 2.0.8 — 2019-07-09
- 2.0.7 — 2019-05-28
- 2.0.6 — 2019-04-08
- 2.0.5 — 2019-04-08
- 2.0.4 — 2019-01-22
- 2.0.3 — 2019-01-22
- 2.0.2 — 2019-01-21
- 2.0.1 — 2019-01-21
- 2.0.0 — 2019-01-21
- 0.0.1 — 2019-01-21

## README

# [N]emo [B]ridge [C]ommand [L]ine [U]tility

This project represents the Nemo CLI, which will allow you to operate and execute certain functions of the Nemo Bridge from your favourite Shell.

## Getting Started

### Install

Install NodeJS version 10 or above from: https://nodejs.org

To install or update nemo-cli to the latest version use:

```shell
npm i -g @nowtilus/nemo-cli
```

Note: On Linux and MacOS systems you may have to run the command as root to allow th eglobal installation

```shell
sudo npm i -g @nowtilus/nemo-cli
```

### Usage

After the installation process has finished you can use the tool like

```shell
# General usage
nemo <resource> <action> [options] <file>

# Example
nemo contracts export --studio "Awesome studio" path/to/contracts/directory # Will generate a contracts export to the specified directory
```

If you are not sure how to use the tool for a resource or action you can get help on every level:

```shell
nemo -h # lists all the available resources
nemo <resource> -h # lists the actions for that resource
nemo <resource> <action> -h # explains how to use that action and lists the available options
```

### Environment Variables

To tell the cli-tool which nemo endpoint to connect to and which credentials to use there are some environment variables:

* `NEMO_USER` - nemo API user ID / client ID
* `NEMO_PASSWORD` - nemo API user password / client secret
* `NEMO_ORIGIN` - HTTP endpoint of Nemo API

You can either use them preceding to the programm call like (not recommended):

```shell
NEMO_USER=user \
NEMO_PASSWORD=password \
NEMO_ORIGIN=https://some-nemo.nowtilus.tv \
nemo <resource> <action> [options] <file>
```

Or you can create a `.env` file containing this variables (recommended). The file should be called `.env` and contain the following content:

```text
NEMO_USER=user
NEMO_PASSWORD=password
NEMO_ORIGIN=https://some-nemo.nwtilus.tv
```

You can edit the file with any text editor you like. Note: All values need to be changed according to the system you are requesting.

If the file is in the same folder you are running the nemo-cli it will be automatically detected. Otherwise you can specify it with the CONFIG environment variable:

```shell
# If there is a .env file in your present working directory
nemo <resource> <action> [options] <file>

# If the .env file is else where on your system
# MacOS & Linux:
CONFIG=/path/to/.env nemo <resource> <action> [options] <file>
# Windows:
set CONFIG=/path/to/.env
nemo <resource> <action> [options] <file>
```

This is espacially usefull if you want to switch between multiple environments like staging and production.

## Orders

### importTitles

Generate titles in Nemo from an order list

```bash
nemo orders importTitles -t <type> <file>
```

* Prepare your work folder - have CSV files for season, series, episodes, movies and collections to order

#### Examples

```bash
# Import movies from an order list
nemo orders importTitles --type movie files/movie-orders-title.csv

# Import collections from an order list
nemo orders importTitles -t collection files/collection-orders-title.csv

# Import seasons from an order list
nemo orders importTitles -t episode files/episode-orders-title.csv

# Import seasons from an order list
nemo orders importTitles -t season files/season-orders-title.csv

# Import series from an order list
nemo orders importTitles -t series files/series-orders-title.csv
```

## Licenses

### Export

```bash
nemo licenses export -s <studio> -c <concurrency> <file>
```

Example:

```bash
# export all titles with license
nemo licenses export files/license-report.csv

# export with 4 concurrent requests
nemo licenses export -c 4 files/license-report.csv

# only export titles for the given studio
nemo licenses export -s "20th Century Fox" files/fox-license-report.csv
```

## Promotions

```bash
./cli.js -c order -e staging -h "https://talktalk-nemo-staging.nowtilus.tv" --episodeInput Nowtilus_Order_Form_TVOD_EST_Movie_TV_2018-10-12_EPISODE.csv --clientId admin --clientSecret n0wt1lus
```

### Pomotions Export

The export will produce a list of all current promotions in the system. This list can be changes and imported again later

Example:

```bash
nemo promotions export files/promotions.csv
```

### Pomotions Import

To import a list of promotions you have to specify a CSV file containing all the promotions you want to insert or update in the system.
Note: Always follow the CSV layout (including the correct head line names) defined in the example file: src/promotions/fixtures/promotions.csv

Example:

```bash
nemo promotions import files/promotions.csv
```

## Contracts

### Contracts Export

The export will produce a XLSX file for every contract in the system. This XLSX can be changes and imported again later.

Example:

```bash
# export all contracts as seperate files to a folder
nemo contracts export files/contracts-folder

# export only contracts for a given licensor
nemo contracts export -l "20th Century Fox" files/contracts-folder
```

### Contracts Import

To Import a collection of contract XLSX files or a dedicated one follow the examples below

Example:

```bash
# Import all XLSX files from the given folder
nemo contracts import files/contracts-folder

# Import one dedicated contract
nemo contracts import files/contracts-folder/STUDIO_X.xlsx
```

## Media Deletion

As prerequisite you have to provide the following environment variables.

```bash
# Media Deletion Config
NOWTILUS_MEDIA_PROD_0_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_MEDIA_PROD_1_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_MEDIA_PROD_2_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_MEDIA_PROD_3_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_BULK_INGEST_STORE_0_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_BULK_INGEST_STORE_1_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_BULK_INGEST_STORE_2_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_PROD_INGEST_0_PASSWORD= "<<INSERT_PASSWORD>>"

NOWTILUS_AKAMAI_IMAGE_HOST= "imageprod.upload.akamai.com"
NOWTILUS_AKAMAI_IMAGE_USER= "tt_img_prod_upload1"
NOWTILUS_AKAMAI_IMAGE_PASSWORD= "<<INSERT_PASSWORD>>"
NOWTILUS_AKAMAI_FTP_PATH= "559587"
```

The media deletion flow has two setps:

1. Find all medias for a CSV list of titles
2. Delete the medias from the created list

### Find medias for titles

The input file needs to have the following schema

```csv
Nowtilus_ID
b206355d-d66c-4b43-9f56-81d4bb1d0df6
7924a1dd-7659-4f76-8dd3-c1fc58026a5b
0a3c44c5-1a19-471b-892b-49e3d0c754a0
709f0746-9dd1-4955-bdf0-5c551bbbf98f
```

Note: It's important to have the Nowtilus_ID headline followed by a list of IDs

To create the media list run

```bash
nemo titles medias mediasForTitles -i titlesList.csv mediasList.csv
```

### Delete medias

Note: this command will delete all files for the given media. This includes:

* Sources (Only nowtilusbulkingeststore will not be changed)
* BBTS
* Images
* AMS (HLS, DASH, Smooth Streaming)
* Setting the state of the media to deleted

```bash
nemo medias deleteMedias mediasList.csv
```

# WSR corrections

```bash
nemo wsr format -o <outputPath> -s <separator> -e <ending> <inputPath>

# separator (optional) - refers to the input file, defaults to ","
# ending (optional) - line ending for output file - defaults to "\n"
```

Will take all csv files in inputPath (assuming export from Azure wsrTbExport) and reformat them as we require for Talk-Talk and save as csv in outputPath.

Example:

```bash
 nemo wsr format -o 'C:\data\WSR\output\transformed' 'C:\data\WSR\output\actual'
```

NOTE THAT THE _output_ folder comes first with a -o flag !!!

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