test
This commit is contained in:
parent
85e931c346
commit
dc4bec7f61
13
LICENSE
Normal file
13
LICENSE
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2017 Sam Zick <Sam@deathbybandaid.net>
|
||||||
|
|
||||||
|
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.
|
||||||
26
README.md
26
README.md
@ -1,2 +1,26 @@
|
|||||||
# fHDHR_plugin_origin_distrotv
|
<p align="center">fHDHR origin Plugin USTVGO <img src="docs/images/logo.ico" alt="Logo"/></p>
|
||||||
|
|
||||||
|
|
||||||
|
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 <irc://irc.freenode.net/#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]
|
||||||
|
````
|
||||||
|
|||||||
14
distrotv_conf.json
Normal file
14
distrotv_conf.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ustvgo":{
|
||||||
|
"tuners":{
|
||||||
|
"value": 4,
|
||||||
|
"config_file": true,
|
||||||
|
"config_web": true
|
||||||
|
},
|
||||||
|
"stream_method":{
|
||||||
|
"value": "direct",
|
||||||
|
"config_file": true,
|
||||||
|
"config_web": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
epg/__init__.py
Normal file
15
epg/__init__.py
Normal file
@ -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
|
||||||
3
epg/plugin.json
Normal file
3
epg/plugin.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type":"alt_epg"
|
||||||
|
}
|
||||||
79
origin/__init__.py
Normal file
79
origin/__init__.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
|
||||||
|
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):
|
||||||
|
|
||||||
|
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, data=payload)
|
||||||
|
entries = chan_req.json()
|
||||||
|
print(entries)
|
||||||
|
return
|
||||||
|
|
||||||
|
"""
|
||||||
|
response = requests.request("GET", url, headers=headers, data = payload).content
|
||||||
|
|
||||||
|
data = json.loads(response)
|
||||||
|
topics = data['topics']
|
||||||
|
for t in topics:
|
||||||
|
title = t['title']
|
||||||
|
Type = t['type']
|
||||||
|
if Type == "live":
|
||||||
|
addDir(title,title,3,addon_icon,addon_fanart,title)
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
def get_ustvgo_stream(self, chancode):
|
||||||
|
data = {'stream': chancode}
|
||||||
|
stream_url = self.plugin_utils.web.session.post('https://ustvgo.tv/data.php', data=data).text
|
||||||
|
return stream_url
|
||||||
3
origin/plugin.json
Normal file
3
origin/plugin.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type":"origin"
|
||||||
|
}
|
||||||
5
plugin.json
Normal file
5
plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name":"USTVGO",
|
||||||
|
"version":"v0.6.0-beta",
|
||||||
|
"type":"origin"
|
||||||
|
}
|
||||||
0
requirements.txt
Normal file
0
requirements.txt
Normal file
11
web/__init__.py
Normal file
11
web/__init__.py
Normal file
@ -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)
|
||||||
21
web/origin.html
Normal file
21
web/origin.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h4 style="text-align: center;">{{ origin }} Status</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<table class="table-medium center">
|
||||||
|
<tbody>
|
||||||
|
{% for key in list(origin_status_dict.keys()) %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ key }}</td>
|
||||||
|
<td>{{ origin_status_dict[key] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
31
web/origin_html.py
Normal file
31
web/origin_html.py
Normal file
@ -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)
|
||||||
3
web/plugin.json
Normal file
3
web/plugin.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type":"web"
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user