@nowtilus/nemo-cli
v2.1.0
Published
Nemo Bridge Command Line Utility
Downloads
18
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:
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 IDNEMO_PASSWORD
- nemo API user password / client secretNEMO_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
./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:
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
Media Deletion
As prerequisite you have to provide the following environment variables.
# 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:
- Find all medias for a CSV list of titles
- Delete the medias from the created list
Find medias for titles
The input file needs to have the following schema
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
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
nemo medias deleteMedias mediasList.csv
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 !!!