Closed philmottin closed 2 years ago
This was fixed today in https://github.com/linuxserver/Heimdall-Apps/pull/551 , you would need to update to the latest version of the apps and it should work.
Thank you!! working now.
I see you even adjusted it a bit 👏
Hello, I'm sorry to bring up an old topic. I would just like to know how I can display the number of movies, etc. in Plex. I have already found the point with "on_deck" and "recently", but I don't know what the other options are called to point to the desired one. I also tried "library", but without success.
Here are my 2 files with the modifications: Keep in mind you will need to change the url requests according to your library IDs. eg. My series library id is 1 so my url is: /library/sections/1/all and so on... Google around how to get your libraries ids.
Plex.php
<?php namespace App\SupportedApps\Plex;
class Plex 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()
{
$test = parent::appTest(
#$this->url("/library/recentlyAdded"),
$this->url("/library/sections/3/all"),
$this->attrs()
);
echo $test->status;
}
public function livestats()
{
$status = "inactive";
$res = parent::execute(
#$this->url("/library/recentlyAdded"),
$this->url("/library/sections/3/all"),
$this->attrs()
);
$body = $res->getBody();
$xml = simplexml_load_string(
$body,
"SimpleXMLElement",
LIBXML_NOCDATA | LIBXML_NOBLANKS
);
$data = [];
if ($xml) {
$data["total_movies"] = $xml["size"];
$status = "active";
}
# SERIES
#$res = parent::execute($this->url("/library/onDeck"),
$res = parent::execute($this->url("/library/sections/1/all"),
$this->attrs());
$body = $res->getBody();
$xml = simplexml_load_string(
$body,
"SimpleXMLElement",
LIBXML_NOCDATA | LIBXML_NOBLANKS
);
if ($xml) {
$data["total_series"] = $xml["size"];
$status = "active";
}
# ANIMATIONS
$res = parent::execute($this->url("/library/sections/4/all"),
$this->attrs());
$body = $res->getBody();
$xml = simplexml_load_string(
$body,
"SimpleXMLElement",
LIBXML_NOCDATA | LIBXML_NOBLANKS
);
if ($xml) {
$data["total_animations"] = $xml["size"];
$status = "active";
}
# ANIMATIONS SERIES
$res = parent::execute($this->url("/library/sections/2/all"),
$this->attrs());
$body = $res->getBody();
$xml = simplexml_load_string(
$body,
"SimpleXMLElement",
LIBXML_NOCDATA | LIBXML_NOBLANKS
);
if ($xml) {
$data["total_animations_series"] = $xml["size"];
$status = "active";
}
# DOCS
$res = parent::execute($this->url("/library/sections/5/all"),
$this->attrs());
$body = $res->getBody();
$xml = simplexml_load_string(
$body,
"SimpleXMLElement",
LIBXML_NOCDATA | LIBXML_NOBLANKS
);
if ($xml) {
$data["total_docs"] = $xml["size"];
$status = "active";
}
return parent::getLiveStats($status, $data);
}
public function url($endpoint)
{
$url = parse_url(parent::normaliseurl($this->config->url));
$scheme = $url["scheme"];
$domain = $url["host"];
$port = isset($url["port"]) ? $url["port"] : "32400";
$api_url =
$scheme .
"://" .
$domain .
":" .
$port .
$endpoint .
"?X-Plex-Token=" .
$this->config->token;
return $api_url;
}
public function getConfigValue($key, $default = null)
{
return isset($this->config) && isset($this->config->$key)
? $this->config->$key
: $default;
}
public function attrs()
{
$ignoreTls = $this->getConfigValue("ignore_tls", false);
if ($ignoreTls) {
$attrs["verify"] = false;
} else {
$attrs = [];
}
return $attrs;
}
}
livestats.blade.php
<ul class="livestats">
<li>
<span class="title">Movies</span>
<strong>{!! $total_movies ?? '' !!}</strong>
</li>
<li>
<span class="title">Animations</span>
<strong>{!! $total_animations ?? '' !!}</strong>
</li>
</ul>
<ul class="livestats">
<li>
<span class="title">Docs</span>
<strong>{!! $total_docs ?? '' !!}</strong>
</li>
<li>
<span class="title">Series</span>
<strong>{!! $total_series ?? '' !!}</strong>
</li>
<li>
<span class="title"> A-series</span>
<strong>{!! $total_animations_series ?? '' !!}</strong>
</li>
</ul>
Thank you very much.
is there somewhere I can read up on what data I can expose to Heimdall here? Thanks in advance
I'm trying to enable optional config to display info on plex app, the api returns OK but nothing shows on dashboard.
I've tried puting the URL in the option config as domain https://plex.mydomamin:443 and also as my private plex ip address http://192.168.1.71:32400 For the token I tried all combinations of those, since each URL gives a different plex-token. All combinations return API OK on test. But nothing is shown on any case. I even tried with the token from plex.tv. Same result, API returns ok but no info is displayed.
Plex server is running on a windows machine. Heimdall is running on docker and is exposed by nginx with subdomain.
Any suggestions please?