ajout heimdall
This commit is contained in:
63
heimdall/config/www/SupportedApps/HDHomeRun/HDHomeRun.php
Executable file
63
heimdall/config/www/SupportedApps/HDHomeRun/HDHomeRun.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php namespace App\SupportedApps\HDHomeRun;
|
||||
|
||||
class HDHomeRun extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
|
||||
//protected $login_first = true; // Uncomment if api requests need to be authed first
|
||||
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
|
||||
|
||||
function __construct() {
|
||||
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
//echo $this->url('lineup.json?show=found');
|
||||
$test = parent::appTest($this->url('lineup.json?show=found'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('lineup.json?show=found'));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data = [];
|
||||
|
||||
if($details) {
|
||||
$channel_count = count($details);
|
||||
$data['number_of_channels'] = number_format($channel_count);
|
||||
$status = 'active';
|
||||
}
|
||||
|
||||
$res = parent::execute($this->url('tuners.html'));
|
||||
$tunersBody = $res->getBody();
|
||||
if($tunersBody) {
|
||||
$exp = "/<tr>\\s*<td>([^<]+)<\/td>\\s*<td>([^<]+)<\/td><\/tr>/mi";
|
||||
preg_match_all($exp, $tunersBody, $matches, PREG_SET_ORDER, 0);;
|
||||
$inUse = 0;
|
||||
$totalTuners = 0;
|
||||
$match_count = count($matches);
|
||||
for ($i = 0; $i < $match_count; $i++) {
|
||||
if (count($matches[$i]) >= 2) {
|
||||
if ($matches[$i][2] != "none" && $matches[$i][2] != "not in use") {
|
||||
$inUse++;
|
||||
}
|
||||
}
|
||||
$totalTuners++;
|
||||
}
|
||||
$data['tuners_in_use'] = number_format($inUse);
|
||||
$data['tuners_total'] = number_format($totalTuners);
|
||||
$status = 'active';
|
||||
}
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/HDHomeRun/app.json
Executable file
10
heimdall/config/www/SupportedApps/HDHomeRun/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "8fe021dbb159e76695ab080421f68fac90579b0c",
|
||||
"name": "HDHomeRun",
|
||||
"website": "https://www.silicondust.com/",
|
||||
"license": "Proprietary",
|
||||
"description": "The DVR reimagined. Watch and Record all of your favorite live TV. Your way.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "hdhomerun.png"
|
||||
}
|
||||
11
heimdall/config/www/SupportedApps/HDHomeRun/config.blade.php
Executable file
11
heimdall/config/www/SupportedApps/HDHomeRun/config.blade.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<input type="hidden" data-config="dataonly" class="config-item" name="config[dataonly]" value="1" />
|
||||
<div class="input">
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', (isset($item) ? $item->getconfig()->override_url : null), array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
BIN
heimdall/config/www/SupportedApps/HDHomeRun/hdhomerun.png
Executable file
BIN
heimdall/config/www/SupportedApps/HDHomeRun/hdhomerun.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
10
heimdall/config/www/SupportedApps/HDHomeRun/livestats.blade.php
Executable file
10
heimdall/config/www/SupportedApps/HDHomeRun/livestats.blade.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Channels</span>
|
||||
<strong>{!! $number_of_channels !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Tuners<br/>In Use</span>
|
||||
<strong>{!! $tuners_in_use !!} of {!! $tuners_total !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user