Kodi Community Forum
Hulu Plugin Development Thread - Developers only! - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: Hulu Plugin Development Thread - Developers only! (/showthread.php?tid=45888)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


Hulu Plugin Development Thread - Developers only! - rwparris2 - 2009-02-23 03:40

This thread is for developer's to discuss the Hulu Plugin for xbmc.

The current code by rwparris2 can be found here: (you may need to back some revisions if the plugin is no longer active) http://xbmc-addons.googlecode.com/svn/trunk/plugins/video/Hulu/


http://gitorious.org/xbmc-hulu/pages/Home


- rwparris2 - 2009-02-23 03:57

retalogic if you'll post a diff or the entire plugin on http://code.google.com/p/xbmc-addons/issues/list I'll test it and get it in svn to make it easier on users. Also provide some instructions on what is needed for the gnash stuff, as I coulnd't find it in the 'other' thread.

I'll add checks for xbox to warn users if they try to use it from there too.
& if there is a (cross-platform) way to check to see if gnash is installed it would be a good idea to do that as well.


- wonslung - 2009-02-23 04:04

i had to compile xbmc and gnash from source to get it working properly....it is also working in boxee now.

Question, can gnash be compiled for the xbox?


- rectalogic - 2009-02-23 04:35

rwparris2 Wrote:retalogic if you'll post a diff or the entire plugin on http://code.google.com/p/xbmc-addons/issues/list I'll test it and get it in svn to make it easier on users. Also provide some instructions on what is needed for the gnash stuff, as I coulnd't find it in the 'other' thread.

Diffs attached to issue:
http://code.google.com/p/xbmc-addons/issues/detail?id=10

The only specific gnash instructions I had were tips on getting it compiled for MacOS in this post:
http://forum.xbmc.org/showpost.php?p=287270&postcount=650


- wonslung - 2009-02-23 04:38

rectalogic Wrote:Diffs attached to issue:
http://code.google.com/p/xbmc-addons/issues/detail?id=10

The only specific gnash instructions I had were tips on getting it compiled for MacOS in this post:
http://forum.xbmc.org/showpost.php?p=287270&postcount=650

i was able to get it working on linux, just wasn't sure if gnash would compile for xbox..


- jonm42 - 2009-02-23 18:48

And you can confirm if the decode is working by following the instructions here:

http://forum.xbmc.org/showpost.php?p=287278&postcount=654


- redleader36 - 2009-02-23 19:00

is there anything keeping gnash from compiling on an xbox? are the required libraries too much for the xbox?


- rwparris2 - 2009-02-23 19:21

anyone have it working on windows? linux seems to be fine but with windows everytime it gets stuck at 'checking security of host hulu.com'

the command I'm using is:

Code:
gnash "C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\DecryptPid.swf" --render-mode 0 --once --verbose --param FlashVars=pid=fe5a45ce4f6c6c3b8975463d33a311d57c453b6db8e65d9f727d05a673f90472~e​1f809cf7aa007607812588899aededbd98782aaae43d55a8e17b11582905932>"C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\output.txt"
the > just puts stdout in a txt file, it makes no difference whether it is there or not.

Edit: FWIW I'm using a precompiled version of gnash found here http://webscripts.softpedia.com/script/Development-Scripts-js/Gnash-21619.html

Edit2: Won't work if I point it at a local sec.swf, either. DecryptPid.swf opens in a small window, and I get no output. I let it sit ~15 minutes before closing it.


- Cre8tvDstruct0n - 2009-02-23 19:26

I'm new to this but I'll help anyway I can. What stage we at now? WIll Apple tv work with this gnash plugin? IS this the idea? that its porting it through it?

cd

btw I"m using a windows machine right now. what do I need to compile this to test it?


- rwparris2 - 2009-02-23 19:38

redleader36 Wrote:is there anything keeping gnash from compiling on an xbox? are the required libraries too much for the xbox?

Xbox can't run separate processes so gnash would have to be added to xbmc itself.


- n9mjg - 2009-02-23 20:43

Cre8tvDstruct0n Wrote:WIll Apple tv work with this gnash plugin?

In order to get this working on Apple TV, someone with an Intel based Mac running OS X 10.4 would have to compile gnash and all of its dependencies and than place the entire thing into a package installer or tar archive. Either way it's a daunting task and would be a very large install.


- rectalogic - 2009-02-23 21:21

rwparris2 Wrote:Edit2: Won't work if I point it at a local sec.swf, either. DecryptPid.swf opens in a small window, and I get no output. I let it sit ~15 minutes before closing it.

Your gnash is probably not console mode - i.e. it's a GUI app and so has no stdout. You can use dumpbin to check the subsystem of your gnash, probably needs to be Windows CUI and not Windows GUI
http://support.microsoft.com/kb/177429

See if you have dump-gnash, it may be CUI.


- mgandalf - 2009-02-23 21:51

Regarding missing season episodes due to how the plugin grabs the rss feed which seems to only have 20 entries, I've created a short script to parse out all the episodes based on a given season. I'm not at all familiar with Python, so I wrote this as a proof of concept in Perl.

Maybe someone can adapt this to Python?

