#!/bin/bash

if [ $# != 2 ] && [ $# != 3 ] ; then
    echo "Usage: $0 input-file.mp3 essentia.profile [output-file.json]" 1>&2
    exit 1
fi

ifile=$1
profile=$2

if [ $# == 3 ] ; then
  ofile=$3
else
    ofile=${ifile%.*}.json
fi

echo "######"
echo "Running extractor on:     $ifile"
echo "  with profile:           $profile"
echo "  generating output file: $ofile"
echo "######"
essentia_streaming_extractor_music $ifile $ofile $profile 

echo "######"

