diff --git a/README.md b/README.md index 9be9747..e697771 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées : - Download Stats - Download Files - Download Configuration - - Bittorent Trackers + - Bittorent + - Trackers + - Peers - Configuration - Connection - Connection (Core) @@ -138,5 +140,6 @@ Les exemples sont disponibles dans le repertoire `exemple`. Ils sont classés pa - `Download` : Listage des téléchargement en cours, liste des fichiers d'un téléchargement et mise a jour de la priorité de téléchargement - `DlConfig` : Affichage des configurations de téléchargement (bt, nntp...) - `dl_rss` : Un script qui parse les flux RSS et qui rajoute en téléchagement les items correspondant a une expression réguliere + - `Bittorrent` : Affiche des infos sur des telechargements bittorent \ No newline at end of file diff --git a/TODO.md b/TODO.md index b1e1664..9597903 100644 --- a/TODO.md +++ b/TODO.md @@ -3,7 +3,7 @@ - ~~Download Stats~~ - ~~Download Files~~ - ~~Download Trackers [UNSTABLE]~~ - - Download Peers [UNSTABLE] + - ~~Download Peers [UNSTABLE]~~ - Download Blacklist [UNSTABLE] - Download Feeds - ~~Download Configuration~~ diff --git a/exemple/download/Trackers.php b/exemple/download/Bittorent.php similarity index 67% rename from exemple/download/Trackers.php rename to exemple/download/Bittorent.php index 3ecd478..03eb12f 100644 --- a/exemple/download/Trackers.php +++ b/exemple/download/Bittorent.php @@ -13,9 +13,14 @@ $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); -$a = $TrackerService->getAll( $Downloads[1]->getId()); +$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); -print_r( $a); diff --git a/freebox/api/v3/models/Download/Peer.php b/freebox/api/v3/models/Download/Peer.php new file mode 100644 index 0000000..dca2757 --- /dev/null +++ b/freebox/api/v3/models/Download/Peer.php @@ -0,0 +1,150 @@ +host; + } + + /** + * @return int + */ + public function getPort() { + return $this->port; + } + + /** + * @return string + */ + public function getState() { + return $this->state; + } + + /** + * @return string + */ + public function getOrigin() { + return $this->origin; + } + + /** + * @return mixed + */ + public function getProtocol() { + return $this->protocol; + } + + /** + * @return string + */ + public function getClient() { + return $this->client; + } + + /** + * @return string + */ + public function getCountryCode() { + return $this->country_code; + } + + /** + * @return int + */ + public function getTx() { + return $this->tx; + } + + /** + * @return int + */ + public function getRx() { + return $this->rx; + } + + /** + * @return int + */ + public function getTxRate() { + return $this->tx_rate; + } + + /** + * @return int + */ + public function getRxRate() { + return $this->rx_rate; + } + + /** + * @return int + */ + public function getProgress() { + return $this->progress; + } + + /** + * @return \int[] (Read-only) + */ + public function getRequests() { + return $this->requests; + } + +} diff --git a/freebox/api/v3/services/download/Peer.php b/freebox/api/v3/services/download/Peer.php new file mode 100644 index 0000000..467996f --- /dev/null +++ b/freebox/api/v3/services/download/Peer.php @@ -0,0 +1,34 @@ +getAuthService( $service); + $rest->GET(); + + $DownloadPeer_xs = @$rest->getCurlResponse()['result'] ?: []; + $DownloadPeers = []; + foreach( $DownloadPeer_xs as $DownloadPeer_x) { + $DownloadPeers[] = new models\Download\Peer( $DownloadPeer_x); + } + return $DownloadPeers; + } + +} diff --git a/freebox/api/v3/symbols/Download/Peer/Origin.php b/freebox/api/v3/symbols/Download/Peer/Origin.php new file mode 100644 index 0000000..e320487 --- /dev/null +++ b/freebox/api/v3/symbols/Download/Peer/Origin.php @@ -0,0 +1,25 @@ +