Skip to content

Commit

Permalink
Finalize Download core api
Browse files Browse the repository at this point in the history
Update Download examples
  • Loading branch information
alphayax committed May 24, 2016
1 parent ba24054 commit 6af7249
Show file tree
Hide file tree
Showing 10 changed files with 378 additions and 26 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@
/vendor/*

# Project files
/exemple/AirMedia/app_token
exemple/Call/app_token
/exemple/config/app_token
/exemple/download/app_token
/exemple/FileSystem/app_token
/app_token
/exemple/**/app_token
8 changes: 4 additions & 4 deletions exemple/FileSystem/fileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
$App->openSession();

$FileUploadService = new \alphayax\freebox\api\v3\services\FileSystem\FileUpload( $App);
/*
$authID = $FileUploadService->createAuthorization('/Disque dur/Photos/', 'P3140017.jpg');
$success = $FileUploadService->uploadFile( $authID, '/home/alphayax/Bureau/P3140017.jpg');

$authID = $FileUploadService->createAuthorization('/Disque dur/Vidéos/', 'Game.of.Thrones.S06E05.SUBFRENCH.1080i.HDTV.H264-LiBERTY.mkv');
$success = $FileUploadService->uploadFile( $authID, '/home/alphayax/Game.of.Thrones.S06E05.SUBFRENCH.1080i.HDTV.H264-LiBERTY.mkv');
print_r( $success); // 1939839620
*/


$AllUploads = $FileUploadService->getAll();
print_r( $AllUploads);
Expand Down
14 changes: 14 additions & 0 deletions exemple/download/Download.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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();

/// Download
$DownloadService = new \alphayax\freebox\api\v3\services\download\Download( $App);
$Downloads = $DownloadService->getAll();
print_r( $Downloads);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rss": "https:\/\/www.nyaa.se\/?page=rss&user=175467",
"pattern": "\/One_Piece.*HD.*mp4\/",
"last_date": 1463304765
"last_date": 1463909172
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use alphayax\utils\cli\IO;

/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
require_once '../../../vendor/autoload.php';

/// Define our application
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.example', 'Freebox PHP API Example', '0.0.2');
Expand Down
249 changes: 249 additions & 0 deletions freebox/api/v3/models/Download/Task.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
<?php
namespace alphayax\freebox\api\v3\models\Download;
use alphayax\freebox\api\v3\Model;

/**
* Class Task
* @package alphayax\freebox\api\v3\models\Download
*/
class Task extends Model {

/** @var int (Read-only) : id */
protected $id;

/**
* @var string (Read-only)
* @see alphayax\freebox\api\v3\symbols\Download\Task\Type
*/
protected $type;

/** @var string (Read-only) */
protected $name;

/**
* @var string
* @see alphayax\freebox\api\v3\symbols\Download\Task\Status
*/
protected $status;

/** @var int (Read-only) : download size (in Bytes) */
protected $size;

/** @var int : position in download queue (0 if not queued) */
protected $queue_pos;

/**
* @var string
* @see alphayax\freebox\api\v3\symbols\Download\Task\IoPriority
*/
protected $io_priority;

/** @var int (Read-only) : transmitted bytes (including protocol overhead) */
protected $tx_bytes;

/** @var int (Read-only) : received bytes (including protocol overhead) */
protected $rx_bytes;

/** @var int (Read-only) : current transmit rate (in byte/s) */
protected $tx_rate;

/** @var int (Read-only) : current receive rate (in byte/s) */
protected $rx_rate;

/**
* @var int (Read-only) : transmit percentage (without protocol overhead)
* To improve precision the value as been scaled by 100 so that a tx_pct of 123 means 1.23%
*/
protected $tx_pct;

/**
* @var int (Read-only) : received percentage (without protocol overhead)
* To improve precision the value as been scaled by 100 so that a tx_pct of 123 means 1.23%
*/
protected $rx_pct;

/** @var string (Read-only) : An error code */
protected $error;

/** @var int timestamp (Read-only) : timestamp of the download creation time */
protected $created_ts;

/** @var int (Read-only) : estimated remaining download time (in seconds) */
protected $eta;

/** @var string (Read-only) : directory where the file(s) will be saved (base64 encoded) */
protected $download_dir;

/**
* @var int (Read-only) Only relevant for bittorrent tasks.
* Once the transmit ration has been reached the task will stop seeding.
* The ratio is scaled by 100 to improve resolution.
* A stop_ratio of 150 means that the task will stop seeding once tx_bytes = 1.5 * rx_bytes.
*/
protected $stop_ratio;

/** @var string : (only relevant for nzb) password for extracting downloaded archives */
protected $archive_password;

/**
* @return int
*/
public function getId() {
return $this->id;
}

/**
* @return string
*/
public function getType() {
return $this->type;
}

/**
* @return string
*/
public function getName() {
return $this->name;
}

/**
* @return string
*/
public function getStatus() {
return $this->status;
}

/**
* @param string $status
*/
public function setStatus($status) {
$this->status = $status;
}

/**
* @return int
*/
public function getSize() {
return $this->size;
}

/**
* @return int
*/
public function getQueuePos() {
return $this->queue_pos;
}

/**
* @param int $queue_pos
*/
public function setQueuePos($queue_pos) {
$this->queue_pos = $queue_pos;
}

/**
* @return string
*/
public function getIoPriority() {
return $this->io_priority;
}

/**
* @param string $io_priority
*/
public function setIoPriority($io_priority) {
$this->io_priority = $io_priority;
}

/**
* @return int
*/
public function getTxBytes() {
return $this->tx_bytes;
}

/**
* @return int
*/
public function getRxBytes() {
return $this->rx_bytes;
}

/**
* @return int
*/
public function getTxRate() {
return $this->tx_rate;
}

/**
* @return int
*/
public function getRxRate() {
return $this->rx_rate;
}

/**
* @return int
*/
public function getTxPct() {
return $this->tx_pct;
}

/**
* @return int
*/
public function getRxPct() {
return $this->rx_pct;
}

/**
* @return string
*/
public function getError() {
return $this->error;
}

/**
* @return int
*/
public function getCreatedTs() {
return $this->created_ts;
}

/**
* @return int
*/
public function getEta() {
return $this->eta;
}

/**
* @return string
*/
public function getDownloadDir() {
return $this->download_dir;
}

/**
* @return int
*/
public function getStopRatio() {
return $this->stop_ratio;
}

/**
* @return string
*/
public function getArchivePassword() {
return $this->archive_password;
}

/**
* @param string $archive_password
*/
public function setArchivePassword($archive_password) {
$this->archive_password = $archive_password;
}

}
Loading

0 comments on commit 6af7249

Please sign in to comment.