Kodi Community Forum

Full Version: [RELEASE] Demand 5 (Video) Addon - UK Channel 5 on demand
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
The best way to install this new addon and ensure you receive updates as well as quick access to my other addons, is to install my repository from:
http://nibor-xbmc-repo.googlecode.co...tory.nibor.zip

Alternatively you can just get version 1.0.0 (latest at time of writing) from:
http://code.google.com/p/nibor-xbmc-repo/downloads/list
Really nice plugin everything is loading but when I go to play the link I get a script fail. I have been having trouble with 4od/itv/demand5 here is the log and thank you for your time and again great plugin. http://pastebin.com/1qgZmpEM
Awesome addon. Nearly all UK FTA covered now.

Working great on openelec beta 1 nightly but not working on win 7 beta 1. Getting a script error on playback. Although it's fair to say we've never managed to get 4od running on this box either.

Thanks a lot for this top shelf addon.
Thanks for the add-on but getting script errors also.

The 4od plugin works but this Channel5 one does not so hopefully you can fix it?
Working fine now.Thank you great plugin
me too. However if a stream fails it won't start a new one. needs an xbmc restart.

excellent work Nibor
lefty420 Wrote:me too. However if a stream fails it won't start a new one. needs an xbmc restart.

excellent work Nibor

yea good plugin although the script errors are annoyingBig Grin
Awesome work on this and the 4OD plugin!!

Also impressed with the download functionality (I've actually used your code to add the same functionality to my copies of the the iPlayer and ITV PLayer plugins).

Just a couple of issues, the filenames need to be validated as sometimes they contain invalid characters, in particular the colon character, this can be done just before you initialised the savepath, ie:

Code:
filename = re.sub('[:\\/*?\<>|"]+', '', filename)
savePath = os.path.join( "T:"+os.sep, downloadFolder, filename )

Also, both "Fifi and The Flower Tots" & "Mr Men" in the Milkshake! category bring up empty lists, I've checked on my iPad app and they should definately be populated so I guess a small bug in the scraping somewhere.

Still, awesome work!!

Edit
Missing programs
Had a quick look into this and the code currently only parses the current series;

ie
http://www.channel5.com/shows/fifi-and-t...s/episodes

Will show only Series 3, however if you scrape this page you will also find the other 2 series, ie

http://www.channel5.com//shows/fifi-and-...ason=12302
http://www.channel5.com//shows/fifi-and-...ason=09234

Both of which have shows available for viewing
Couldn't take my 6 year daughter nagging me anymore so I've fixed the missing programs issue.

If you replace the current ShowEpisodes function with the following 2 functions it should then work, it basically scrapes for all series and then uses the existing functionality to scrape for individual episodes.

If the series scrape finds nothing then it does exactly what it used to do.

Code:
def ShowEpisodes( showId, showTitle ):
    # Get the page with episodes for this show
    print "Looking for episodes for: " + showTitle
    url = "http://www.channel5.com" + showId + "/episodes"

        html    = geturllib.GetURL( url, 20000 ) # ~6 hrs  
    epsInfo = re.findall( 'episodes\?season=(.*?)">(.*?)</a>', html, re.DOTALL )
        
    for season, series in epsInfo:                      
            ParseEpisodes(url+"?season="+season, showTitle, series)

        if len(epsInfo) == 0:
            ParseEpisodes(url, showTitle)

        xbmcplugin.endOfDirectory( handle=gPluginHandle, succeeded=True )

def ParseEpisodes(url, showTitle, series = ""):          

        print "URL: " + url
        html = geturllib.GetURL( url, 20000 ) # ~6 hrs  

    listItems = []
    # Does this show have multiple episodes?
    x = re.search( '<ul class="resource_list episodes">(.*?)<!-- /#contents -->', html, re.DOTALL)
    if ( x != None ):
        # Extract the section with the episode list
        html = x.groups()[0]
        
        # Parse out the episodes
        epsInfo = re.findall( '<li class="clearfix">.*?<a href="(.*?)".*?<img .*?src="(.*?)".*?<h3><a.*?>(.*?)</a>.*?<p class="description">(.*?)</p>(.*?)</div>', html, re.DOTALL )
        
        for epInfo in epsInfo:
            href = epInfo[0]
            thumbnail = epInfo[1]
            title = epInfo[2]
            description = epInfo[3]
            x = epInfo[4]
            
            title = title.replace( '&amp;', '&' )
            title = title.replace( "&quot;", '"' )
            title = title.replace( "&pound;", '£' )
            
            fn = showTitle + " - " + title
            
            if ( re.search( 'vod_availability', x, re.DOTALL) ):
                                fullTitle = title
                                if series != "":
                                    fullTitle = series + ": " + fullTitle                                
                newListItem = xbmcgui.ListItem(fullTitle)
                newListItem.setThumbnailImage(thumbnail)
                newListItem.setInfo('video', {'Title': title, 'Plot': description, 'PlotOutline': description})
                url = gBaseURL + '?ep=' + mycgi.URLEscape(href) + "&title=" + mycgi.URLEscape(title) + "&fn=" + mycgi.URLEscape(fn)
                    
                listItems.append( (url,newListItem,False) )
    else:
        title = re.search( '<h3 class="episode_header"><span class="sifr_grey_light">(.*?)</span></h3>', html, re.DOTALL ).groups()[0]
        description = re.search( 'property="og:description" content="(.*?)"', html, re.DOTALL ).groups()[0]
        thumbnail = re.search( 'property="og:image" content="(.*?)"', html, re.DOTALL ).groups()[0]
        href = re.search( 'property="og:url" content="(.*?)"', html, re.DOTALL ).groups()[0]
        
        href = re.search( '(/shows.*)', href ).groups()[0]
        thumbnail = thumbnail.replace( 'facebook_with_play', 'large_size' )
        
        if ( title <> showTitle ):
            fn = showTitle + " - " + title
        else:
            fn = showTitle
        
        url = gBaseURL + '?ep=' + mycgi.URLEscape(href) + "&title=" + mycgi.URLEscape(title) + "&fn=" + mycgi.URLEscape(fn)
        
        newListItem = xbmcgui.ListItem(title)
        newListItem.setThumbnailImage(thumbnail)
        newListItem.setInfo('video', {'Title': title, 'Plot': description, 'PlotOutline': description})
        
        listItems.append( (url,newListItem,False) )
        
    xbmcplugin.addDirectoryItems( handle=gPluginHandle, items=listItems )
    #xbmcplugin.endOfDirectory( handle=gPluginHandle, succeeded=True )
after i first installed it played a episode of dangerous driver school with no problems. them when i tried anything else i got script errors. then went back to dangerous driver shcool and it would no longer play. maybe there is a bug in the script. any chance you could look at making a plugin for sky go.
On ATV2 and OSX Lion this plugin does not work, it just gives a script error when you select a file to play.

Can you please look into this?
Yes please help i only added this last night and it was working until 09.00 am today the kids were buzzing their crusts off watching Milkshake Smile
i hope you have time to fix it soon Smile
Channel 5 seem to have made a change to the Demand 5 service which stopped the plugin playing or downloading. I have therefore updated it to address that issue. I'll update again soon to include fixes for some other issues users have reported.

If you installed via my repository you should automatically get an update
(My repo: http://nibor-xbmc-repo.googlecode.co...tory.nibor.zip )

Otherwise you can get a .zip for 1.0.1 from:
http://code.google.com/p/nibor-xbmc-repo/downloads/list
MEGA Nibor its working again Smile
Your the Top Man For The Job
Hi. Great work Nibor. Thanks so much for putting the effort into these.

I have the 4OD plugin working just fine....but still not luck with Demand 5.

I am in Ireland. Is this geo-restricted....and hence the cause of my error? (Its the usual "error script failed Demand 5").
Pages: 1 2 3 4 5 6 7