Ejemplo n.º 1
0
function cmdLine(array $args)
{
    if ($args[1] === '-c') {
        //If the command line triggers monitor, load monitor functionality.
        if (isset($args[2])) {
            $GLOBALS['custom'] = $args[2];
        }
        releaseView();
    } else {
        if ($args[1] === '-a') {
            remArt($args[2]);
        } else {
            if ($args[1] === '-i') {
                $flacwriter = new Flacwriter();
                $flacwriter->setFile($args[2]);
                $res = json_encode($flacwriter->getMetadata());
                scanLog($res);
                print $res;
                die;
            } else {
                if ($args[1] === '-x') {
                    $ddexml = new Ddexml($args[2]);
                    if (isset($args[3])) {
                        if (isset($args[4])) {
                            $res = $ddexml->getProperty($args[3], $args[4]);
                        } else {
                            $res = $ddexml->getProperty($args[3]);
                        }
                    } else {
                        $res = $ddexml->xmlToJSON();
                    }
                    print json_encode($res, JSON_PRETTY_PRINT);
                    die;
                } else {
                    print "No option specified.";
                    die;
                }
            }
        }
    }
}