From 484ea8806e2894c81763c1c795ec5672291fd4f5 Mon Sep 17 00:00:00 2001 From: 12nick12 Date: Wed, 8 Nov 2017 09:57:22 -0500 Subject: [PATCH] Create plexpy_sc.py --- plexpy_sc.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plexpy_sc.py diff --git a/plexpy_sc.py b/plexpy_sc.py new file mode 100644 index 0000000..71830f5 --- /dev/null +++ b/plexpy_sc.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# This reports the stream count + +import json +import requests +import math + +host = '' +api_key = '' +url_base = 'not included slashes' +ssl = 'true/false' + +if ssl == 'true': + http = 'https' +if ssl == 'false': + http = 'http' + +url = http + "://" + host + "/" + url_base + "/api/v2?apikey=" + api_key + "&cmd=get_activity" + +requests.packages.urllib3.disable_warnings() + +response = requests.get(url, verify=False) + +json_input = response.text + +decoded = json.loads(json_input) + +stream_count = decoded['response']['data']['stream_count'] +stream_count = int(stream_count) +stream_audio_bitrate_total = 0 +stream_video_bitrate_total = 0 +stream_bitrate_total = 0 +print(stream_count)