Esempio n. 1
0
<?php

/**
 * Tests the FOFSongIterator
 */
include dirname(__FILE__) . '/lib/autoload.php';
$songs = new FOFSongIterator(getcwd());
$songs->addFilter('artist', 'Muse');
foreach ($songs as $song) {
    echo "{$song} (" . $song->directory->path . ")\n";
}
Esempio n. 2
0
        exit;
    } else {
        $output->outputLine("No arguments given", "fatal");
        $output->outputText($input->getHelpText("Auto-link by artist name"));
        exit(1);
    }
} catch (ezcConsoleException $e) {
    die($e->getMessage());
}
if ($input->argumentDefinition["artist"]->value === null) {
    $output->outputLine("The <artist> argument is mandatory", 'fatal');
    $output->outputText($input->getHelpText("Auto-link by artist name"), 'fatal');
    exit;
}
var_dump($verboseOption->value);
$it = new FOFSongIterator('/home/xbmc/fof/songs/Packs');
$it->addFilter('artist', $input->argumentDefinition["artist"]->value);
foreach ($it as $song) {
    $linkName = $song->name;
    if (file_exists($linkName) and $verboseOption->value === true) {
        $output->outputLine("{$linkName} already exists", "info");
    } else {
        $path = $song->directory->getPathname();
        if ($quietOption !== false) {
            $output->outputLine("{$linkName} => {$path}");
        }
        if ($dryRunOption->value !== true) {
            symlink($path, $linkName);
        }
    }
}
Esempio n. 3
0
#!/usr/bin/php
<?php 
include 'lib/autoload.php';
$out = new ezcConsoleOutput();
try {
    $songs = new FOFSongIterator(getcwd());
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
$out->outputLine("MOST PLAYED SONGS");
$songs->addFilter('count', array('>=', 5));
foreach ($songs as $idx => $song) {
    $rang = $idx + 1;
    echo "{$rang}. {$song} ({$song->count})\n";
}