diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..130e443 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + +Copyright (C) 2017 Sam Zick + +Everyone is permitted to copy and distribute verbatim or modified +copies of this license document, and changing it is allowed as long +as the name is changed. + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/README.md b/README.md index 12ce219..9729309 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ -# fHDHR_plugin_origin_plextv +

fHDHR origin Plugin USTVGO Logo

+ +Welcome to the world of streaming content as a DVR device! We use some fancy python here to achieve a system of: + +**f**un +**H**ome +**D**istribution +**H**iatus +**R**ecreation + +fHDHR is labeled as beta until we reach v1.0.0 + +Join us in `#fHDHR `_ on Freenode. + +# Installation + +1) Review Installation guide located at [Docs](https://github.com/fHDHR/fHDHR/blob/main/docs/README.md) + +2) Insert this plugin into the `plugins` directory of fHDHR using `git clone` or downloading a release zip file. + +3) Adjust your configuration file with the below settings: + +```` +[ustvgo] +```` diff --git a/epg/__init__.py b/epg/__init__.py new file mode 100644 index 0000000..9dfcbd6 --- /dev/null +++ b/epg/__init__.py @@ -0,0 +1,15 @@ + + +class Plugin_OBJ(): + + def __init__(self, channels, plugin_utils): + self.plugin_utils = plugin_utils + + self.channels = channels + + self.origin = plugin_utils.origin + + def update_epg(self): + programguide = {} + + return programguide diff --git a/epg/plugin.json b/epg/plugin.json new file mode 100644 index 0000000..2dbec65 --- /dev/null +++ b/epg/plugin.json @@ -0,0 +1,3 @@ +{ + "type":"alt_epg" +} diff --git a/origin/__init__.py b/origin/__init__.py new file mode 100644 index 0000000..8234c60 --- /dev/null +++ b/origin/__init__.py @@ -0,0 +1,89 @@ +import json +import requests + + +class Plugin_OBJ(): + + def __init__(self, plugin_utils): + self.plugin_utils = plugin_utils + + @property + def tuners(self): + return self.plugin_utils.config.dict["ustvgo"]["tuners"] + + @property + def stream_method(self): + return self.plugin_utils.config.dict["ustvgo"]["stream_method"] + + def get_channels(self): + + channel_list = [] + + return channel_list + + channels_url = "https://tv.jsrdn.com/tv_v5/getfeed.php" + payload = {} + url_headers = { + 'authority': 'tv.jsrdn.com', + 'accept': 'application/json, text/javascript, */*; q=0.01', + 'sec-fetch-dest': 'empty', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + 'origin': 'https://www.distro.tv', + 'sec-fetch-site': 'cross-site', + 'sec-fetch-mode': 'cors', + 'referer': 'https://www.distro.tv/live', + 'accept-language': 'en-US,en;q=0.9' + } + chan_req = self.plugin_utils.web.session.get(channels_url, headers=url_headers) + print(chan_req.status_code) + data = json.loads(chan_req.content) + print(data) + + data = chan_req.json() + print(data) + + response = requests.request("GET", channels_url, headers=url_headers, data=payload).content + data = json.loads(response) + print(data) + + return channel_list + + response = requests.request("GET", channels_url, headers=url_headers, data=payload).content + data = json.loads(response) + print(data) + topics = data['topics'] + for t in topics: + title = t['title'] + Type = t['type'] + if Type == "live": + print(title) + + return channel_list + + channels_url = "https://ustvgo.tv/tvguide/national.json" + + chan_req = self.plugin_utils.web.session.get(channels_url) + entries = chan_req.json() + + channel_list = [] + chan_number_index = 0 + for channel_dict in entries: + chan_number_index += 1 + + clean_station_item = { + "name": channel_dict["channel"]["fullName"], + "callsign": channel_dict["channel"]["name"], + "number": chan_number_index, + "id": channel_dict["channel"]["sourceId"], + "thumbnail": "https://static.streamlive.to/images/tv/%s.png" % channel_dict["channel"]["name"].lower().replace("&", "") + } + channel_list.append(clean_station_item) + return channel_list + + def get_channel_stream(self, chandict, stream_args): + + streamurl = self.get_ustvgo_stream(chandict["callsign"]) + + stream_info = {"url": streamurl} + + return stream_info diff --git a/origin/plugin.json b/origin/plugin.json new file mode 100644 index 0000000..d4aa78b --- /dev/null +++ b/origin/plugin.json @@ -0,0 +1,3 @@ +{ + "type":"origin" +} diff --git a/plextv_conf.json b/plextv_conf.json new file mode 100644 index 0000000..ac31ff4 --- /dev/null +++ b/plextv_conf.json @@ -0,0 +1,14 @@ +{ + "plextv":{ + "tuners":{ + "value": 4, + "config_file": true, + "config_web": true + }, + "stream_method":{ + "value": "direct", + "config_file": true, + "config_web": true + } + } +} diff --git a/plugin.json b/plugin.json new file mode 100644 index 0000000..df77d6b --- /dev/null +++ b/plugin.json @@ -0,0 +1,5 @@ +{ + "name":"USTVGO", + "version":"v0.6.0-beta", + "type":"origin" +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/web/__init__.py b/web/__init__.py new file mode 100644 index 0000000..e75770e --- /dev/null +++ b/web/__init__.py @@ -0,0 +1,11 @@ + +from .origin_html import Origin_HTML + + +class Plugin_OBJ(): + + def __init__(self, fhdhr, plugin_utils): + self.fhdhr = fhdhr + self.plugin_utils = plugin_utils + + self.origin_html = Origin_HTML(fhdhr, plugin_utils) diff --git a/web/origin.html b/web/origin.html new file mode 100644 index 0000000..6e680c5 --- /dev/null +++ b/web/origin.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block content %} + +

{{ origin }} Status

+ + +
+ + + {% for key in list(origin_status_dict.keys()) %} + + + + + {% endfor %} + +
{{ key }}{{ origin_status_dict[key] }}
+
+ +{% endblock %} diff --git a/web/origin_html.py b/web/origin_html.py new file mode 100644 index 0000000..79eb133 --- /dev/null +++ b/web/origin_html.py @@ -0,0 +1,31 @@ +from flask import request, render_template_string, session +import pathlib +from io import StringIO + + +class Origin_HTML(): + endpoints = ["/distrotv", "/distrotv.html"] + endpoint_name = "page_distrotv_html" + endpoint_category = "pages" + pretty_name = "DistroTV" + + def __init__(self, fhdhr, plugin_utils): + self.fhdhr = fhdhr + self.plugin_utils = plugin_utils + + self.origin = plugin_utils.origin + + self.template_file = pathlib.Path(plugin_utils.path).joinpath('origin.html') + self.template = StringIO() + self.template.write(open(self.template_file).read()) + + def __call__(self, *args): + return self.get(*args) + + def get(self, *args): + + if self.origin.setup_success: + origin_status_dict = {"Setup": "Success"} + else: + origin_status_dict = {"Setup": "Failed"} + return render_template_string(self.template.getvalue(), request=request, session=session, fhdhr=self.fhdhr, origin_status_dict=origin_status_dict, list=list, origin=self.plugin_utils.namespace) diff --git a/web/plugin.json b/web/plugin.json new file mode 100644 index 0000000..0a5a6e1 --- /dev/null +++ b/web/plugin.json @@ -0,0 +1,3 @@ +{ + "type":"web" +}