Giter VIP home page Giter VIP logo

stb-proxy's Introduction

STB-Proxy

  • Play STB portal streams in regular m3u media players
  • Responds as HD Homerun for Plex etc
  • Configuration through web UI
  • Combine multiple portals
  • Enable/disable channels individually
  • Rename channels
  • Set custom genres
  • Modify channel numbers
  • Override epg
  • Set fallback channels
  • Support for multiple MACs/Streams per Portal

Setup

Install the latest Docker image with...

docker create \
--name=STB-Proxy \
--restart=always \
-p 8084:8001 \
-e HOST=10.0.1.200:8084 \
-v </host/path>:/config \
chris230291/stb-proxy:latest
  • Map whichever port you like to the default 8001
  • HOST should be the docker hosts ip + the port you chose
  • Mounting /config is required for settings to persist through restarts
  • To configure go to the HOST in a browser eg 10.0.1.200:8084

stb-proxy's People

Contributors

chris230291 avatar jgog avatar kettenbach-it 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stb-proxy's Issues

Not playing to channels.

Hello i'm install this script and add my URL and MAC and generate /playlist.
I'm add this playlist to VLC but not work the channels :(

M3U playlist instead of MAC

Hello, is possible to have something similar but instead of use MAC Address, we can use m3u playlist but sometimes provider only allow 1 connection and use fallback channel with ffmpeg to decide which line is free to tuner?. Thanks.

Why there is a considerable delay for any stream to start compared to using STB portal directly

When switching channels using STB-Proxy, it takes about 4 or 5 seconds for channel to start working, this compared to when I'm using the STB portal directly, the channel switching takes less than 1 second.

It's probably my lack of understanding of this project, but I thought this was just a proxy that will redirect the original stream and that's all, if it's only doing that, I don't see why there is such delay in starting a stream. But then again I see FFmpeg as a dependency and I'm now wondering whether STB-proxy is doing any transcoding that is causing the dalay, if that's the case, can't you just server the streaming link exactly as you receive it from the STB portal?

Format or MIME Type not found

Hello,

After configuring my portal and my MAC, I don't know how to read the content of my channels.

Can you help me, I am a complete beginner.

My next goal is to connect by plex on the STB-proxy.

But I can't read the content via the web page

image

Question on next steps for development

Hi,

I'm working on the tests.
During this, I might need to refactor some code to make it testable.

Concerning this, I have the following questions:

  • May I rewrite your code in an object-oriented, strongly typed code? The methods itself will stay 99% as they are, but the surronding will be different
  • I would like to modify the tool so that it connects directly to a portal when it is started and can be switched to another portal via the HTML interface, which can be selected from a list in the config file. This would have the advantage that the whole thing could be integrated as Docker in an automated, cloud-native environment.
  • What do you think about us - in the medium term - installing an HTML5 video player as a web interface that can display the streams from /playlist directly in the browser?

Media stops after start

Hello, I configured all settings and it was success to play channel all night, But after the next day, when I want play channels it show me the first 2 sec and then stop. I didnt change anything. just happend. I trying re installing but the same error, I tried in other docker server and the same issue, I changed some iptv providers and nothing work. When I play with stalker player on pc or tv these channel works perfect.
But why it worked for the first time pretty well?

thanks and have a good day.,

Vod?

Hello!
Can vod movies be made that way too? :)

Reduce CPU usage of Stream

