home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
Swedish TV3, TV6, TV8 and Viasat sport script
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="chrilleman" data-source="post: 545391" data-attributes="member: 14759"><p>Hello,</p><p></p><p>Thanks for a really good plugin, my wife loves it.</p><p></p><p>I found this code from a python script for XBMC, is this something you can use and att this channels to OnlineVideos?</p><p></p><p>Thanks in advance!</p><p></p><p></p><p>from uriopener import UriHandler</p><p>from cgi import logfile</p><p>import uriopener</p><p>import xbmc, xbmcgui</p><p>import sys, re, urllib, math, urlparse, types, string</p><p>#===============================================================================</p><p># Make global object available</p><p>#===============================================================================</p><p>import common</p><p>import mediaitem</p><p>import config</p><p>import controls</p><p>import contextmenu</p><p>import chn_class</p><p></p><p>logFile = sys.modules['__main__'].globalLogFile</p><p>uriHandler = sys.modules['__main__'].globalUriHandler</p><p>#===============================================================================</p><p># register the channels</p><p>#===============================================================================</p><p>if (sys.modules.has_key('progwindow')):</p><p> register = sys.modules['progwindow']</p><p>elif (sys.modules.has_key('plugin')):</p><p> register = sys.modules['plugin']</p><p>#register.channelButtonRegister.append(105)</p><p>register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se6")')</p><p>register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se3")')</p><p>register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="se8")')</p><p>register.channelRegister.append('chn_tvse.Channel("uzg-channelwindow.xml", config.rootDir, config.skinFolder, channelCode="sesport")')</p><p></p><p>#===============================================================================</p><p># main Channel Class</p><p>#===============================================================================</p><p>class Channel(chn_class.Channel):</p><p> #===============================================================================</p><p> # define class variables</p><p> #===============================================================================</p><p> def InitialiseVariables(self):</p><p> """</p><p> Used for the initialisation of user defined parameters. All should be </p><p> present, but can be adjusted</p><p> """</p><p> # call base function first to ensure all variables are there</p><p> chn_class.Channel.InitialiseVariables(self)</p><p> </p><p> self.baseUrl = "http://viastream.player.mtgnewmedia.se/"</p><p> self.maxXotVersion = "3.2.0"</p><p> self.requiresLogon = False</p><p> self.moduleName = "chn_tvse.py"</p><p> </p><p> if self.channelCode == "se3":</p><p> self.guid = "9EC8F612-2EA4-11DE-867C-B84656D89593"</p><p> #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=2se&country=se&category=0"</p><p> self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/2se/0"</p><p> self.icon = "tv3seicon.png"</p><p> self.iconLarge = "tv3selarge.png"</p><p> self.noImage = "tv3seimage.png"</p><p> self.channelName = "TV3"</p><p> self.channelDescription = u'Sända från TV3.se'</p><p> elif self.channelCode =="se6":</p><p> self.guid = "FB34E1F0-2930-11DE-A339-255856D89593"</p><p> #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=3se&country=se&category=0"</p><p> self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/3se/0"</p><p> self.icon = "tv6seicon.png"</p><p> self.iconLarge = "tv6selarge.png"</p><p> self.noImage = "tv6seimage.png"</p><p> self.channelName = "TV6"</p><p> self.channelDescription = u'Sända från TV6.se'</p><p> elif self.channelCode =="se8":</p><p> self.guid = "BDC1A5C5-2777-4D05-BB5B-742A88B89CC5"</p><p> #self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=4se&country=se&category=0"</p><p> self.mainListUri = "http://viastream.viasat.tv/siteMapData/se/4se/0"</p><p> self.icon = "tv8seicon.png"</p><p> self.iconLarge = "tv8selarge.png"</p><p> self.noImage = "tv8seimage.png"</p><p> self.channelName = "TV8"</p><p> self.channelDescription = u'Sända från TV8.se'</p><p> elif self.channelCode == "sesport":</p><p> self.guid = "87533F2C-B759-11DE-A4E3-146355D89593"</p><p> self.mainListUri = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=1se&country=se&category=0"</p><p> self.icon = "sesporticon.png"</p><p> self.iconLarge = "sesportlarge.png"</p><p> self.noImage = "sesportimage.png"</p><p> self.channelName = "Viasat Sport"</p><p> self.channelDescription = u'Sända från viasatsport.se'</p><p> self.contextMenuItems = []</p><p> self.contextMenuItems.append(contextmenu.ContextMenuItem("Play using Mplayer", "CtMnPlayMplayer", itemTypes="video", completeStatus=True))</p><p> self.contextMenuItems.append(contextmenu.ContextMenuItem("Play using DVDPlayer", "CtMnPlayDVDPlayer", itemTypes="video", completeStatus=True))</p><p> </p><p> </p><p> self.episodeItemRegex = '<siteMapNode title="([^"]+)" id="([^"]+)" children="true"'</p><p> self.videoItemRegex = '<ProductId>([^<]+)</ProductId>\W+<Title><!\[CDATA\[([^>]+)\]\]></Title>'</p><p> self.folderItemRegex = '<siteMapNode title="([^"]+)" id="([^"]+)" children="([^"]+)" articles="[123456789]\d*"'</p><p> self.mediaUrlRegex = '<param name="flashvars" value="pathflv\W*=\W*([^"]+)_definst_/([^"]+)\$start'</p><p> </p><p> """ </p><p> The ProcessPageNavigation method will parse the current data using the pageNavigationRegex. It will</p><p> create a pageItem using the CreatePageItem method. If no CreatePageItem method is in the channel,</p><p> a default one will be created with the number present in the resultset location specified in the </p><p> pageNavigationRegexIndex and the url from the combined resultset. If that url does not contain http://</p><p> the self.baseUrl will be added. </p><p> """</p><p> # remove the &amp; from the url</p><p> self.pageNavigationRegex = 'link button-->\W+<li class="[^"]*"><a href="([^"]+)"[^>]+>(\d+)' </p><p> self.pageNavigationRegexIndex = 1</p><p></p><p> #========================================================================== </p><p> # non standard items</p><p> self.categoryName = ""</p><p> self.currentUrlPart = ""</p><p> </p><p> return True</p><p> </p><p> #==============================================================================</p><p> def CreateEpisodeItem(self, resultSet):</p><p> """</p><p> Accepts an arraylist of results. It returns an item. </p><p> """</p><p> if self.channelCode == "se8":</p><p> url = "http://viastream.viasat.tv/siteMapData/se/4se/%s" % (resultSet[1],)</p><p> elif self.channelCode == "se6":</p><p> url = "http://viastream.viasat.tv/siteMapData/se/3se/%s" % (resultSet[1],)</p><p> elif self.channelCode == "se3":</p><p> url = "http://viastream.viasat.tv/siteMapData/se/2se/%s" % (resultSet[1],)</p><p> elif self.channelCode == "sesport":</p><p> url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=1se&country=se&category=%s" %(resultSet[1],)</p><p> </p><p> item = mediaitem.MediaItem(resultSet[0], url)</p><p> item.description = resultSet[0]</p><p> item.icon = self.icon</p><p> return item</p><p> </p><p> #==============================================================================</p><p> def CreateFolderItem(self, resultSet):</p><p> if self.channelCode == "se8" or self.channelCode == "se6" or self.channelCode == "se3":</p><p> url = "http://viastream.viasat.tv/Products/Category/%s" % (resultSet[1],)</p><p> else:</p><p> if resultSet[2] == "false":</p><p> url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=Products&category=%s" % (resultSet[1],)</p><p> else: </p><p> url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=siteMapData&channel=3se&country=se&category=%s" % (resultSet[1],)</p><p> </p><p> item = mediaitem.MediaItem(resultSet[0], url)</p><p> item.thumb = self.noImage</p><p> item.type = "folder"</p><p> item.complete = True</p><p> item.icon = self.folderIcon</p><p> return item</p><p> </p><p> #============================================================================= </p><p> def CreateVideoItem(self, resultSet):</p><p> """</p><p> Accepts an arraylist of results. It returns an item. </p><p> """</p><p> logFile.debug('starting FormatVideoItem for %s', self.channelName)</p><p> </p><p> if (self.channelCode == "sesport"):</p><p> url = "http://viastream.player.mtgnewmedia.se/xml/xmltoplayer.php?type=Products&clipid=%s" % (resultSet[0],)</p><p> else:</p><p> url = "http://viastream.viasat.tv/Products/%s" % (resultSet[0],) #223950</p><p></p><p> </p><p> item = mediaitem.MediaItem(resultSet[1], url)</p><p> item.type = "video"</p><p> item.complete = False</p><p> item.icon = self.icon</p><p> return item</p><p> </p><p> #============================================================================= </p><p> def UpdateVideoItem(self, item):</p><p> """</p><p> Accepts an item. It returns an updated item. </p><p> """</p><p> logFile.debug('starting UpdateVideoItem for %s (%s)', item.name, self.channelName)</p><p> data = uriHandler.Open(item.url, pb=False)</p><p> </p><p> for description in common.DoRegexFindAll("<LongDescription><!\[CDATA\[([^<]+)\]\]", data):</p><p> item.description = description</p><p> </p><p> for image in common.DoRegexFindAll("<Url>([^<]+)</Url>\W+</ImageMedia>", data):</p><p> item.thumbUrl = image </p><p> item.thumb = self.CacheThumb(item.thumbUrl)</p><p> </p><p> for url in common.DoRegexFindAll("<Url>([^<]+)</Url>\W+</Video>", data):</p><p> item.AppendMediaListItem(url)</p><p></p><p> item.complete = True</p><p> logFile.debug("Found mediaurl: %s", item)</p><p> return item</p><p> </p><p> #==============================================================================</p><p> # ContextMenu functions</p><p> #==============================================================================</p><p> def CtMnPlayMplayer(self, selectedIndex):</p><p> item = self.listItems[selectedIndex]</p><p> self.PlayVideoItem(item, "mplayer")</p><p> </p><p> def CtMnPlayDVDPlayer(self, selectedIndex):</p><p> item = self.listItems[selectedIndex]</p><p> self.PlayVideoItem(item, "dvdplayer")</p></blockquote><p></p>
[QUOTE="chrilleman, post: 545391, member: 14759"] 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 & 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") [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
Swedish TV3, TV6, TV8 and Viasat sport script
Contact us
RSS
Top
Bottom