Skip to content

Commit

Permalink
Make info avaliable to GetGrav
Browse files Browse the repository at this point in the history
  • Loading branch information
hjone72 authored and hjone72 committed Oct 17, 2016
1 parent 828565b commit 3bc9ce8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion inc/modules/getgrav.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ function getGravDetails($User) {
//Print data in a way that Grav is expecting.
include_once('dynamic_management.module.php');
$management_array = dynamicManagement($User);
include_once ('dynamic_menu.module.php');
$support_array = dynamicMenu("Help & Support");
$feature_array = dynamicMenu("Features");

//Send PlexPy Stats to grav.
include_once('plexpyAPI.module.php');
$stats = plexpyAPI('get_libraries', 'library_stats')['response']['data'];
$stat_array = array();
foreach ($stats as $section) {
$stat_array[$section['section_name']] = $section['count'];
if ($section['section_type'] == 'show') {
$stat_array["Episodes"] = $section['child_count'];
}
}


$gravPerms = array (
"admin" => array (
"login" => false,
Expand Down Expand Up @@ -30,8 +46,11 @@ function getGravDetails($User) {
"thumbURL" => $User->getThumb(),
"email" => $User->getEmail(),
"management" => $management_array,
"features" => $feature_array,
"support" => $support_array,
"plexstats" => $stat_array,
"gravPerms" => $gravPerms
);
return $data;
}
?>
?>

0 comments on commit 3bc9ce8

Please sign in to comment.