diff --git a/Emby/Emby.php b/Emby/Emby.php index 2544aaac9..1c59a133f 100644 --- a/Emby/Emby.php +++ b/Emby/Emby.php @@ -1,5 +1,62 @@ url('System/Info'), $this->getAttrs()); + echo $test->status; + } + + public function livestats() + { + $status = 'inactive'; + $res = parent::execute($this->url('/emby/Items/Counts'), $this->getAttrs()); + $result = json_decode($res->getBody()); + $details = ['visiblestats'=>[]]; + foreach($this->config->availablestats as $stat) { + $newstat = new \stdClass(); + $newstat->title = self::getAvailableStats()[$stat]; + $newstat->value = $result->{$stat}; + $details['visiblestats'][] = $newstat; + } + return parent::getLiveStats($status, $details); + } + public function url($endpoint) + { + $api_url = parent::normaliseurl($this->config->url).$endpoint; + return $api_url; + } + + private function getAttrs() { + return [ + 'headers' => [ + 'X-Emby-Token' => $this->config->password, + ] + ]; + } + + public static function getAvailableStats() { + return [ + 'MovieCount'=>'Movies', + 'SeriesCount'=>'Series', + 'EpisodeCount'=>'Episodes', + 'GameCount'=>'Games', + 'ArtistCount'=>'Artists', + 'ProgramCount'=>'Programs', + 'GameSystemCount'=>'GameSystems', + 'TrailerCount'=>'Trailers', + 'SongCount'=>'Songs', + 'AlbumCount'=>'Albums', + 'MusicVideoCount'=>'MusicVideos', + 'BoxSetCount'=>'BoxSets', + 'BookCount'=>'Books', + 'ItemCount'=>'Items', + ]; + } +} \ No newline at end of file diff --git a/Emby/app.json b/Emby/app.json index e962e3f1b..81c434a70 100644 --- a/Emby/app.json +++ b/Emby/app.json @@ -4,7 +4,7 @@ "website": "https://emby.media/", "license": "Proprietary", "description": "Emby (formerly Media Browser) is a media server designed to organize, play, and stream audio and video to a variety of devices.", - "enhanced": false, + "enhanced": true, "tile_background": "dark", "icon": "emby.png" } \ No newline at end of file diff --git a/Emby/config.blade.php b/Emby/config.blade.php new file mode 100644 index 000000000..27dc58b55 --- /dev/null +++ b/Emby/config.blade.php @@ -0,0 +1,19 @@ +