Hello,
I found out that CPU usage can be greatly reduced by changing the function to read and give back the ffmpeg result. Currently, it uses readline() function which searches the whole stream for the linebreak character (but in a stream linebreaks are more or less random and don't have a meaning) and probably creates rather small chunks. Thus I suggest du change the callback function in app.py from

            for chunk in iter(ffmpeg_sb.stdout.readline, ""):
                yield chunk
                if ffmpeg_sb.poll() is not None:
                    break

to

                chunk = ffmpeg_sb.stdout.read(10240)
                if len(chunk) == 0:
                    break
                yield chunk

to always read in large 10 kilobytes chunks.
On my small linux server this reduced the cpu usage of the python process from about 25% to 10%.

Streams not working

I have a question. My portal don't work. It makes connection I can see the playlist, epg but the streams don't work, can you help me?

Serial Number -- Authentication Failures

Certain providers appear to be using additional fields ... serial number and/or device IDs. Is there support? Perhaps they go into the cookies? Unclear on protocol or how to configure ... thanks!

Can the proxy run on a Raspberry Pi and/or on a decoder?

I'm struggling with docker on my raspberry pi to run the program:
"WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm/v7) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error"
Is it me that hasn't yet understood how docker works, or it just can't work on arm?
Thanks

Unlimited amount?

Allows you to share the same Stalker portal account on unlimited amount?

Expire in the Add portal is not there

There is no way to add anything under the expire column in the portal Add section. And because of that, the code fails.

  File "app.py", line 146, in add
    portals.append({"name": name, "url": url, "mac": mac, "proxy": proxy, "format": format, "expires": getExpires(
  File "app.py", line 103, in getExpires
    return expire
UnboundLocalError: local variable 'expire' referenced before assignment

image

Playlist editor lags out on very large playlist

Browsing the playlist editor in the browser lags out with portals that has thousands of channels in it. Also affects searching and exporting the playlist (not so much on playlist export, but still).

Check directories instead of single channels and autofallback based on channel name?

Just a request/suggestion

It would be very handy to have the chance to select and activate directly the directories containing the channels, instead of having to do it by hand.
( eg: UK, Sport, Germany, etc. )
It would be also nice to have a kind of "auto fallback" when the channels of different acconts/servers have the same name.

Do you think it would be possible?
Thanks!

LICENSE

@Chris230291

Under which licence do you want to publish your code?
I think it is important that you put a "LICENSE" file in the project.

I would recommend GPLv3 or a BSD licence if you want it to be even more liberal.

Http proxy With auth support

Hi any Chance to add support for Proxy With user:pass ?

how is it working exactly cant find a doku

lets say eG 1
One Portal 3 macs. How to use for each Mac 11 Stream With 3 proxy

eg2
More macs than proxy use them twice and local ip ?

Error for playing some channels

`UnboundLocalError
UnboundLocalError: local variable 'cmd' referenced before assignment

Traceback (most recent call last)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/root/STB-Proxy/app.py", line 535, in channel
if "http://localhost/" in cmd:
UnboundLocalError: local variable 'cmd' referenced before assignment`

Facing this problem for few channels while all others are streaming well.

MAC lock in feature

Sometimes even if I've stopped watching but the dashboard says mac is still occupied. If I have single mac id then it's hard to stream on another device.

It would be easier if we had a choice to 'lock in' mac for single stream.

Screenshot_2022-07-21-19-00-54-680_com brave browser~2

Flask crash when saving ! [BUG] [CRITICAL]

image

I assume there is a issue with some naming on the channels. when parsed to the paylist.

here is the logs.

- [25/Feb/2022 18:23:01] "POST /editor/save HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2091, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2076, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/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 "/app/app.py", line 261, in editorSave
    portals[portal]["enabled channels"].append(channelId)
KeyError: None

i can share with you some access to the stb portal so you can test.

Installation method Docker.

filter channel by genre id and avoid update all playlist.

Hello, now the script when you add a new portal, its load the full channel list, and then in the editor you can filter what channel you want to display in the playlist.m3u, but does not delete the channel from been update again when one channel is requests, or playlist update, or when loading editor again, this makes that takes a little more time to requests channel or edit.

Is there a way by using portal.php?type=itv&action=get_ordered_list&genre=genreids&force_ch_link_check=&fav=0&sortby=number&hd=0&p=1&JsHttpRequest=1-xml

you can avoid update the channels that are filter off in the editor page?, this allow to the script only update or requests the genre id or group of channels that only the user wants. and reduce the respond time for play the channel, etc.

could be cool. Thanks.

TypeError: __init__() got an unexpected keyword argument 'allowed_methods'

Previous script was working fine. New script gives this error while trying to run locally (not docker).

Traceback (most recent call last): File "app.py", line 33, in <module> retries = Retry(total=5, backoff_factor=0.2, status_forcelist=[500, 502, 503, 504], allowed_m ods=frozenset(['GET', 'POST'])) TypeError: __init__() got an unexpected keyword argument 'allowed_methods'

None of the accounts tested OK

Iโ€™m trying to connect to 737380b0lab.connect.co.cr:25461/c/ but Iโ€™m getting an error when trying to add the portal. Portal works ok in STBEmu. Any guidance on how to fix it?

Channel list loading; doesn't play

Channels list is loading but channels don't play on /player or /playlist

log file below

File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi result = await app(self.scope, self.receive, self.send) File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ return await self.app(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__ await super().__call__(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__ await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__ raise exc from None File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__ await self.app(scope, receive, _send) File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__ raise exc from None File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__ await self.app(scope, receive, sender) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 580, in __call__ await route.handle(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 241, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 52, in app response = await func(request) File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app raw_response = await run_endpoint_function( File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 161, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/usr/local/lib/python3.8/dist-packages/starlette/concurrency.py", line 40, in run_in_threadpool return await loop.run_in_executor(None, func, *args) File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "app.py", line 448, in channel return RedirectResponse(link) UnboundLocalError: local variable 'link' referenced before assignment

Need Help

brave_HNGabato4L

I will provide if you need anything

I need help

I'm just a beginner and don't know how to run it. Can somebody help me?

Not work

My problem:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/STBpNew/app.py", line 214, in editorSave
portals[portal]["enabled channels"].append(channelId)
KeyError: None

i'm click the save button to channel list and not work :\

EPG not in xlmtv

hi sometimes the epg will not shown in /xmltv is this a known issue ?

Fallback channel

Could be possible activate a fallback channel when url main stream get 401 code or 503 code?
Thanks.

[request] Compressing video

As ffmpeg is involved, can you put an option to compress livestream to 480p or similar size for slower data speed connection?

Channel sorting

Can we get channel sorting feature, or at least an option to keep the channel order from original list.

Here's the deal.
If I have source list like this:

#EXTM3U 
#EXTINF:-1 tvg-id="id-0000001" tvg-chno="0000001" group-title="GroupName",Channel B
#EXTINF:-1 tvg-id="id-0000002" tvg-chno="0000002" group-title="GroupName",Channel D
#EXTINF:-1 tvg-id="id-0000003" tvg-chno="0000003" group-title="GroupName",Channel A
#EXTINF:-1 tvg-id="id-0000004" tvg-chno="0000004" group-title="GroupName",Channel C

Once I run your proxy as a result this same list would give me end result like this:

#EXTM3U 
#EXTINF:-1 tvg-id="id-0000003" tvg-chno="0000003" group-title="GroupName",Channel A
#EXTINF:-1 tvg-id="id-0000001" tvg-chno="0000001" group-title="GroupName",Channel B
#EXTINF:-1 tvg-id="id-0000004" tvg-chno="0000004" group-title="GroupName",Channel C
#EXTINF:-1 tvg-id="id-0000002" tvg-chno="0000002" group-title="GroupName",Channel D

So instead of keeping list sorted by channel number, all of the sudden we're getting list sorted by channel name.

Why is that a problem you might ask, well if I'm getting a list from my provider that is sorted is some meaningful order like:

- language 1
  -- news channel A
  -- news channel B
  -- news ...

  -- movie channel A
  -- movie channel B
  -- movie ...

  -- sport channel A
  -- sport channel B
  -- sport ...
- language 2
  -- ...

this right here makes perfect sense (to me).
However once you order those channels by name, all hell breaks loose. All of the sudden I have a list with all of the channel types mixed together without any meaningful order.
In the end, I have to reorder list manually, no matter how good or bad the source list is. Which can be tiresome for bigger lists

In TiviMate (which I'm using) there is an option to sort channel within group by different parameters

  • by order in playlist
  • by name (which is now basically obsolete since you already reordered list by name so this does the same thing like first option)
  • some other options - but no ordering by channel number :(

I did try to manually update "enabled channels": [] prop within config.json + restart docker container, however that did not have any effect.

Other than that, great work with this repo. It's super easy to setup and most important works awesome.
Keep up the good work :D

is it possible to get the VOD m3u?

Yes and no. Unless somebody knows the URL to get all vods in one request I would have to get each "page" individually, which is about 14 vods at a time. Since a lot of servers have 500 pages or sometimes many more, that is a lot of requests to make which takes minutes to complete. If I run them all in parallel I found some providers would ban me.

Without knowing all of the different portal requests (I only know the ones other apps use by looking at wireshark), its difficult to know what the options are.

I can rework things like the webui so that each page, search etc is a separate request, but remember I am not a programmer and it looked way more complicated. I'd rather keep it as simple as possible. Besides that would be a lot of work and I don't care for vods.

Originally posted by @Chris230291 in #18 (comment)

It seems to be the right way to go though, a Kodi plugin written in Python that adds the ability to watch IPTV from MAC address based providers (Stalker Middleware) also goes through all the pages for VOD;

https://github.com/kens13/Kens13_Repo/blob/943d733cc1e228c5046f7e06556ce26d686667e0/Addons/plugin.video.IPTVXtra/stalker.py#L394

I also don't come across anything like a "get_all_channels" for VOD online.... The webpage below gives a lot of examples of requests & answers that can be sent;

https://www.quassi.nl/2020/03/23/the-wonderful-world-of-stalker-iptv-2

Hope that with both links I have helped you further with the goal of STB proxy to be a complete STB portal -> m3u proxy, I must agree with you there is limited explanation online about how the communication works ๐Ÿ™‚

feature idea

It would be good if the MAC addresses were automatically sorted by availability. The MAC addresses where no connection can be established after X attempts are automatically deleted. Is this easy to implement?

Problems with Plex channel / EPG ID length

Using STBPROXY as HDHomeRun with Plex have problems with EPG ID / channel id which is 38 characters, this causes the inability to manage favorite channels preventing them from being added or removed. (look at the attached images, the heart symbol is not visible for channels coming from STBProxy)
Another problem to report is in playback which both from PLEX and directly from the STBPROXY web interface often interrupts the streaming while for the same MAC from application like SFVIP the streaming has no interruptions. I tried modifying FFMpeg Command by adding
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 -attempt_recovery bool 1 -max_recovery_attempts 0 but nothing changes
STBProxy Source
Other source LiveTV
Any idea to fix this proble? Is there a way to set a parameter to always repeat playback? thanks for your attention.

[Feature Request OR Bug maybe?] Allow multiples occupations on mac.

Hello, in your previous code it was possible to add multiple occupations using same Mac could you, manage adding a way to allow multiple occupations again please, designed by parameters (5,10,20,unlimited) ?
And a way to terminate directly a stream/occupation also will be nice.

Streams are not terminated properly with ffmpeg

In conjunction with ffmpeg, I often encounter the problem that streams continue to run even though the client has disconnected or switched to another channel. This leads to many connections being blocked over time.
Inside the shell of the docker container in which stb-proxy is running you can see the multiple ffmpeg processes and have to kill them manually.
@Chris230291 Are you aware of this behavior? Is there a fix to cleanly detect that the client has terminated the connection?

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.