# python-masters-backfill

## Notes

A raw Youtube asset report is the starting point for this script

To prepare a raw file, the helper script ```prep_files.sh``` may be used:
```
./prep_files.sh <FILE_NAME>
```
This will clean the input file and prepare it for ingestion.

## Usage

### Program Settings
The script uses both environment variables and commandline params to handle program settings. The environment variables are enumerated in config.py; the params are listed below.

### Parameters
```
usage: map_assets_to_tracks.py [-?] [-f FILENAME] [-c #]

Map YouTube assets to Orchard tracks

optional arguments:
  -?, --help            Show this help message and exit.
  -f FILENAME, --filename FILENAME
                        Connect to a file backend for the input source.
  -c #, --count #
                        The number of concurrent processes to run.
```

## Testing

Run:
```
python -u random_spot_compare.py -f <file> -c <#> (-o)
```

where 'file' is the file that was initially ingested and <#> is the number of tests to run. Optionally include -o to open a browser window with the OA listing for the found track.

### Parameters

```
usage: random_spot_compare.py [-?] [-f FILENAME] [-c COUNT] [-o]

Spot check YouTube mapping exercise

optional arguments:
  -?, --help            Show this help message and exit.
  -f FILENAME, --filename FILENAME
                        The file source to check.
  -c COUNT, --count COUNT
                        The count of checks to make.
  -o, --open_url        Automatically opens OA urls.
```


## Notes

### Handy Commands

* ```wc -l <filename>``` will give you the count of lines in 'filename'
* ```sed -n '1,12p' <filename>``` prints out rows 1-12 of 'filename'
* ```grep -n <pattern> <filename>``` prints out any rows that 'pattern' is found in, with the line number
