@nowtilus/nemo-cli

Nemo Bridge Command Line Utility

Usage no npm install needed!

<script type="module">
  import nowtilusNemoCli from 'https://cdn.skypack.dev/@nowtilus/nemo-cli';
</script>

README

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

pipeline status coverage report

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:

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

sudo npm i -g @nowtilus/nemo-cli

Usage

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

# 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:

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):

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:

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:

# 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

nemo orders importTitles -t <type> <file>
  • Prepare your work folder - have CSV files for season, series, episodes, movies and collections to order

Examples

# 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

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

Example:

# 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

<<<<<<< HEAD ./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

Create a License CSV Export

=======

Pomotions Export

develop

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

Example:

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:

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:

# 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:

# 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

WSR corrections

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:

    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 !!!

Split avails file

nemo avails split -o <outputPath> -s <sheetName> -l <columnHeadersLine> -i <titleColumn> -m <maxLinesPerFile> <file>

# outputPath, [optional] outputPath for results, defaults to same as file.
# sheetName, [optional] worksheet name, defaults to "Avails". You can also use an index (like 0) instead of sheet name,
# columnHeadersLine [required] the line number of the line on the spreadsheet that has the column names.
# titleColumn [required] Column name that is present for all titles and uniquely identifies a title.
# maxLinesPerFile [required] maximum lines per output file. A title will never span files, so files can possibly be larger.

Will split avails file into smaller chunks to stop AvMa failing. Files are named after the input file e.g. for input file sampleAvails.0.xlsx, you get sampleAvails.0.xlsx, sampleAvails.1.xlsx etc...

Example:

    nemo avails split -o 'C:\data\availsplit\output\' -l 14 -i 'Title Name' -m 3000 'C:\data\avails\sampleAvails.xlsx'