# Anybody want to make an Internet Video Pusher helper app for EWz?



## davidblackledge

EWz is set up to let the user configure a different video player instead of TiVo's.

wmcbrine has been looking into making HME/VLC work with that interface as a locally-installed transcoding player (http://www.tivocommunity.com/tivo-vb/showthread.php?p=10239329#post10239329) but he has hit some snags with the new version of VLC.

HOWEVER... I understand some models can't stream video at all. I know this is true for Series 2, but I have very little understanding of what the limitations are for the Mini.
Regardless...I realized that this same feature could be used on those models to activate a push of an Internet video to a DVR so the user could watch it after it transfers.

I know several of those applications out there can do the pushing (StreamBaby, vidmgr, etc.)... so if one of them would attach a simple HME app to their process, the user could configure EWz to use that local app as their video player and get a decent experience!

What I envision:

Your program launches and also starts an HME app that works with EWz (see below) and spits out the HME launch string that they'll have to use in EWz configuration. e.g. 


Code:


> > >Enter Webz video configuration: 192.168.0.1:7288/push/


The user configures EWz with that string and clicks a video link to try it out.
EWz launches the app, including args. e.g.:


Code:


http://192.168.0.1:7288/push/?uri=http://...&title=my+favorite+video&subtitle=the+best&mime=video/mp4&description=this+is+a+sample+description&duration=120

 (subtitle, mime, and duration may not be present, and this entire URL is truncated if it's more than 1k)
your HME app does something like displaying "Select the DVR to which you want to send the video : <subtitle>" and uses the passed in data as the metadata for the push followed by a "your video will show up soon" if they don't cancel the request, and finally closes itself.

*Who wants to do this? * 
Actually, all of the available apps out there could do this, and the user can just configure to use whichever one they have installed.


----------



## Allanon

The Tivo Mini can run HME programs but can't stream video. You can see HME/VLC menus with a Mini but can't play a stream. Also, you can't use pyTivo with a Mini, when clicking on the videos folder it displays a message stating "You can't watch show from your computer with this Tivo Box". EWZ works on a Tivo Mini.

Writing a streaming HME app isn't the hard part. It's finding the actual URL for videos, most are hidden within flash players nowadays.

I'll be releasing a UPNP Client for the Tivo soon (week, maybe two). I didn't know you were able to start Tivo apps on the Tivo with args. I will need to see how that is handled in HME for Python. But I guess I could allow a video to play automatically when given a video url at startup.

If you just want to push a video to the Tivo I would suggest using pyTivo since it's already setup to do this.


----------



## davidblackledge

Allanon said:


> I'll be releasing a UPNP Client for the Tivo soon (week, maybe two). I didn't know you were able to start Tivo apps on the Tivo with args. I will need to see how that is handled in HME for Python. But I guess I could allow a video to play automatically when given a video url at startup.


Great! this should be neat!



> If you just want to push a video to the Tivo I would suggest using pyTivo since it's already setup to do this.


Can it push an arbitrary video from an Internet URL, too? If so, then that's perfect, and it just needs a simple HME app on top of it that initiates the push given those args passed from EWz.

*feeling hopeful*


----------



## davidblackledge

With the removal of the Podcasts feature, does anybody know if this is a bad sign for the "push" feature? 
Is it possible TiVo will remove that capability completely now that their own main use of it is gone?
Or do I have this wrong and the two have no relationship at all? Or maybe there are a bunch of other official uses of "push" so there is nothing to worry about.


----------



## moyekj

davidblackledge said:


> With the removal of the Podcasts feature, does anybody know if this is a bad sign for the "push" feature?
> Is it possible TiVo will remove that capability completely now that their own main use of it is gone?
> Or do I have this wrong and the two have no relationship at all? Or maybe there are a bunch of other official uses of "push" so there is nothing to worry about.


 TiVo Desktop auto transfers use the "push" capability - that's where pyTivo pushes were reverse engineered from. So if the capability is removed that will remove that functionality from TiVo Desktop.

However, given that TiVo has ignored HMO and HME for many years and recently seem keen on ditching legacy code I would not be at all shocked to see them drop support for these completely in series 4+ hardware. Even worse, I don't even seeing them providing a viable alternative especially to HME. For HMO the combination of TiVo Stream plus Plex may be seen as a viable alternative though I would not agree. For a while it seemed as though perhaps html5/javascript could become a viable alternative to HME, but TiVo promptly killed off open access to that capability.


----------



## wmcbrine

davidblackledge said:


> With the removal of the Podcasts feature, does anybody know if this is a bad sign for the "push" feature?


http://pytivo.sourceforge.net/forum/the-end-of-tivocasts-and-the-future-of-push-t2812.html

BTW, I'm working on a replacement for the TiVoCast app right now, although I wonder how long it will work.


----------



## davidblackledge

wmcbrine said:


> BTW, I'm working on a replacement for the TiVoCast app right now, although I wonder how long it will work.


I PRESUME that means you'll include in it my requested HME queing app that this thread is about, right?


----------



## wmcbrine

davidblackledge said:


> I PRESUME that means you'll include in it my requested HME queing app that this thread is about, right?


This is an app for dealing with RSS feeds. Only.


----------



## davidblackledge

Allanon said:


> I'll be releasing a UPNP Client for the Tivo soon (week, maybe two). I didn't know you were able to start Tivo apps on the Tivo with args. I will need to see how that is handled in HME for Python. But I guess I could allow a video to play automatically when given a video url at startup.


month, maybe two later...

just curious how things are going with that, Allanon.

No pressure - I haven't been doing much with my projects lately, either.


----------



## Allanon

davidblackledge said:


> month, maybe two later...
> 
> just curious how things are going with that, Allanon.
> 
> No pressure - I haven't been doing much with my projects lately, either.


Sorry, I lost interest in the project. I read your other post speculating if HME is going away and though maybe I'll wait to see what happens before spending anymore time on this project. I only started the project because I just learned how to use the Python Coherence module which is an API for manipulating UPNP servers and clients. My TV, Xbox 360, Bluray player, and Kodi media server all have UPNP clients so I really don't need one on the Tivo. I was just doing it because I could. I got it working but the part I dread is creating a good user interface and making it stable enough for the general public. I thought announcing the project would make me more motivated to finish but it didn't, sorry.


----------



## davidblackledge

Allanon said:


> Sorry, I lost interest in the project. I read your other post speculating if HME is going away and though maybe I'll wait to see what happens before spending anymore time on this project. I only started the project because I just learned how to use the Python Coherence module which is an API for manipulating UPNP servers and clients. My TV, Xbox 360, Bluray player, and Kodi media server all have UPNP clients so I really don't need one on the Tivo. I was just doing it because I could. I got it working but the part I dread is creating a good user interface and making it stable enough for the general public. I thought announcing the project would make me more motivated to finish but it didn't, sorry.


No problem, I don't blame you. I haven't been feeling inspired at all lately, myself.

Any other takers out there for this push-a-video project?

FYI, I'm fine with writing the HME app myself and just having the other developer provide me some sort of command-line call or URL request to activate something for a push (or to generate a URL for a transcoded video stream for the video-capable devices)


----------



## ntlord

This would be pretty easily done with Plex. The URL would need to be auto generated though. HME is java right? If I wrote a java plex URL generator would that do the trick for you?

How would you get past the GB limit? My recollection was that there was some sort of limitation on the amount of video that could be played on the tivo.


----------



## davidblackledge

ntlord said:


> This would be pretty easily done with Plex. The URL would need to be auto generated though. HME is java right? If I wrote a java plex URL generator would that do the trick for you?


Well, *I* do HME with Java anyhow (there are other options).
Yeah, most likely that would do it. Thanks!

Let's see, we were talking about the "push this URL to the TiVo" right? If I write the HME app, what I'd need is to be able to call a function, executable, or web service (URL). I would pass it the Internet URL of the video file and its mime type (I'd also have title, subtitle, description, and time length in some cases if that's somehow useful), and I'd need to pass it the TiVo TSN. It would do whatever it does and I'd just tell the user to look in their "now playing" screen.

Let me know if I got mixed up and you meant this was for Plex to provide a transcoded video stream for direct playing of non-mpeg videos. It's been a long day.


> How would you get past the GB limit? My recollection was that there was some sort of limitation on the amount of video that could be played on the tivo.


That turned out to be a technical glitch on our side, not really a TiVo issue... I think it was moyekj who found it... I believe it had something to do with required headers in the sender, so this would actually apply to what you write, most likely.
I'll try to dig it up this weekend if nobody speaks up.

Oh...and that sounds more like the direct playing stream. The pushing doesn't have this issue as far as I know. I don't know much about pushing, though.

I'll stop now before I make things more confusing and will pick up after I hear from you what you were planning and after I've had some rest ;]


----------



## ntlord

I see, I missed the "push" part. 

I don't know much about pushing stuff to the tivo, are their any explanations out there about how it is accomplished? 

Plex has a couple of different streaming/transcoding options:

(1) HTTP <- I think it just dumps the transcoded video into HTTP responses.
(2) HLS/MPEG-dash <- file is transcoded into invdidual videos and sound files, and you can make HTTP gets to PLEX to get each file. 

I'm guessing option number 1 is how we would want to go, but I would need to understand a bit more about how to push video to a tivo.

Now, the streaming limitation being removed, I find more interesting. Do you have a thread where you figured out how to remove the limit? I ask because given the upcoming Plex application's 720p limitation, this may be a way to avoid it. Will streaming work on the mini?


----------



## moyekj

ntlord said:


> Now, the streaming limitation being removed, I find more interesting. Do you have a thread where you figured out how to remove the limit? I ask because given the upcoming Plex application's 720p limitation, this may be a way to avoid it. Will streaming work on the mini?


I'm pretty sure I told you about a while back. That was one of my main updates to "revived streambaby" was fixing that long time issue. There were 2 important parts to the fix:

1. Need to wrap/extend Java InputStream class to change available() method so that it always returns something (non-zero)
2. Content headers need to be present which indicate how may bytes are needed to be reserved by TiVo for the stream:
Accept-Ranges
Content-Range
Content-Length

#2 is fairly obvious but for on-the-fly transcoding streambaby wasn't specifying them, so easy fix was just to always specify more than you need (streambaby now defaults to 20GB buffer size).

#1 was much less obvious and I don't quite remember how I figured that out.

EDIT TO ADD: No, HME streaming doesn't work on the Mini because HME streaming actually works by copying stream to buffer on the TiVo side, and of course the Mini doesn't have that capability.


----------



## davidblackledge

Thanks for that info, moyekj.



ntlord said:


> I see, I missed the "push" part.
> 
> I don't know much about pushing stuff to the tivo, are their any explanations out there about how it is accomplished?
> 
> Plex has a couple of different streaming/transcoding options:
> 
> (1) HTTP <- I think it just dumps the transcoded video into HTTP responses.
> (2) HLS/MPEG-dash <- file is transcoded into invdidual videos and sound files, and you can make HTTP gets to PLEX to get each file.
> 
> I'm guessing option number 1 is how we would want to go, but I would need to understand a bit more about how to push video to a tivo.


Push is a whole thing. RPC Mind commands using the specific TiVo's MAK and stuff. Let's let somebody that has worked on it do that one. (If push comes to shove, I'll steal the code from Streambaby ;] )

Instead, the other thing I've been wanting that it sounds like you can do is to transcode video found/clicked from EWz. It would be launched in a locally-installed app that can deal with the transcoding. I already have the architecture in place in EWz for this feature, but no app to launch.

I can write a simple video player app that the user installs somewhere and spits out instructions on how to configure EWz to point at it. EWz will launch that app with the aforementioned arguments. _In fact, I'll start with something funky like my app just preps everything, then launches TiVo's video player app with the new URL... assuming that won't crash the TiVo ;]_

It will call your code (to get an HTTP URL out of Plex given an Internet URL (video/*)), and the video player will start playing THAT URL instead of the Internet URL.

This will solve problems with HTTPS urls (TiVo refuses to handle them, so EWz just drops the S and crosses its fingers) and of course all the video formats the TiVo can't handle natively. I'm hoping that Plex will also deal with redirects. *If I'm REALLY lucky, Plex can also handle YouTube* (and other proprietary/hard to extract video sites)... but I don't think I'm that lucky.

As for the 1.1GB limit, I suspect we're stuck with "Plex either does the HTTP headers correctly or it doesn't" which will decide for us if we have the 1.1GB issue.


----------



## davidblackledge

davidblackledge said:


> (If push comes to shove, I'll steal the code from Streambaby ;] )


I guess that's easier than I was thinking, moyekj... looks like your "Mind.java" class has the push command almost self-contained. The only thing I'd need to do is get the list of TSN's on the network for the user to choose from which is probably easy somewhere else in your code, but certainly something I've done before, too.

If I do this, moyekj, what is your preference for how I include it...or do you even care? 
I can just pull the relevant source files and include them in my compile, or I can require a copy of your jar file in the classpath, or maybe you could even pull the necessary classes into a separate jar that I'd include in the distribution.

... maybe I have something to work on this holiday weekend.

But what can be pushed? what are the URLs relative to: the TiVo or tivo.com (or is it relative to the mind server, and if so, is it true that one could identify the tivo as the mind server?) I ask because I'd like to push direct Internet URLs where possible, as well as local-network transcoder URLs where necessary.


----------



## moyekj

You can copy whatever source code you want - I don't care.
I've always used push for home served videos, but you may be able to get it working with internet URLs. I can't remember if there are special requirements for serving up video for a push or not. You'll have to look at Streambaby or pyTivo code to see.


----------



## ntlord

davidblackledge said:


> Thanks for that info, moyekj.
> 
> Push is a whole thing. RPC Mind commands using the specific TiVo's MAK and stuff. Let's let somebody that has worked on it do that one. (If push comes to shove, I'll steal the code from Streambaby ;] )
> 
> Instead, the other thing I've been wanting that it sounds like you can do is to transcode video found/clicked from EWz. It would be launched in a locally-installed app that can deal with the transcoding. I already have the architecture in place in EWz for this feature, but no app to launch.
> 
> I can write a simple video player app that the user installs somewhere and spits out instructions on how to configure EWz to point at it. EWz will launch that app with the aforementioned arguments. _In fact, I'll start with something funky like my app just preps everything, then launches TiVo's video player app with the new URL... assuming that won't crash the TiVo ;]_
> 
> It will call your code (to get an HTTP URL out of Plex given an Internet URL (video/*)), and the video player will start playing THAT URL instead of the Internet URL.
> 
> This will solve problems with HTTPS urls (TiVo refuses to handle them, so EWz just drops the S and crosses its fingers) and of course all the video formats the TiVo can't handle natively. I'm hoping that Plex will also deal with redirects. *If I'm REALLY lucky, Plex can also handle YouTube* (and other proprietary/hard to extract video sites)... but I don't think I'm that lucky.
> 
> As for the 1.1GB limit, I suspect we're stuck with "Plex either does the HTTP headers correctly or it doesn't" which will decide for us if we have the 1.1GB issue.


Ok. I might have misunderstood what you are looking for. All plex can do is serve up videos in a transcoded fashion that you have already added to plex.

If I understand what you are looking for correctly. You want some sort of transcoding solution where you pass it a "source" of an html5 video tag? Then it transcodes it on the fly and sends it back to a tivo using RPC push, where a custom video player app would play it? This still seems possible if all you are looking for is video tag support. However, if you want it to do flash, that might be more difficult. I'm also not sure it would work with anything that had DRM.


----------



## davidblackledge

ntlord said:


> Ok. I might have misunderstood what you are looking for. All plex can do is serve up videos in a transcoded fashion that you have already added to plex.
> 
> If I understand what you are looking for correctly. You want some sort of transcoding solution where you pass it a "source" of an html5 video tag? Then it transcodes it on the fly and sends it back to a tivo using RPC push, where a custom video player app would play it? This still seems possible if all you are looking for is video tag support. However, if you want it to do flash, that might be more difficult. I'm also not sure it would work with anything that had DRM.


Nah, not flash necessarily... and it's not necessarily a video tag, either. I'd pass it a URL that may or may not be extracted from a Video tag, but it should be all the same to you. 
I will just try to do this for every mime video/* I come across that a user clicks (like video/mp4, or video/quicktime but it might be video/x-flv which is flash). You can either just return failure if it's not a supported format, or you can give me a list of what Plex supports and I'll not pass those ones to you.

So, if I understand, your code would add the video URL it to Plex, and give back a URL that can stream/download the transcoded version of that video. I'd decide what to do with that URL (either push it if this is a Mini that's connected, or play it if it's a streaming capable TiVo).

_If there are ways Plex supports adding more complicated content (Vimeo, YouTube...) for this purpose that'd be even cooler._

Will the URL returned be a web page, or a "download" link (URL ending e.g. .mp4)? I need a download link (I'll just extract it if it's a web page)

I suppose, if adding to Plex is a "permanent" add, then I'd like the ability to delete the video after they're done with it, too, but that's not critical.


----------



## davidblackledge

moyekj said:


> You can copy whatever source code you want - I don't care.
> I've always used push for home served videos, but you may be able to get it working with internet URLs. I can't remember if there are special requirements for serving up video for a push or not. You'll have to look at Streambaby or pyTivo code to see.


Thanks!
I'll probably extract what I need to a jar file if I can, and if it's in good shape, I'll hand it back to you for distribution to others. Because there are so many of us ;]


----------



## ntlord

davidblackledge said:


> Nah, not flash necessarily... and it's not necessarily a video tag, either. I'd pass it a URL that may or may not be extracted from a Video tag, but it should be all the same to you.
> I will just try to do this for every mime video/* I come across that a user clicks (like video/mp4, or video/quicktime but it might be video/x-flv which is flash). You can either just return failure if it's not a supported format, or you can give me a list of what Plex supports and I'll not pass those ones to you.
> 
> So, if I understand, your code would add the video URL it to Plex, and give back a URL that can stream/download the transcoded version of that video. I'd decide what to do with that URL (either push it if this is a Mini that's connected, or play it if it's a streaming capable TiVo).
> 
> _If there are ways Plex supports adding more complicated content (Vimeo, YouTube...) for this purpose that'd be even cooler._
> 
> Will the URL returned be a web page, or a "download" link (URL ending e.g. .mp4)? I need a download link (I'll just extract it if it's a web page)
> 
> I suppose, if adding to Plex is a "permanent" add, then I'd like the ability to delete the video after they're done with it, too, but that's not critical.


I'll have to look into this. I misunderstood what you were looking for originally, and I'm not sure plex can do that (i.e. add content on the fly). Although what do you think of this:

1. So generally speaking, plex searches folders for videos. The folders that plex searches can be tied to media categories on plex. We could set up a new category, point it to a temporary enterwebz folder.

2. I could write a small java daemon that would do a curl on the url you pass, and download the content. Send a folder refresh to plex, which would add the content.

3. The daemon could then get the transcoding URL from plex, and pass it back to enterwebz

The problem with this approach is that it would have to download the content fully to plex to "add it."

Another approach might be to use "plex channels," which Plex can also transcode. Plex also has the ability to transcode content found on the web (e.g. youtube, etc.) I don't know much about this though, but its possible this could be used. Off the top of my head, we could create an enterwebz channel that would be attached to a very simple (locally hosted) web page that would display the content you sent over.


----------



## davidblackledge

ntlord said:


> I'll have to look into this. I misunderstood what you were looking for originally, and I'm not sure plex can do that (i.e. add content on the fly). Although what do you think of this:
> 
> 1. So generally speaking, plex searches folders for videos. The folders that plex searches can be tied to media categories on plex. We could set up a new category, point it to a temporary enterwebz folder.
> 
> 2. I could write a small java daemon that would do a curl on the url you pass, and download the content. Send a folder refresh to plex, which would add the content.
> 
> 3. The daemon could then get the transcoding URL from plex, and pass it back to enterwebz
> 
> The problem with this approach is that it would have to download the content fully to plex to "add it."
> 
> Another approach might be to use "plex channels," which Plex can also transcode. Plex also has the ability to transcode content found on the web (e.g. youtube, etc.) I don't know much about this though, but its possible this could be used. Off the top of my head, we could create an enterwebz channel that would be attached to a very simple (locally hosted) web page that would display the content you sent over.


Hmm... ok, that would work for the "push" option at least. In fact, since the Plex app is coming soon, it might make sense to not even do a push. Instead make this a THIRD option for EWz users - first two I still need some non-plex help with (transcoding player, transcoding pusher) and this option is a Plex Adder...then they go to Plex to watch the video (basically the same as the transcoding pusher, but only using the Plex app).

So... I think we want a new plan: 
I can make an HME app that says "Click continue to add this video to your Plex queue."
When they click continue it just calls your code and says "Video added. Go to the Plex app to view it." (and if it makes sense "If it requires transcoding, it will not be ready immediately.")
I think I'd also be able to include a button of "launch Plex App" (and another to "return")

Your code would just do whatever you think is a good way to make the video available in the Plex app... a TiVo channel, an Enter Webz channel, an ntlord channel, or whatever ;] Ideally it could return some sort of success or other status information (maybe something that says what/where it will appear as) that could be displayed by the HME app.

_And again, if you can figure a way for me to provide vimeo and youtube ids to you so you can queue them as well, that'd be great._


----------



## davidblackledge

moyekj said:


> You can copy whatever source code you want - I don't care.


So I made a modified copy of the TiVoListener, but other than that I just import streambaby.jar for Mind because it was a little too intertwined for me to extract easily.
Using just that jar and no current streambaby installation:


Code:


Mind mind = new Mind();
EWzMediaHelperFactory f = (EWzMediaHelperFactory) getBApp().getFactory();

// login and push
if (mind.login(f.getLogin(), f.getPassword())) {
    if (mind.pushVideo(h)) {

but my login call is failing with:


Code:


javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: Certificates does not conform to algorithm constraints

at the line


Code:


BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream()));

Does that mean anything to you?

While I have you, where does that little logging system you use put its logs by default?


----------



## moyekj

Newer Java releases made https certificates harder to deal with. From:
https://sourceforge.net/p/streambab...redappeal/tivo/streambaby/StreamBabyMain.java
You need this to change security policy to prevent using algorithms that don't work with tivo.com site:


Code:


     // This is to workaround issue that started with Java 7 update 40 which sets
     // this property to "MD2, RSA keySize < 1024" and prevents authentication
     // from working
     // Debug issues using following when running java: -Djavax.net.debug=all
     // Search for: "Cipher Suite: ..."
     // Java 8 picks this not working one by default: SSL_RSA_WITH_3DES_EDE_CBC_SHA
     // Java 7u40 picks this not working one by default: TLS_RSA_WITH_AES_128_CBC_SHA
     // This one works: SSL_RSA_WITH_RC4_128_SHA
     // Don't know how to enable specific suites, so for now I disable ones that don't work
     Security.setProperty("jdk.certpath.disabledAlgorithms","TLS_RSA_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA");

I didn't implement the logging stuff, but log files goes to same location as streambaby.jar.


----------



## davidblackledge

moyekj said:


> Newer Java releases made https certificates harder to deal with. From:
> https://sourceforge.net/p/streambab...redappeal/tivo/streambaby/StreamBabyMain.java
> You need this to change security policy to prevent using algorithms that don't work with tivo.com site:
> 
> 
> Code:
> 
> 
> // This is to workaround issue that started with Java 7 update 40 which sets
> // this property to "MD2, RSA keySize < 1024" and prevents authentication
> // from working
> // Debug issues using following when running java: -Djavax.net.debug=all
> // Search for: "Cipher Suite: ..."
> // Java 8 picks this not working one by default: SSL_RSA_WITH_3DES_EDE_CBC_SHA
> // Java 7u40 picks this not working one by default: TLS_RSA_WITH_AES_128_CBC_SHA
> // This one works: SSL_RSA_WITH_RC4_128_SHA
> // Don't know how to enable specific suites, so for now I disable ones that don't work
> Security.setProperty("jdk.certpath.disabledAlgorithms","TLS_RSA_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA");
> 
> I didn't implement the logging stuff, but log files goes to same location as streambaby.jar.


Thanks, that did it. I also had to replace your Log class with a copy that uses Java Logging instead of that Simple Log thing since I guess that was in another jar file.

That said, so far no attempts have actually downloaded (it works, but there is an error in the TiVo's history that it wasn't downloaded because it couldn't be found)

Trying to launch the video player inline from another inline launched app is failing so far, too. I'm ready to stop trying for a while.
Thanks for the help, anyhow.


----------

