{"action":"created","issue":{"url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/61","repository_url":"https://api.github.com/repos/jakewaldron/PlexEmail","labels_url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/61/comments","events_url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/61/events","html_url":"https://github.com/jakewaldron/PlexEmail/issues/61","id":193187857,"number":61,"title":"Feature Request: Library statistics in footer","user":{"login":"ideaprison","id":140623,"avatar_url":"https://avatars.githubusercontent.com/u/140623?v=3","gravatar_id":"","url":"https://api.github.com/users/ideaprison","html_url":"https://github.com/ideaprison","followers_url":"https://api.github.com/users/ideaprison/followers","following_url":"https://api.github.com/users/ideaprison/following{/other_user}","gists_url":"https://api.github.com/users/ideaprison/gists{/gist_id}","starred_url":"https://api.github.com/users/ideaprison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ideaprison/subscriptions","organizations_url":"https://api.github.com/users/ideaprison/orgs","repos_url":"https://api.github.com/users/ideaprison/repos","events_url":"https://api.github.com/users/ideaprison/events{/privacy}","received_events_url":"https://api.github.com/users/ideaprison/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-02T18:42:22Z","updated_at":"2016-12-21T02:41:34Z","closed_at":null,"body":"Title explains a lot.\r\n\r\nI thought it might be neat if the footer showed your Plex's library stats.\r\n\r\n\r\n1000 Movies | 345 Episodes | 1144 Songs\r\nx Days x Hours of entertainment."},"comment":{"url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/comments/268419331","html_url":"https://github.com/jakewaldron/PlexEmail/issues/61#issuecomment-268419331","issue_url":"https://api.github.com/repos/jakewaldron/PlexEmail/issues/61","id":268419331,"user":{"login":"ideaprison","id":140623,"avatar_url":"https://avatars.githubusercontent.com/u/140623?v=3","gravatar_id":"","url":"https://api.github.com/users/ideaprison","html_url":"https://github.com/ideaprison","followers_url":"https://api.github.com/users/ideaprison/followers","following_url":"https://api.github.com/users/ideaprison/following{/other_user}","gists_url":"https://api.github.com/users/ideaprison/gists{/gist_id}","starred_url":"https://api.github.com/users/ideaprison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ideaprison/subscriptions","organizations_url":"https://api.github.com/users/ideaprison/orgs","repos_url":"https://api.github.com/users/ideaprison/repos","events_url":"https://api.github.com/users/ideaprison/events{/privacy}","received_events_url":"https://api.github.com/users/ideaprison/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T02:41:34Z","updated_at":"2016-12-21T02:41:34Z","body":"I forgot to follow up on this. But for those with Plexpy there is an API you can use.\r\nYou'll have to edit the html in /scripts/plexEmail.py\r\n\r\nHere's roughly what I'm using\r\n`## STATS JSON ##\r\ndef GetTime(seconds):\r\n    minutes, seconds = divmod(seconds, 60)\r\n    hours, minutes = divmod(minutes, 60)\r\n    days, hours = divmod(hours, 24)\r\n    return str(days)+'DAYS ' + str(hours)+'HOURS ' + str(minutes)+'MINUTES'\r\n\r\nurl = urllib.urlopen('http://192.168.0.222:8181/api/v2?apikey=XXX&cmd=get_libraries').read()\r\nurl = json.loads(url)\r\n\r\nstatsJSON = url.get('response')\r\nstatsJSON = statsJSON['data']\r\n\r\nstatsTotal = 'MOVIES ' + statsJSON[0]['count'] + ' | SHOWS ' + statsJSON[1]['count'] + ' | EPISODES ' + statsJSON[1]['child_count']\r\n\r\ntimeTVsecs = int(statsJSON[1]['child_count'])\r\ntimeTVsecs = timeTVsecs*2400\r\ntimeTV = GetTime(timeTVsecs)\r\n\r\ntimeMoviesSecs = int(statsJSON[0]['count'])\r\ntimeMoviesSecs = timeMoviesSecs*6900\r\ntimeMovies = GetTime(timeMoviesSecs)`\r\n\r\nand after <!-- /.container —> footer\r\n`        <div id=\"footer\"><center>\r\n        <h1 style=\"font-size:2em;color: #f39c12 !important;width: 100%; text-align: center;\">Stats</h1>\r\n        <h2 style=\"font-size:1em;color: #f39c12 !important;width: 100%; text-align: left; width:75%\">&#9889;  \"\"\" + statsTotal + \"\"\"</h2>\r\n        <h2 style=\"font-size:1em;color: #f39c12 !important;width: 100%; text-align: left; width:75%\">&#127909; \"\"\" + timeMovies + \"\"\"</h2>\r\n        <h2 style=\"font-size:1em;color: #f39c12 !important;width: 100%; text-align: left; width:75%\">&#128250;  \"\"\" + timeTV + \"\"\"</h2>\r\n        <img src=\"http://res.cloudinary.com/fluxcapa/image/upload/c_scale,w_250/v1480731212/ASSETS/giphy.gif\" width=\"125\" height=\"125\" style=\"border-radius:250px; /><div style=\"clear:both;></div>\r\n        <h1 style=\"font-size:2em;color: #f39c12 !important;width: 100%; text-align: center;\"><b>Have fun watching!</b></h1>\r\n        </center></div>`\r\n"}}
{"actor":{"display_login":"ideaprison"}}