diff --git a/fHDHR/device/tuners/tuner.py b/fHDHR/device/tuners/tuner.py index 37f6409..a431012 100644 --- a/fHDHR/device/tuners/tuner.py +++ b/fHDHR/device/tuners/tuner.py @@ -53,12 +53,19 @@ class Tuner(): return stream.get() def set_status(self, stream_args): - self.status = { - "status": "Active", - "method": stream_args["method"], - "accessed": stream_args["accessed"], - "channel": stream_args["channel"], - "proxied_url": stream_args["channelUri"], - "time_start": datetime.datetime.utcnow(), - "downloaded": 0 - } + if self.status["status"] != "Active": + self.status = { + "status": "Active", + "clients": [], + "clients_id": [], + "method": stream_args["method"], + "accessed": [stream_args["accessed"]], + "channel": stream_args["channel"], + "proxied_url": stream_args["channelUri"], + "time_start": datetime.datetime.utcnow(), + "downloaded": 0 + } + if stream_args["client"] not in self.status["clients"]: + self.status["clients"].append(stream_args["client"]) + if stream_args["client_id"] not in self.status["clients_id"]: + self.status["clients_id"].append(stream_args["client_id"]) diff --git a/fHDHR/http/api/watch.py b/fHDHR/http/api/watch.py index 56825c3..a26ef68 100644 --- a/fHDHR/http/api/watch.py +++ b/fHDHR/http/api/watch.py @@ -1,5 +1,6 @@ from flask import Response, request, redirect, abort, stream_with_context import urllib.parse +import uuid from fHDHR.exceptions import TunerError @@ -63,7 +64,8 @@ class Watch(): "duration": duration, "transcode": transcode, "accessed": accessed_url, - "client": client_address + "client": client_address, + "client_id": str(client_address) + "_" + str(uuid.uuid4()) } try: