Swedish TV3, TV6, TV8 and Viasat sport script

Discussion in 'OnlineVideos' started by chrilleman, December 9, 2009.

  1. chrilleman

    chrilleman Portal Member

    Joined:
    September 3, 2005
    Messages:
    8
    Likes Received:
    0
    Ratings:
    +0 / 0
    Hello,

    Thanks for a really good plugin, my wife loves it.

    I found this code from a python script for XBMC, is this something you can use and att this channels to OnlineVideos?

    Thanks in advance!


    from uriopener import UriHandler
    from cgi import logfile
    import uriopener
    import xbmc, xbmcgui
    import sys, re, urllib, math, urlparse, types, string
    #===============================================================================
    # Make global object available
    #===============================================================================
    import common
    import mediaitem
    import config
    import controls
    import contextmenu
    import chn_class

    logFile = sys.modules['__main__'].globalLogFile
    uriHandler = sys.modules['__main__'].globalUriHandler
    #===============================================================================
    # register the channels
    #===============================================================================
    if (sys.modules.has_key('progwindow')):
    register = sys.modules['progwindow']
    elif (sys.modules.has_key('plugin')):
    register = sys.modules['plugin']
    #register.channelButtonRegister.append(105)
    register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se6")')
    register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se3")')
    register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se8")')
    register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="sesport")')



    #===============================================================================
    # main Channel Class
    #===============================================================================
    class Channel(chn_class.Channel):
    #===============================================================================
    # define class variables
    #===============================================================================
    def InitialiseVariables(self):
    """
    Used for the initialisation of user defined parameters. All should be
    present, but can be adjusted
    """
    # call base function first to ensure all variables are there
    chn_class.Channel.InitialiseVariables(self)

    self.baseUrl = "http://viastream.player.mtgnewmedia.se/"
    self.maxXotVersion = "3.2.0"
    self.requiresLogon = False
    self.moduleName = "chn_tvse.py"

    if self.channelCode == "se3":
    self.guid = "9EC8F612-2EA4-11DE-867C-B84656D89593"
    #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=2se&country=se&category=0"
    self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/2se/0"
    self.icon = "tv3seicon.png"
    self.iconLarge = "tv3selarge.png"
    self.noImage = "tv3seimage.png"
    self.channelName = "TV3"
    self.channelDescription = u'Sända från TV3.se'
    elif self.channelCode =="se6":
    self.guid = "FB34E1F0-2930-11DE-A339-255856D89593"
    #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=3se&country=se&category=0"
    self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/3se/0"
    self.icon = "tv6seicon.png"
    self.iconLarge = "tv6selarge.png"
    self.noImage = "tv6seimage.png"
    self.channelName = "TV6"
    self.channelDescription = u'Sända från TV6.se'
    elif self.channelCode =="se8":
    self.guid = "BDC1A5C5-2777-4D05-BB5B-742A88B89CC5"
    #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=4se&country=se&category=0"
    self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/4se/0"
    self.icon = "tv8seicon.png"
    self.iconLarge = "tv8selarge.png"
    self.noImage = "tv8seimage.png"
    self.channelName = "TV8"
    self.channelDescription = u'Sända från TV8.se'
    elif self.channelCode == "sesport":
    self.guid = "87533F2C-B759-11DE-A4E3-146355D89593"
    self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=1se&country=se&category=0"
    self.icon = "sesporticon.png"
    self.iconLarge = "sesportlarge.png"
    self.noImage = "sesportimage.png"
    self.channelName = "Viasat Sport"
    self.channelDescription = u'Sända från viasatsport.se'
    self.contextMenuItems = []
    self.contextMenuItems.append(contextmenu.ContextMenuItem("Play using Mplayer", "CtMnPlayMplayer", itemTypes="video", completeStatus=True))
    self.contextMenuItems.append(contextmenu.ContextMenuItem("Play using DVDPlayer", "CtMnPlayDVDPlayer", itemTypes="video", completeStatus=True))


    self.episodeItemRegex = '<siteMapNode title="([^"]+)" id="([^"]+)" children="true"'
    self.videoItemRegex = '<ProductId>([^<]+)</ProductId>\W+<Title><!\[CDATA\[([^>]+)\]\]></Title>'
    self.folderItemRegex = '<siteMapNode title="([^"]+)" id="([^"]+)" children="([^"]+)" articles="[123456789]\d*"'
    self.mediaUrlRegex = '<param name="flashvars" value="pathflv\W*=\W*([^"]+)_definst_/([^"]+)\$start'

    """
    The ProcessPageNavigation method will parse the current data using the pageNavigationRegex. It will
    create a pageItem using the CreatePageItem method. If no CreatePageItem method is in the channel,
    a default one will be created with the number present in the resultset location specified in the
    pageNavigationRegexIndex and the url from the combined resultset. If that url does not contain http://
    the self.baseUrl will be added.
    """
    # remove the &amp; from the url
    self.pageNavigationRegex = 'link button-->\W+<li class="[^"]*"><a href="([^"]+)"[^>]+>(\d+)'
    self.pageNavigationRegexIndex = 1

    #==========================================================================
    # non standard items
    self.categoryName = ""
    self.currentUrlPart = ""

    return True

    #==============================================================================
    def CreateEpisodeItem(self, resultSet):
    """
    Accepts an arraylist of results. It returns an item.
    """
    if self.channelCode == "se8":
    url = "http://viastream.viasat.tv/siteMapData/se/4se/%s" % (resultSet[1],)
    elif self.channelCode == "se6":
    url = "http://viastream.viasat.tv/siteMapData/se/3se/%s" % (resultSet[1],)
    elif self.channelCode == "se3":
    url = "http://viastream.viasat.tv/siteMapData/se/2se/%s" % (resultSet[1],)
    elif self.channelCode == "sesport":
    url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=1se&country=se&category=%s" %(resultSet[1],)

    item = mediaitem.MediaItem(resultSet[0], url)
    item.description = resultSet[0]
    item.icon = self.icon
    return item

    #==============================================================================
    def CreateFolderItem(self, resultSet):
    if self.channelCode == "se8" or self.channelCode == "se6" or self.channelCode == "se3":
    url = "http://viastream.viasat.tv/Products/Category/%s" % (resultSet[1],)
    else:
    if resultSet[2] == "false":
    url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=Products&category=%s" % (resultSet[1],)
    else:
    url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=3se&country=se&category=%s" % (resultSet[1],)

    item = mediaitem.MediaItem(resultSet[0], url)
    item.thumb = self.noImage
    item.type = "folder"
    item.complete = True
    item.icon = self.folderIcon
    return item

    #=============================================================================
    def CreateVideoItem(self, resultSet):
    """
    Accepts an arraylist of results. It returns an item.
    """
    logFile.debug('starting FormatVideoItem for %s', self.channelName)

    if (self.channelCode == "sesport"):
    url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=Products&clipid=%s" % (resultSet[0],)
    else:
    url = "http://viastream.viasat.tv/Products/%s" % (resultSet[0],) #223950


    item = mediaitem.MediaItem(resultSet[1], url)
    item.type = "video"
    item.complete = False
    item.icon = self.icon
    return item

    #=============================================================================
    def UpdateVideoItem(self, item):
    """
    Accepts an item. It returns an updated item.
    """
    logFile.debug('starting UpdateVideoItem for %s (%s)', item.name, self.channelName)
    data = uriHandler.Open(item.url, pb=False)

    for description in common.DoRegexFindAll("<LongDescription><!\[CDATA\[([^<]+)\]\]", data):
    item.description = description

    for image in common.DoRegexFindAll("<Url>([^<]+)</Url>\W+</ImageMedia>", data):
    item.thumbUrl = image
    item.thumb = self.CacheThumb(item.thumbUrl)

    for url in common.DoRegexFindAll("<Url>([^<]+)</Url>\W+</Video>", data):
    item.AppendMediaListItem(url)

    item.complete = True
    logFile.debug("Found mediaurl: %s", item)
    return item

    #==============================================================================
    # ContextMenu functions
    #==============================================================================
    def CtMnPlayMplayer(self, selectedIndex):
    item = self.listItems[selectedIndex]
    self.PlayVideoItem(item, "mplayer")

    def CtMnPlayDVDPlayer(self, selectedIndex):
    item = self.listItems[selectedIndex]
    self.PlayVideoItem(item, "dvdplayer")
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    I'm not a python expert, but this can be converted to OnlineVideos (unfortunately not automatically, but by hand). Same goes for all the other XBMC scripts. If I get the time I'll have a beat at it.
     
  4. bootroos

    bootroos Portal Member

    Joined:
    July 10, 2009
    Messages:
    6
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Sweden Sweden
    will be great if you fix it :)

    if you need a swedish ip(vpn) PM and i buy you one!
     
  5. chrilleman

    chrilleman Portal Member

    Joined:
    September 3, 2005
    Messages:
    8
    Likes Received:
    0
    Ratings:
    +0 / 0
    Would be very nice to get this online play channels, I can also assist with vpn connection if you need, and i am willing to test your scripts :)
    My wife would love if this would work :p
     
  6. pnyberg

    pnyberg Portal Pro

    Joined:
    August 21, 2006
    Messages:
    405
    Likes Received:
    18
    Occupation:
    IT professional
    Location:
    Stockholm
    Ratings:
    +19 / 0
    Home Country:
    Sweden Sweden
    Show System Specs
    My wife would kiss you offbyone if you fix this (and I will let her ;))!
     
  7. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    Test Version

    Hi,
    I got something to test. Here is is preview version of 0.16
    I added a site Viasat with Sport,TV3,TV6,TV8. I was only able to test the non geo blocked content. I'd ask you to test the other stuff and report back.
     
    • Like Like x 2
  8. chrilleman

    chrilleman Portal Member

    Joined:
    September 3, 2005
    Messages:
    8
    Likes Received:
    0
    Ratings:
    +0 / 0
    Hi offbyone,

    it works really good :)

    Just two small things that doesn´t work, getting pictures for the programs, and getting the descriptions for the shows, not really a big problem but a nice to have feature :)

    Thanks for a great work!
     
  9. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    Yeah I know, the files they give don't really have much information :( I'll try to get some once it's confirmed that the util works.
     
  10. bootroos

    bootroos Portal Member

    Joined:
    July 10, 2009
    Messages:
    6
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Sweden Sweden
    Really nice work :)

    All video source tested so far has worked.

    have some name problem

    example: tv3/45 Minuter/Säsong 6/(episode name)

    some episode have same name (45 minuter)
    some have right name? (45 minuter - {date})
    and 1 whith name.ext (45 minuter - 2006-03-06.wmv)

    is it possible to have them all with name - date?


    Thanks again and a really nice work :D
     
  11. quarkx
    • Premium Supporter

    quarkx MP Donator

    Joined:
    October 22, 2007
    Messages:
    7
    Likes Received:
    0
    Ratings:
    +0 / 0
    Nice work :)

    Works great.

    Thanks.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!