Пример #1
0
/**
 * @param $config
 * @param $App
 * @return array
 */
function checkRSS($config, $App)
{
    echo "Scan RSS {$config['rss']} for pattern {$config['pattern']}" . PHP_EOL;
    $rss = simplexml_load_file($config['rss']);
    foreach ($rss->xpath('//item') as $item) {
        $title = (string) $item->xpath('title')[0];
        $date = (string) $item->xpath('pubDate')[0];
        $link = (string) $item->xpath('link')[0];
        $desc = (string) $item->xpath('description')[0];
        if (preg_match($config['pattern'], $title)) {
            if (strtotime($date) > $config['last_date']) {
                $config['last_date'] = strtotime($date);
                $Downloads = new \alphayax\freebox\api\v3\services\download\Download($App);
                $Downloads->addFromUrl($link);
                echo "Add download {$title} ({$desc})" . PHP_EOL;
            }
        }
    }
    return $config;
}
Пример #2
0
<?php

/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.download', 'PHP API Example (Download)', '1.0.0');
$App->authorize();
$App->openSession();
/// List of all downloads
$DownloadService = new \alphayax\freebox\api\v3\services\download\Download($App);
$Downloads = $DownloadService->getAll();
print_r($Downloads);
/// Stats
$Stats = $DownloadService->getStats();
print_r($Stats);
/// Files
$Files = $DownloadService->getFilesFromId($Downloads[0]->getId());
print_r($Files);
/// Priority
$Success = $DownloadService->updateFilePriority($Downloads[0]->getId(), $Files[0]->getId(), \alphayax\freebox\api\v3\symbols\Download\File\Priority::HIGH);
print_r($Success);
$Files = $DownloadService->getFilesFromId($Downloads[0]->getId());
print_r($Files);
Пример #3
0
<?php

/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application('com.alphayax.freebox.download', 'PHP API Example (Download)', '1.0.0');
$App->authorize();
$App->openSession();
/// List of all downloads
$DownloadService = new \alphayax\freebox\api\v3\services\download\Download($App);
$Downloads = $DownloadService->getAll();
print_r($Downloads);
/// Trackers
$TrackerService = new \alphayax\freebox\api\v3\services\download\Tracker($App);
$Trackers = $TrackerService->getAll($Downloads[1]->getId());
print_r($Trackers);
/// Peers
$PeerService = new \alphayax\freebox\api\v3\services\download\Peer($App);
$Peers = $PeerService->getAll($Downloads[0]->getId());
print_r($Peers);
$BLService = new \alphayax\freebox\api\v3\services\download\BlackList($App);
$BLEntries = $BLService->getAllFromDownloadTaskId($Downloads[0]->getId());
print_r($BLEntries);