Playing non-file-based HDHomeRun streams

Hi all,



This is my first attempt at making a Plugin, so there’s a lot I still do not know, but I am hoping someone can help me with this one particular problem.



I am trying to auto-generate the stream URLs for an HDHomeRun device by grabbing the necessary channel data from the SiliconDust web site. Everything is working except the one, final missing piece I cannot figure out.



If I manually put an HDHomeRun stream url in a file, and just add it as a source, it plays fine. However, when I am within the plugin code, with a generated stream url as a string, I cannot figure out how to get Plex to play it. I’ve tried using Plugin.Redirect on the URL, and I’ve try creating a VideoItem, and all its variations (WebVideoItem, WindowsMediaVideoItem, etc) inside a MediaContainer, but none of those permutations worked for me.



Is there a way to invoke the HDHomeRun stream url programatically that I am missing, or will it only play from a file?



If this is not possible to play this programatically, would writing the url to a file and then somehow (programatically) adding that file as a source be the next best option? (Psuedo-code on how to do this would be appreciated.)



Thanks in advance for any help.



-tony



Hey Tony, Welcome!
I'm no expert, by any means, but if you are able to get the url in a .strm file you should be able to make a plugin.

Is the url constant, or dynamic?

Here is a simple example of how I use it:


def ShowPlayer(sender, pageUrl):<br />
    dir = MediaContainer(title2=sender.itemTitle)<br />
    image = MY_IMAGE<br />
    link = MY_LINK<br />
    title = MY_TITLE<br />
    dir.Append(WebVideoItem(link, title=title, thumb=image))<br />
    return dir



I have no HDHomeRun experience to offer though. Good Luck!

The URL is dynamically generated. Your example is one of the variations I tried, which did not work for me. I believe the HDHomeRun stream URLs might be a special beast: their url scheme is not ‘http://’, but ‘hdhomerun://’. I suspect that might explain why WebVideoItem might not work for them. I also fear that none of the other existing VideoItem variations will work either for this same reason.



I’ve seen that there is some special library needed by Plex to support these hdhomerun stream urls, so it might just be that there is no way to connect a string within a plugin to that library as the library can only cope with being pointed to a file. I am hoping otherwise, but would like to be able to find out more definitively if anyone knows more about the hdhomerun support.



I’ll keep plugging away, but thanks much for the advice and the warm welcome.



-tony




Just found this... don't know where it stands.
http://forums.plexapp.com/index.php?/topic/628-hdhomerun-support/

Hey Tony, welcome to the forum!



WebVideoItems are used for capturing the output of Flash or Silverlight players. If the URL works in a .strm file, there’s no reason it shouldn’t be working with an ordinary VideoItem.



Can you post the code you’ve been trying (just the part responsible for returning the video item) and the Plex.log file when attempting to play it? Turning on debug logging in the advanced settings will probably make the log more useful :slight_smile:

Here is the relevant routine that gets called:



 def ChannelSelectCallback(sender, tunerId, channel):<br />
    deviceId = Prefs.Get('deviceid')<br />
    mediaUrl = "hdhomerun://%s-%s/tuner%s?channel=%s:%s&program=%s" % ( deviceId, tunerId, tunerId, channel.Modulation, channel.Frequency, channel.ProgramNumber )<br />
    Log( "HDHomeRun Media Url = %s" % mediaUrl, True )<br />
    try:<br />
        dir = MediaContainer(viewGroup="ChannelStream")<br />
        dir.Append( VideoItem( mediaUrl, title=mediaUrl ))<br />
        return dir<br />
    except:<br />
        return MessageContainer(<br />
            "Error",<br />
            "Problem playing stream: %s" % mediaUrl<br />
            )<br />




After hitting enter on the item, there's a slight delay, a temporary 'loading stream' dialog, then I get the dialog box that tells me:

"Error: Could not read from input stream"

The Plex.log snippet is attached.


I've verfiied if I put the urls in files and add the directory as a video source, it plays them just fine. As an example stream url directly from one of the files:

hdhomerun://101AA191-0/tuner0?channel=8vsb:521000000&program=3

which works fine.

Thanks for any insight.

-tony

I cannot explain it, but I have found a permutation that works. The HDHomeRun stream URLs put into a VideoItem does indeed work.



I had one more level of directories than I really needed, where the final directory level consisted of a single VideoItem. All I did was some refactoring while I was biding my time until I had a brainstorm, but somehow removing the extra directory level and put video items one level up made it work. There’s really no difference in the code except for an extra nesting level of DirectoryItems.



Somewhat inexplicable, but I am happy that it now works. Thanks all for your help. I am sure I’ll be needing more help as I press onwards to add more features to this.



-tony

Ok, upon further exploration, I think I have the explanation, and it’s a bit embarrassing.



The channel list fetched from SiliconDust’s site contains a mix of valid and invalid broadcast stations for my area. Seems all my test cases initially happened to be invalid ones. After my refactoring, I happened to pick one that was valid, which is why it appeared to begin working.



So it is good that I have an explanation and the world makes sense now, but I apologize for the wild goose chase. It did help me to know that putting the url in a VideoItem should work. Prior to that I only wondered if it would work.



Thanks again everyone.



-tony

Total noob here.



Set up plex on a mac mini core duo 1.6, 1 Gb RAM, 10.6.4 (brand new install)



connected to my hdhomerun without a problem



BUT…



no audio output in the video stream.



Netflix works, Hulu works so I can get audio but not from the hdhomerun.



Any help would be appreciated.



BTW: hdhomerun works fine through eyeTV on another computer in my home so I know it is possible for it to work on my network.



Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.