Git Product home page Git Product logo

tvhproxy's Introduction

tvhproxy's People

Contributors

chkuendig avatar hazcod avatar im85288 avatar jkaberg avatar johnveitch avatar nphmuller avatar samtayuk avatar taligentx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tvhproxy's Issues

lineup.json error

When fetching the lineup.json, it is throwing some python errors.
ERROR:tvhProxy:Exception on /lineup.json [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "tvhProxy.py", line 73, in lineup
for c in _get_channels():
TypeError: 'NoneType' object is not iterable

I am running Tvheadend 4.3

JSONDecodeError

I am receiving this error when Plex hits /lineup.json

ERROR:root:An error occured: %sJSONDecodeError('Expecting value: line 1 column 1 (char 0)',) ERROR:tvhProxy:Exception on /lineup.json [GET] Traceback (most recent call last): File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/home/c0re/src/tvhProxy/.venv/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "tvhProxy.py", line 82, in lineup for c in _get_channels(): TypeError: 'NoneType' object is not iterable INFO:root:192.168.20.18 - - [2020-10-21 12:44:25] "GET /lineup.json HTTP/1.0" 500 445 0.015836

Any ideas?

Docker file update

Hi All,

Newbie to git and docker here.

After much docker learning, here is a modified Dockerfile I us. It sets/includes applicable environment variables to make container control a little easier (for me anyhow).

In addition made some tweaks to the python script that will build the connection url based upon environment variables

Rather than create a fork of the entire project, happy to share here. If this is incorrect, please let me know the correct way.

{start Dockerfile}

FROM python:3-slim
ENV DEVICE_ID=12345678
ENV TVH_PROXY_HOST=''
ENV TVH_PROXY_PORT=5004
ENV TVH_BINDADDR=''
ENV TVH_USER='[username]'
ENV TVH_PASSWORD='[password]'
ENV TVH_HOST='[tvheadend ip/name]'
ENV TVH_PORT=9981
ENV TVH_TUNER_COUNT=1
ENV TVH_WEIGHT=300
ENV TVH_CHUNK_SIZE=1048576
ENV TVH_PROFILE='mp4'
ENV TZ='Australia/Sydney'
WORKDIR /usr/src/app/templates
COPY templates/device.xml .
WORKDIR /usr/src/app
COPY requirements.txt .
COPY tvhProxy.py .
COPY ssdp.py .
RUN pip3 install --no-cache-dir -r requirements.txt
EXPOSE $TVH_PROXY_PORT
CMD [ "python3", "./tvhProxy.py" ]

{end Dockerfile}

Edits to tvhProxy.py
(immediately above config= line)

{start insert}
if (os.environ.get('TVH_USER') == '' or os.environ.get('TVH_PASSWORD') == '') or (os.environ.get('TVH_USER') == '' and os.environ.get('TVH_PASSWORD') == '') :
u_combined = ''
else :
u_combined = str(os.environ.get('TVH_USER')) + ':' +str(os.environ.get('TVH_PASSWORD')) + '@'
{end insert}

Change tvhURL line in config section to:

'tvhURL': 'http://' + u_combined + (os.environ.get('TVH_HOST') or 'localhost') + ':' + (os.environ.get('TVH_PORT') or '9981'),

Too Many DNS requests

I run pihole on my network, and apparently when tvhProxy is replying to epg.xml request, it does more than 1000 DNS requests per minute, which pihole would then ignore any requests for a while. I'm not sure what are the consequences of DNS requests failing, but I find it odd that plex is having to get epg.xml 3 times.

Below is my .env file:

TVH_URL=http://ubuntu-docker-1.lan:9981
TVH_PROXY_HOST=ubuntu-docker-1.lan
TVH_TUNER_COUNT=1

how to replace previous version of tvhProxy with this one?

hello --

I only discovered this version/fork of tvhProxy after installing the "original one" from jkaberg.

I have installed it on a machine that runs both Plex media server & TVHeadEnd, with the intent of making TVHE the "tuning back-end" of Plex.

Long story short, things aren't working quite right yet and methinks the solution would be to replace the "old" version of tvhProxy with this one (I am trying the "low-hanging fruits" at first). But I am not a Python jockey and am not sure how to proceed, i.e., how to remove the old version before installing the new one.

Can you help? Thanks in advance.

Error 500 on epg.xml - Plex cannot see any channels or tune in

So i've spent quite a few hours figuring this all out and i'm still stuck with the same issues.
Below is a few snippets of errors that appear. I have tried with both digest authentication on and off

INFO:root:192.168.1.92 - - [2021-11-26 19:27:23] "GET /lineup.json HTTP/1.1" 500 426 0.025368
ERROR:root:An error occured: %sJSONDecodeError('Expecting value: line 1 column 1 (char 0)')
ERROR:tvhProxy:Exception on /lineup.json [GET]
Traceback (most recent call last):
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/hts/tvhProxy/tvhProxy.py", line 82, in lineup
    for c in _get_channels():
TypeError: 'NoneType' object is not iterable
ERROR:tvhProxy:Exception on /epg.xml [GET]
Traceback (most recent call last):
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/hts/tvhProxy/.venv/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/hts/tvhProxy/tvhProxy.py", line 108, in epg
    return _get_xmltv(), {'Content-Type': 'application/xml'}
  File "/home/hts/tvhProxy/tvhProxy.py", line 168, in _get_xmltv
    ElementTree.fromstring(requests.get(url, auth=HTTPDigestAuth(config['tvhUser'], config['tvhPassword'])).content))
  File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1347, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: syntax error: line 1, column 49

Not sure on what else I can do to solve the issue.

500 when hitting epg.xml

Hi there,

Hoping to get some help to get this to work so I can watch twitch streams in Plex.

TVHeadend is setup and I've installed the docker version of this app.

Exec'ing into the container, installing curl and running the following:

curl http://localhost:5004/epg.xml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

My tvhProxy.env:

cat tvhProxy.env

TVH_BINDADDR="0.0.0.0"
TVH_BINDPORT=5004
TVH_URL="http://tvheadend:9981"
TVH_PROXY_URL="http://tvheadend:5004"
TVH_TUNER_COUNT=6
TVH_WEIGHT=300
TVH_CHUNK_SIZE=1048576
TVH_PROFILE="avlib"

TVHeadend has unauthenticated access to all users:

image

I can hit TVHeadend from inside the container:

curl http://tvheadend:9981

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>Redirect</TITLE>
</HEAD><BODY>
Please follow <a href="extjs.html">extjs.html</a>
</BODY></HTML>

Not sure what I'm doing wrong..

JSONDecodeError: Lineup.json

Similar to #1

I'm having the lineup json error.

ERROR:tvhProxy:Exception on /lineup.json [GET]
Traceback (most recent call last):
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/tvhProxy/.venv/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "tvhProxy.py", line 82, in lineup
    for c in _get_channels():
TypeError: 'NoneType' object is not iterable
INFO:root:::ffff:192.168.0.1 - - [2021-04-16 01:35:09] "GET /lineup.json HTTP/1.1" 500 426 0.034379

I've tried disabling and enabling digest auth, to no effect, the only thing that makes it work is disabling acls in tvheadend with --noacl but that's not ideal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.