parent
24719ebed8
commit
fd070ceadd
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DlBlockListConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DlBlockListConfig extends Model {
|
||||
|
||||
/**
|
||||
* @var string[] : list of block list URL source
|
||||
* The block list should be in cidr format
|
||||
* @see http://list.iblocklist.com/?list=bt_level1&fileformat=cidr&archiveformat=
|
||||
*/
|
||||
protected $sources = [];
|
||||
|
||||
/**
|
||||
* @return \string[]
|
||||
*/
|
||||
public function getSources() {
|
||||
return $this->sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string[] $sources
|
||||
*/
|
||||
public function setSources( $sources) {
|
||||
$this->sources = $sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \string $source
|
||||
*/
|
||||
public function addSource( $source) {
|
||||
$this->sources[] = $source;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DlBtConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DlBtConfig extends Model {
|
||||
|
||||
/** @var int : maximum number of peers at a given time */
|
||||
protected $max_peers;
|
||||
|
||||
/** @var int : default stop_ratio for bt Download tasks This value is scaled by a factor 100, for instance a stop_ratio of 200 means that the task will stop once tx_bytes = 2 * size A value of 0 means that the task will continue seeding until it is manually stopped */
|
||||
protected $stop_ratio;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see alphayax\freebox\api\v3\symbols\Download\Config\DlBtConfig\CryptoSupport
|
||||
*/
|
||||
protected $crypto_support;
|
||||
|
||||
/** @var bool : enable the dht protocol */
|
||||
protected $enable_dht;
|
||||
|
||||
/** @var bool : enable the peer exchange protocol */
|
||||
protected $enable_pex;
|
||||
|
||||
/** @var int : timeout in seconds for announcing to tracker */
|
||||
protected $announce_timeout;
|
||||
|
||||
/** @var int : main bittorrent port */
|
||||
protected $main_port;
|
||||
|
||||
/** @var int : bittorrent dht port */
|
||||
protected $dht_port;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxPeers() {
|
||||
return $this->max_peers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $max_peers
|
||||
*/
|
||||
public function setMaxPeers( $max_peers) {
|
||||
$this->max_peers = $max_peers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStopRatio() {
|
||||
return $this->stop_ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $stop_ratio
|
||||
*/
|
||||
public function setStopRatio( $stop_ratio) {
|
||||
$this->stop_ratio = $stop_ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCryptoSupport() {
|
||||
return $this->crypto_support;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $crypto_support
|
||||
*/
|
||||
public function setCryptoSupport( $crypto_support) {
|
||||
$this->crypto_support = $crypto_support;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEnableDht() {
|
||||
return $this->enable_dht;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enable_dht
|
||||
*/
|
||||
public function setEnableDht( $enable_dht) {
|
||||
$this->enable_dht = $enable_dht;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEnablePex() {
|
||||
return $this->enable_pex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enable_pex
|
||||
*/
|
||||
public function setEnablePex( $enable_pex) {
|
||||
$this->enable_pex = $enable_pex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAnnounceTimeout() {
|
||||
return $this->announce_timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $announce_timeout
|
||||
*/
|
||||
public function setAnnounceTimeout( $announce_timeout) {
|
||||
$this->announce_timeout = $announce_timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMainPort() {
|
||||
return $this->main_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $main_port
|
||||
*/
|
||||
public function setMainPort( $main_port) {
|
||||
$this->main_port = $main_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDhtPort() {
|
||||
return $this->dht_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $dht_port
|
||||
*/
|
||||
public function setDhtPort( $dht_port) {
|
||||
$this->dht_port = $dht_port;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DlFeedConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DlFeedConfig extends Model {
|
||||
|
||||
/** @var int : interval between automatic RSS refresh (in minutes) */
|
||||
protected $fetch_interval;
|
||||
|
||||
/** @var int : maximum feed item to keep */
|
||||
protected $max_items;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFetchInterval() {
|
||||
return $this->fetch_interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $fetch_interval
|
||||
*/
|
||||
public function setFetchInterval( $fetch_interval) {
|
||||
$this->fetch_interval = $fetch_interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxItems() {
|
||||
return $this->max_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $max_items
|
||||
*/
|
||||
public function setMaxItems( $max_items) {
|
||||
$this->max_items = $max_items;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DlNewsConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DlNewsConfig extends Model {
|
||||
|
||||
/** @var string : NNTP server hostname */
|
||||
protected $server;
|
||||
|
||||
/** @var int : NNTP server port */
|
||||
protected $port;
|
||||
|
||||
/** @var bool : Use SSL to connect to server if set to true */
|
||||
protected $ssl;
|
||||
|
||||
/** @var string : NNTP auth username (can be empty if no auth is required) */
|
||||
protected $user;
|
||||
|
||||
/** @var string (Write-only) : NNTP auth password (can be empty if no auth is required) */
|
||||
protected $password;
|
||||
|
||||
/** @var int : maximum concurrent connections to the NNTP server */
|
||||
protected $nthreads;
|
||||
|
||||
/** @var bool : automatically check and repair downloaded files using the provided par2 files */
|
||||
protected $auto_repair;
|
||||
|
||||
/** @var bool : if set to true the downloader will download the par2 files only if the download is corrupted */
|
||||
protected $lazy_par2;
|
||||
|
||||
/** @var bool : automatically attempt to extract downloaded files */
|
||||
protected $auto_extract;
|
||||
|
||||
/** @var bool : if auto_extract is enabled, delete archive files once successfully extracted */
|
||||
protected $erase_tmp;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getServer() {
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $server
|
||||
*/
|
||||
public function setServer( $server) {
|
||||
$this->server = $server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPort() {
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $port
|
||||
*/
|
||||
public function setPort( $port) {
|
||||
$this->port = $port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSsl() {
|
||||
return $this->ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $ssl
|
||||
*/
|
||||
public function setSsl( $ssl) {
|
||||
$this->ssl = $ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
*/
|
||||
public function setUser( $user) {
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
*/
|
||||
public function setPassword( $password) {
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNthreads() {
|
||||
return $this->nthreads;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $nthreads
|
||||
*/
|
||||
public function setNthreads( $nthreads) {
|
||||
$this->nthreads = $nthreads;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAutoRepair() {
|
||||
return $this->auto_repair;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $auto_repair
|
||||
*/
|
||||
public function setAutoRepair( $auto_repair) {
|
||||
$this->auto_repair = $auto_repair;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLazyPar2() {
|
||||
return $this->lazy_par2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $lazy_par2
|
||||
*/
|
||||
public function setLazyPar2( $lazy_par2) {
|
||||
$this->lazy_par2 = $lazy_par2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAutoExtract() {
|
||||
return $this->auto_extract;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $auto_extract
|
||||
*/
|
||||
public function setAutoExtract( $auto_extract) {
|
||||
$this->auto_extract = $auto_extract;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEraseTmp() {
|
||||
return $this->erase_tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $erase_tmp
|
||||
*/
|
||||
public function setEraseTmp( $erase_tmp) {
|
||||
$this->erase_tmp = $erase_tmp;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download;
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DlThrottlingConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DlThrottlingConfig extends Model {
|
||||
|
||||
/** @var DlRate : download rate for normal time slot (in B/s) */
|
||||
protected $normal;
|
||||
|
||||
/** @var DlRate : download rate for normal slow slot (in B/s) */
|
||||
protected $slow;
|
||||
|
||||
/** @var string
|
||||
* The schedule array represent the list of week hours timeslot, starting on monday a midnight.
|
||||
* Therefore the complete week is represented in a array of 168 elements (24 * 7)
|
||||
* @see alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig\Schedule
|
||||
*/
|
||||
protected $schedule;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig\Mode
|
||||
*/
|
||||
protected $mode;
|
||||
|
||||
/**
|
||||
* @return DlRate
|
||||
*/
|
||||
public function getNormal() {
|
||||
return $this->normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlRate $normal
|
||||
*/
|
||||
public function setNormal( $normal) {
|
||||
$this->normal = $normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlRate
|
||||
*/
|
||||
public function getSlow() {
|
||||
return $this->slow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlRate $slow
|
||||
*/
|
||||
public function setSlow( $slow) {
|
||||
$this->slow = $slow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSchedule() {
|
||||
return $this->schedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $schedule
|
||||
*/
|
||||
public function setSchedule( $schedule) {
|
||||
$this->schedule = $schedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMode() {
|
||||
return $this->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mode
|
||||
*/
|
||||
public function setMode( $mode) {
|
||||
$this->mode = $mode;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Config;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class DownloadConfig
|
||||
* @package alphayax\freebox\api\v3\models\Download\Config
|
||||
*/
|
||||
class DownloadConfig extends Model {
|
||||
|
||||
/** @var int : max concurrent download tasks */
|
||||
protected $max_downloading_tasks;
|
||||
|
||||
/** @var string : the default path where downloads will be stored (base64 encoded) */
|
||||
protected $download_dir;
|
||||
|
||||
/** @var string : special folder that will be monitored. When a new supported file (.nzb, .torrent) is copied in that folder, the task is automatically added to the download queue. (base64 encoded) */
|
||||
protected $watch_dir;
|
||||
|
||||
/** @var bool : if set to false, the watch_dir will not be monitored */
|
||||
protected $use_watch_dir;
|
||||
|
||||
/** @var DlThrottlingConfig : throttling configuration */
|
||||
protected $throttling;
|
||||
|
||||
/** @var DlNewsConfig : newsgroups configuration */
|
||||
protected $news;
|
||||
|
||||
/** @var DlBtConfig : bittorrent configuration */
|
||||
protected $bt;
|
||||
|
||||
/** @var DlFeedConfig : RSS feed configuration */
|
||||
protected $feed;
|
||||
|
||||
/** @var DlBlockListConfig : block list configuration */
|
||||
protected $blocklist;
|
||||
|
||||
/**
|
||||
* DownloadConfig constructor.
|
||||
* @param array $properties_x
|
||||
*/
|
||||
public function __construct( array $properties_x){
|
||||
parent::__construct( $properties_x);
|
||||
$this->initProperty( 'throttling' , DlThrottlingConfig::class);
|
||||
$this->initProperty( 'news' , DlNewsConfig::class);
|
||||
$this->initProperty( 'bt' , DlBtConfig::class);
|
||||
$this->initProperty( 'feed' , DlFeedConfig::class);
|
||||
$this->initProperty( 'blocklist' , DlBlockListConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxDownloadingTasks() {
|
||||
return $this->max_downloading_tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $max_downloading_tasks
|
||||
*/
|
||||
public function setMaxDownloadingTasks( $max_downloading_tasks) {
|
||||
$this->max_downloading_tasks = $max_downloading_tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDownloadDir() {
|
||||
return $this->download_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $download_dir
|
||||
*/
|
||||
public function setDownloadDir( $download_dir) {
|
||||
$this->download_dir = $download_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getWatchDir() {
|
||||
return $this->watch_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $watch_dir
|
||||
*/
|
||||
public function setWatchDir( $watch_dir) {
|
||||
$this->watch_dir = $watch_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isUseWatchDir() {
|
||||
return $this->use_watch_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $use_watch_dir
|
||||
*/
|
||||
public function setUseWatchDir( $use_watch_dir) {
|
||||
$this->use_watch_dir = $use_watch_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlThrottlingConfig
|
||||
*/
|
||||
public function getThrottling() {
|
||||
return $this->throttling;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlThrottlingConfig $throttling
|
||||
*/
|
||||
public function setThrottling( DlThrottlingConfig $throttling) {
|
||||
$this->throttling = $throttling;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlNewsConfig
|
||||
*/
|
||||
public function getNews() {
|
||||
return $this->news;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlNewsConfig $news
|
||||
*/
|
||||
public function setNews( DlNewsConfig $news) {
|
||||
$this->news = $news;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlBtConfig
|
||||
*/
|
||||
public function getBt() {
|
||||
return $this->bt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlBtConfig $bt
|
||||
*/
|
||||
public function setBt( DlBtConfig $bt) {
|
||||
$this->bt = $bt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlFeedConfig
|
||||
*/
|
||||
public function getFeed() {
|
||||
return $this->feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlFeedConfig $feed
|
||||
*/
|
||||
public function setFeed( DlFeedConfig $feed) {
|
||||
$this->feed = $feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DlBlockListConfig
|
||||
*/
|
||||
public function getBlocklist() {
|
||||
return $this->blocklist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DlBlockListConfig $blocklist
|
||||
*/
|
||||
public function setBlocklist( DlBlockListConfig $blocklist) {
|
||||
$this->blocklist = $blocklist;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\Download\Stats;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
use alphayax\freebox\api\v3\models\Download\DlRate;
|
||||
use alphayax\freebox\api\v3\models\Download\Config\DlRate;
|
||||
|
||||
/**
|
||||
* Class Stats
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\symbols\Download\Config\DlBtConfig;
|
||||
|
||||
/**
|
||||
* Symbol CryptoSupport
|
||||
* @package alphayax\freebox\api\v3\symbols\Download\Config\DlBtConfig
|
||||
* @see alphayax\freebox\api\v3\models\Download\Config\DlBtConfig
|
||||
*/
|
||||
interface CryptoSupport {
|
||||
|
||||
/** will never use bittorrent crypto */
|
||||
const UNSUPPORTED = 'unsupported';
|
||||
|
||||
/** will select plain during handshake */
|
||||
const ALLOWED = 'allowed';
|
||||
|
||||
/** will select crypto during handshake */
|
||||
const PREFERRED = 'preferred';
|
||||
|
||||
/** will allow plain bittorrent */
|
||||
const REQUIRED = 'required';
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig;
|
||||
|
||||
/**
|
||||
* Symbol Mode
|
||||
* @package alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig
|
||||
* @see alphayax\freebox\api\v3\models\Download\Config\DlThrottlingConfig
|
||||
*/
|
||||
interface Mode {
|
||||
|
||||
/** force use of normal rate limits (not using the scheduler) */
|
||||
const NORMAL = 'normal';
|
||||
|
||||
/** force use of slow rate limits (not using the scheduler) */
|
||||
const SLOW = 'slow';
|
||||
|
||||
/** force hibernate (not using the scheduler) */
|
||||
const HIBERNATE = 'hibernate';
|
||||
|
||||
/** use scheduded rate limit */
|
||||
const SCHEDULE = 'schedule';
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig;
|
||||
|
||||
/**
|
||||
* Symbol Schedule
|
||||
* @package alphayax\freebox\api\v3\symbols\Download\Config\DlThrottlingConfig
|
||||
* @see alphayax\freebox\api\v3\models\Download\Config\DlThrottlingConfig
|
||||
*/
|
||||
interface Schedule {
|
||||
|
||||
/** downloads will use normal DlRate config for this timeslot */
|
||||
const NORMAL = 'normal';
|
||||
|
||||
/** downloads will use slow DlRate config for this timeslot */
|
||||
const SLOW = 'slow';
|
||||
|
||||
/** downloads will be paused for this timeslot */
|
||||
const HIBERNATE = 'hibernate';
|
||||
|
||||
}
|
Loading…
Reference in New Issue