craigmox / cetonproxy

An app that allows a Ceton InfiniTV PCI/network tuner to appear as a SiliconDust HDHomeRun to DVR apps like NextPVR, Plex, and Emby.
GNU General Public License v3.0
23 stars 7 forks source link

Conversion to Linux #16

Open JSylvia007 opened 3 years ago

JSylvia007 commented 3 years ago

Howdy! So... The golden thing here would be to get this running on linux, so folks could run it directly on their Plex servers (for those running linux).

I'm not sure I can help with that, BUT, I'd like to try to understand it. Unfortunately, I'm not even sure what language this is written in, so I'm not exactly sure where to start.

I'm also not sure it's possible given that you MAY be using actual Ceton Driver calls (but I can't tell). I have an InfiniTV 6 ETH, and I believe that I saw that it should work without the drivers installed in that case. I'm still using Windows Media Center until I can get something that ENTIRELY works in Plex.

craigmox commented 3 years ago

Hey. I would also love to dabble in getting it compiled on Linux, but I haven't had the time. Based on a pull request from nlhintz, apparently cetonproxy will run within Wine under Linux. Is that an option for you? Also, you don't need to run it on the same box as your Plex server. It would work fine running on its own Windows instance, though I understand why it's better to have everything all nice and tidy running under the same environment.

It's written in Embarcadero Delphi. They have a free community edition that should compile it, if you're really feeling adventurous. It does not use any Ceton drivers calls or anything like that. Most everything is done via HTTP requests and services. (It listens on a TCP socket for the UPnP discovery side)

JSylvia007 commented 3 years ago

I wish I knew ANYTHING about Delphi. Unfortunately, my Plex box is "headless" and there is no GUI installed, and I'm pretty sure if I wanted to install wine to it, it would drive a whole bunch of additional package requirements.

This honestly looks like something that would be PERFECT to get implemented in Python, especially since you've said that it's really nothing more than an HTTP request proxy.

DanAustinGH commented 3 years ago

Just tripped over this, and it looks promising enough to get me to buy a used 6 eth.

Just a few thoughts-

  1. Wine works, if you are either on a 32 bit Linux distro, or one that has 32 bit wine available. If not, using the community edition can be used to compile a 64 bit version of the project, which I just did, and if you are not running your Linux server headless, which I was. (might be worth bundling a 64bit in your release) And by works, I mean the app launches. Will need to wait for the tuner to arrive to test further

  2. There is a python project with a similar goal for the Locast streaming service. It has multiple 'source' files separated by function and would need python versions of SocketUtils and VideoUtils (if I follow the code right) for someone who knows more Python and Delphi than I do.

  3. Separating the config function from the proxy function into two programs might make sense. It would make installing it as a Windows service easier, and the Linux users would likely be OK hand editing a base config file.

Whether it ends up working out the way I hope, I did want to express thanks for what you have here...

DanAustinGH commented 3 years ago

I've been dabbling with a python project that emulates an HDHR for Locast as a base to provide a similar option here. Since I know next to nothing about Python or Pascal(Delphi), this hasn't been super productive.

That said since both projects are cleanly structured, I have made some progress. The Python version can pull the channel map from the Ceton, and has a filter list similar to the Delphi project. It does run and has 100% of the HDHR features in place, it needs Ceton specific tuning functions.

I think I get how the channels are setup- Set a tuner to a channel, query the Ceton for the tuner frequency and program number, then collect the RTP stream details.

It appears that all channel interactions with the Ceton use a REST api, but and this is likely due to my lack of Delphi knowledge, I cannot quite put together what the API structure looks like. Any chance that you documented the API as part of your development?

Again, thanks for all you accomplished here.

JSylvia007 commented 3 years ago

I am SUPER interested on how this turns out. Between you two, you have created something AMAZING for the community.

DanAustinGH commented 3 years ago

OK, I figured out the calls to select a tuner, set the streaming details and set the channel. Shutting down tuners coded, but not integrated in the project I started with.

I haven't figured out how to get the streaming rtp data into ffmpeg just yet, so I haven't bothered to look into shutting down tuners.

Closer than before, but a long ways to go...

DanAustinGH commented 3 years ago

The last hurdle, getting the Ceton to shutdown a stream after a client stops watching has been solved.

I am working with the developer who's python/hdhr framework I used to host the code. Craigmox and this project are credited. I plan to run it for a few days to make sure it doesn't kick puppies or steal candy from babies. Once I am reasonable sure it is safe, I'll post here again, assuming craigmox is not offended by such and link to the github repo.

A few differences- No email support, and very anti-sharing. The code assumes it will be the only app to access the Ceton. It can use less than the full set of tuners, but any other app will have to use the upper tuners.

DanAustinGH commented 3 years ago

The repo has been made public: https://github.com/fHDHR/fHDHR_Ceton

Bugs happen. So I am starting with the few folks who are watching here before announcing on the emby/plex/etc forums.

The code is not as anti-sharing as I was thinking. It absolutely does not share existing streams, but should tolerate multiple clients using different tuners.

Thanks again to craigmox for sharing cetonproxy with the world.

JSylvia007 commented 3 years ago

SUPER EXCITED!!! Thanks to all the hard work @craigmox and @DanAustinGH !!! This is great stuff being brought to our community. Keeping these tuners alive since SiliconDust has discontinued their 6-tuner version.