Code:
#!/usr/bin/perl

package main;

$Version  = 'Hulu Episode Grabber v0.1';

# Hulu Episide Grabber
#
# Written by Mark R. Buechler 02/23/09
# License: GPL2

sub usage
  {
    die <<"EndUsage";
$Version

Usage:
     -show <id>    : Hulu show_id.
     -season <num> : Season number.

EndUsage
  }

use LWP::Simple;
use Getopt::Long;
use strict;

main();

sub getArgs {
        my $showid;
        my $season;

        my $p = new Getopt::Long::Parser;

        if (!$p->getoptions('show=s'    => \$showid,
                            'season=i'  => \$season)) {
                print "Invalid parameters given.\n";
                usage();
        }

        if (!$showid || !$season) {
                print "Please specify -show & -season.\n";
                usage();
        }

        return($showid, $season);
}

sub main {
        my($showid, $season) = getArgs();

        my $html = parseAjax($showid, $season);

        my $parser = new HuluParser;

        $parser->parse($html);
}

sub parseAjax {
        my $showid = shift;
        my $season = shift;
        my $parsed;
        my $id;

        my $url = "http://www.hulu.com/videos/season_expander?".
          "order=acce&page=1&season_number=$season&show_id=$showid";

        my $ajax;
        if (!defined($ajax = LWP::Simple::get($url))) {
                return undef;
        }

        foreach my $line (split(/\n/, $ajax)) {
                if ($line =~ /^new\sInsertion.After\(.*\sid=\\\"(.*)\\\"\s/) {
                        $id = $1;
                } elsif ($line =~ /^new\sInsertion.Before\(\"$id\",\s\"(.*)\"\)\;/) {
                        $parsed = $1;
                }
        }

        $parsed =~ s/\\074/\</g;
        $parsed =~ s/\\076/\>/g;
        $parsed =~ s/\\"/\"/g;
        $parsed =~ s/\\'/\'/g;

        return $parsed;
}

package HuluParser;
use base qw(HTML::Parser);

my $EPISODE_NUM = 0;
my $EPISODE_NAM = 0;

sub text {
        my $self = shift;
        my $origtext = shift;
        my $is_cdata = shift;

        if ($EPISODE_NUM) {
                print "$origtext: ";
        } elsif ($EPISODE_NAM) {
                print "$origtext\n";
        }
}

sub start {
        my $self = shift;
        my $tag = shift;
        my $attr = shift;
        my $attrseq = shift;
        my $origtext = shift;

        if ($tag eq 'td') {
                foreach my $_attr (keys %{$attr}) {
                        if (($_attr eq 'class') && ($$attr{$_attr} eq 'c0')) {
                                $EPISODE_NUM = 1;
                        }
                }
        } elsif ($tag eq 'a') {
                foreach my $_attr (keys %{$attr}) {
                        if (($_attr eq 'href') &&
                            ($$attr{$_attr} =~ /^http\:\/\/www.hulu.com\/watch/)) {
                                $EPISODE_NAM = 1;
                        }
                }
        }
}

sub end {
        my $self = shift;
        my $tag = shift;
        my $origtext = shift;

        $EPISODE_NUM = 0;
        $EPISODE_NAM = 0;
}

- Mark.


- djrobd - 2009-02-24 01:10

rwparris2 Wrote:anyone have it working on windows? linux seems to be fine but with windows everytime it gets stuck at 'checking security of host hulu.com'

the command I'm using is:

Code:
gnash "C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\DecryptPid.swf" --render-mode 0 --once --verbose --param FlashVars=pid=fe5a45ce4f6c6c3b8975463d33a311d57c453b6db8e65d9f727d05a673f90472~e​1f809cf7aa007607812588899aededbd98782aaae43d55a8e17b11582905932>"C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\output.txt"
the > just puts stdout in a txt file, it makes no difference whether it is there or not.
[/code]

The options for the win32 binary of gnash are different than the linux version.

The command to use should be:

Code:
gnash "C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\DecryptPid.swf" -r 0 -1 -v -P FlashVars=pid=fe5a45ce4f6c6c3b8975463d33a311d57c453b6db8e65d9f727d05a673f90472~e​1f809cf7aa007607812588899aededbd98782aaae43d55a8e17b11582905932

The only problem I have is that I don't know python enough to make these changes to the plugin itself. Hopefully you can figure it out for us windows users.


- rwparris2 - 2009-02-24 03:23

djrobd Wrote:The options for the win32 binary of gnash are different than the linux version.

The command to use should be:

Code:
gnash "C:\Program Files\XBMC\plugins\video\Hulu\resources\lib\DecryptPid.swf" -r 0 -1 -v -P FlashVars=pid=fe5a45ce4f6c6c3b8975463d33a311d57c453b6db8e65d9f727d05a673f90472~e​1f809cf7aa007607812588899aededbd98782aaae43d55a8e17b11582905932
The only problem I have is that I don't know python enough to make these changes to the plugin itself. Hopefully you can figure it out for us windows users.

I'll test that string when I get home. Checking platforms is easy.

Edit -- sorry for being so lazy, I'm sure this info is easily available from gnash's site...