diff --git a/controller/status.php b/controller/status.php index 5a95e73..616826c 100644 --- a/controller/status.php +++ b/controller/status.php @@ -10,7 +10,7 @@ function getStatus() $streamBegin = Stream::listByState('begin'); $infos = PremiumizeMe::getStatus(); - $tmpRestant = $infos['expires']->diff(new DateTime()); + $tmpRestant = $infos['premium_until']->diff(new DateTime()); $restant = ''; if (0 !== $tmpRestant->m) { diff --git a/lib/PremiumizeMe.php b/lib/PremiumizeMe.php index df7bc52..6b21382 100644 --- a/lib/PremiumizeMe.php +++ b/lib/PremiumizeMe.php @@ -55,8 +55,8 @@ class PremiumizeMe { $fields = [ 'customer_id' => getenv('PREM_CID'), 'pin' => getenv('PREM_PIN') - ]; - + ]; + $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.premiumize.me/api/account/info'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -66,15 +66,12 @@ class PremiumizeMe { $curlResult = curl_exec($ch); curl_close($ch); $data = json_decode($curlResult); + $retour = get_object_vars($data); - var_dump($data); - - $retour = get_object_vars($data->result); $tmpDT = new DateTime(); - $tmpDT->setTimestamp($retour['expires']); - $retour['expires'] = $tmpDT; - var_dump($retour); - exit(); + $tmpDT->setTimestamp($retour['premium_until']); + $retour['premium_until'] = $tmpDT; + return $retour; } @@ -116,6 +113,8 @@ class PremiumizeMe { // On le creer tout de suite pour eviter des conflits de process touch(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$element->filename); + var_dump($premInfos); + exit(); $premInfos = PremiumizeMe::getLink($element->url); if (file_exists(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$premInfos['filename']) || file_exists(DOWNLOADEDDIR.DIRECTORY_SEPARATOR.$premInfos['filename'])) { diff --git a/templates/status.php b/templates/status.php index d97df2c..b36c6a6 100644 --- a/templates/status.php +++ b/templates/status.php @@ -11,8 +11,8 @@
- Expiration : format('d/m/Y') ?> ()
- Traffic Restant : Go (%)
+ Expiration : format('d/m/Y') ?> ()
+ Fair Use Status : %
Ajouté @@ -56,7 +56,7 @@ foreach([ $listAdded, $listDownloading, $listDownloaded, $listDupp ] as $cat) { - <?= $element['event'][0]['ip']; ?> + <?= $element['from']; ?> format('d/m/Y'); ?>