Kodi Community Forum
[RELEASE] Norwegian NRK Web-TV (Video) Plugin - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154)
+---- Thread: [RELEASE] Norwegian NRK Web-TV (Video) Plugin (/showthread.php?tid=52824)



- VictorV - 2009-12-09

klauslunde: since you probably don't have a portable installation the correct path will be: %APPDATA%/xbmc/plugins/video

just paste it in explorer adress bar and it will find the correct path for the environment variable APPDATA


- klauslunde - 2009-12-09

VictorV Wrote:klauslunde: since you probably don't have a portable installation the correct path will be: %APPDATA%/xbmc/plugins/video

just paste it in explorer adress bar and it will find the correct path for the environment variable APPDATA

Hjertlig takk ViktorV! Og takk for en fantastisk bra plugin Smile


Problems with live stream - PanterA - 2009-12-09

Hi, Congrats with an absolute fantastic plugin. Love it!

My problem is with the live streams. Until I discovered XBMC yesterday I've used mms livestreams in WMP/VLC for watching NRK. I have done this for some time as i live abroad, and have no other posibilities. I've learned as for me i have to alter between a few mms links for watching NRK. I dont know if it's cause NRK dont have a constant stream abroad, but I have to alter between these links to watch NRK1:

mms://straumv.nrk.no/nrk_tv_direkte_nrk1_h
mms://straumV.nrk.no/nrk_tv_nrk1_h
mms://straumv.nrk.no/nrk_tv_webvid01_h
mms://straumv.nrk.no/nrk_tv_webvid03_h
mms://straumv.nrk.no/nrk_tv_webvid04_h
mms://straumv.nrk.no/nrk_tv_webvid05_h
mms://straumv.nrk.no/nrk_tv_webvid08_h
mms://straumv.nrk.no/nrk_tv_webvid10_h

Are there any ways for me to add som code in chlive.py so I can alter between these. Guess I have to have more than one BASEURL or something.

And I prefere always the _h prefix for best quality. I dont understand where the conectionspeed (l, m, h) are set for your links.

Thanks again for your hard work in this plugin.
Rock on!

PanterA
XBMC 9.11-BETA1 R24883 (COMPILED : NOV 22 2009)


- VictorV - 2009-12-10

You should always find the correct stream using 'mms://straumv.nrk.no/nrk_tv_direkte_nrk%channel_%quality' i think.
The plugin extracts the first address in http://straumv.nrk.no/nrk_tv_direkte_nrk%channel_%quality and swaps http with mms, and it have seemed to work correctly everytime I've tried. It's also that url that is used in their webapp

The streaming quality can be found in the plugin settings. Right click on the plugin icon, or a icon in root level..


- VictorV - 2009-12-11

New version with minor fixes:

http://prosjektet.net/xbmc/plugins/nrk_plugin_09122009.zip

* True Blood and series that uses same system will now work
* Windows and Linux will now play all playlists. No more "This video is not supported by your platform"
* Removed kids play lists cause of site restructuring.I think most of it can be found under program anyways

Some other series/programs that don't work properly?


- bluejudas - 2009-12-11

perper Wrote:Tried the latest version both on xbox (latest tc3h) and kubuntu (from standard 9.10 repository), but the plugin did not work. It errored out when trying to play a clip.

"Connection to host http-icanal-od.online.no raised exception. No data received. Aborting..."

Which isn't to strange as the correct url starts with mms...

The error seems to be in line 436 of nrk_api.py and was corrected by reversing the arguments:

Original, non working:
return url.replace('mms', 'http')

Modified, working:
return url.replace('http','mms')

victor you need to do this...

~b


- VictorV - 2009-12-11

I need to see some error logs since that would break the script in several other places


- bluejudas - 2009-12-11

VictorV Wrote:I need to see some error logs since that would break the script in several other places
Are you talking to me ?
When I change the "replace" I can stream icanal streams. You can test it on e.g. Program->Tema liste->Fakta->Schakespeares sjulte koder

~b


- PanterA - 2009-12-11

VictorV Wrote:You should always find the correct stream using 'mms://straumv.nrk.no/nrk_tv_direkte_nrk%channel_%quality' i think.
The plugin extracts the first address in http://straumv.nrk.no/nrk_tv_direkte_nrk%channel_%quality and swaps http with mms, and it have seemed to work correctly everytime I've tried. It's also that url that is used in their webapp

The streaming quality can be found in the plugin settings. Right click on the plugin icon, or a icon in root level..

Thanx for answering. The problem for me is that this stream nrk_tv_direkte_nrk1_h almost never work. I believe NRK don't stream outside Norway. The stream are not constant, so I have to alter between those I wrote earlier. If I try to watch the live stream trough NRK nett-TV it doesn't work. And I believe this is the same streamadress as in your app.

I'll try editing your chlive.py som I can choose between this links I have to alter. It will mess up your app if you do it so it's not a request for change.

My alternative is maybe put these links as add source or something in XBMC.

PanterA


- VictorV - 2009-12-11

bluejudas Wrote:Are you talking to me ?
When I change the "replace" I can stream icanal streams. You can test it on e.g. Program->Tema liste->Fakta->Schakespeares sjulte koder

~b

Code:
20:09:13 T:4708 M:2166681600  NOTICE: PLUGIN::CONNECTION -> '/nett-tv/silverlight/getmediaxml.ashx?id=584548&hastighet=1000&vissuper=true' -> status code: 200
20:09:13 T:3980 M:2166693888  NOTICE: mms://straumod.nrk.no/disk11/Shakespeares_skjulte_koder/2009-12-09/NRK1_200912082130_KTCO_200067_06_170_600.wmv
20:09:13 T:3980 M:2166685696  NOTICE: SESSION: -> data not found in jar
20:09:13 T:3980 M:2166685696  NOTICE: PLUGIN::CONNECTION -> Connection to straumod.nrk.no requested...
20:09:13 T:6112 M:2166677504  NOTICE: PLUGIN::CONNECTION -> '/disk11/Shakespeares_skjulte_koder/2009-12-09/NRK1_200912082130_KTCO_200067_06_170_600.wmv?' -> status code: 200
20:09:13 T:3980 M:2166689792  NOTICE: [Reference]

                                            Ref1=http://straumod.nrk.no/disk11/Shakespeares_skjulte_koder/2009-12-09/NRK1_200912082130_KTCO_200067_06_170_600.wmv?&MSWMExt=.asf

                                            Ref2=http://10.103.0.57:80/disk11/Shakespeares_skjulte_koder/2009-12-09/NRK1_200912082130_KTCO_200067_06_170_600.wmv?&MSWMExt=.asf
20:09:13 T:3980 M:2166689792  NOTICE: PLUGIN::SPAM -> play url mms://straumod.nrk.no/disk11/Shakespeares_skjulte_koder/2009-12-09/NRK1_200912082130_KTCO_200067_06_170_600.wmv?&MSWMExt=.asf
20:09:13 T:3980 M:2166685696  NOTICE: PLUGIN::SPAM -> mark video as watched

I need a log where it fails. If I change it as suggested it will fail in other situations.


- VictorV - 2009-12-11

PanterA Wrote:Thanx for answering. The problem for me is that this stream nrk_tv_direkte_nrk1_h almost never work. I believe NRK don't stream outside Norway. The stream are not constant, so I have to alter between those I wrote earlier. If I try to watch the live stream trough NRK nett-TV it doesn't work. And I believe this is the same streamadress as in your app.

I'll try editing your chlive.py som I can choose between this links I have to alter. It will mess up your app if you do it so it's not a request for change.

My alternative is maybe put these links as add source or something in XBMC.

PanterA


Code:
import sys, os
from utils import Key, PluginSettings
from xbmcplugin import addDirectoryItem, endOfDirectory, setResolvedUrl
from xbmcgui import ListItem
from connection_manager import DataHandle


def mms_to_http(url):
    return url.replace('mms', 'http')

def mms_url(data):
    print data
    nurl = ''
    for c in data[18:]:
        if c != '\r':
            nurl += c
        else: break
    nurl = nurl.replace('http', 'mms')
    return nurl
        

        
class Main:

    CHANNELS = [
            ('nrk tv direkte', 'mms://straumv.nrk.no/nrk_tv_direkte_nrk1_%s'),
            ('nrk tv', 'mms://straumV.nrk.no/nrk_tv_nrk1_%s'),
            ('nrk webvid 1', 'mms://straumv.nrk.no/nrk_tv_webvid01_%s')
        ]
  
    
    def __init__(self):

        key = Key( sys.argv[2] )
        self.hndl = int(sys.argv[1])
        self.success = True
        
        if not key.url:
            self.parse_channels()
        else:
            self.get_stream(key.url)
            
    def get_stream(self, url):
        self.get_settings()
        self.dman = DataHandle()
        url = url % self.settings('connection_speed')
        url = mms_to_http( url )
        data = self.dman.get_data(url)
        url = mms_url(data)
        listitem = ListItem( url, path=url)
        print 'Play url: %s' % url
        setResolvedUrl(self.hndl, self.success, listitem)
        
    def get_settings(self):
        self.settings = PluginSettings()
        #Connection speed
        options = ( 'l', 'm', 'h', ); index = 11
        self.settings.add('connection_speed', 'values', options, index)
        
    def parse_channels(self):
        for i in self.CHANNELS:
            self.add(i[0], i[1])
        endOfDirectory(self.hndl)

    def add(self, label, url, type='channel', prefix='kanalene', img='', icon='', isdir=False):
        url = Key.build_url(prefix, type=type, url=url)
        li = ListItem(label, iconImage=icon, thumbnailImage=img)
        li.setProperty('IsPlayable', 'true')
        ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
        return ok

Replace your chlive.py with this, and add all the streams to the channel array


- klikkamongo - 2009-12-12

I've just downloaded the plug-in from this url, but when I start it I get a error message that this plug-in needs version 21735 of XBMC to run.

But I have just downloaded the XBMC_for_Windows-9.04.1-repack2.exe, isnt that the newest version?


- VictorV - 2009-12-13

Try the 9.11 Pre-release. http://sourceforge.net/projects/xbmc/files/XBMC%20for%20Windows/pre-release/xbmc-9.11-b2.exe/download


- berland - 2009-12-13

Bug report for plugin 09122009 and xbmc svn 25594, ubuntu linux 9.10 64-bit

Usage scenario: Click on Program -> Vis alfabetisk -> A -> Alarm

After ca 1 sec I get a nameerror exception in a dialogue box:
exceptions.NameError in create_directory at line 308 in file","plugin://NRK_API/xbmcplugin_program.py"," global name 'curpath' is not defined

Log
Code:
08:53:32 T:140261203646528 M:1301393408   DEBUG: Alloc resources: 0.18ms (0.00 ms skin load)
08:53:32 T:140261203646528 M:1301393408    INFO: CheckIdle - Closing session to http://www.google.com (easy=0x7f90f005c4f0, multi=(nil))
08:53:32 T:140260897577232 M:1301401600  NOTICE: PLUGIN::CONNECTION -> '/nett-tv/stifragment.aspx?id=213&type=prosjekt' -> status code: 200
08:53:32 T:140260637907216 M:1301401600  NOTICE: Current path: Nett-TV - Musikk - Alarm
08:53:32 T:140260637907216 M:1301401600  NOTICE: PLUGIN::SETTING -> extended_errormsg: True
08:53:32 T:140261203646528 M:1301401600   DEBUG: WaitOnScriptResult- plugin returned failure
08:53:32 T:140261203646528 M:1301401600   ERROR: GetDirectory - Error getting plugin://video/nrk media browser/?program&&image=%27http%3A%2F%2Ffil.nrk.no%2Fcontentfile%2Ffile%2F1.634276%21img634276.gif%27&parent_session=%27session_-7530751837030605661%27&type=%27prosjekt%27&id=213&
08:53:32 T:140261203646528 M:1301401600   ERROR: CGUIMediaWindow::GetDirectory(plugin://video/nrk media browser/?program&&image=%27http%3A%2F%2Ffil.nrk.no%2Fcontentfile%2Ffile%2F1.634276%21img634276.gif%27&parent_session=%27session_-7530751837030605661%27&type=%27prosjekt%27&id=213&) failed
08:53:32 T:140261203646528 M:1301401600   DEBUG: CGUIMediaWindow::GetDirectory (plugin://video/nrk media browser/?program&&parent_session=%27session_-7530751837030605661%27&type=%27program%27&id=%27A%27&view=%27letter%27&)
08:53:32 T:140261203646528 M:1301401600   DEBUG:   ParentPath = [plugin://video/nrk media browser/?program&&parent_session=%27session_-7530751837030605661%27&type=%27program%27&id=None&view=%27letter%27&]
08:53:32 T:140261203646528 M:1301401600   DEBUG: Loading fileitems [plugin://video/nrk media browser/?program&&parent_session=%27session_-7530751837030605661%27&type=%27program%27&id=%27A%27&view=%27letter%27&]
08:53:32 T:140260637907216 M:1301401600  NOTICE: "exceptions.NameError in create_directory at line 308 in file","plugin://NRK_API/xbmcplugin_program.py","          global name 'curpath' is not defined"
08:53:32 T:140260637907216 M:1301401600  NOTICE: exceptions.NameError



- VictorV - 2009-12-13

Thank you Berland. Fixed in:

http://prosjektet.net/xbmc/plugins/nrk_plugin_13122009.7z

I also added a favorite program function. If you open the context menu (right click a dir. item or press "c" on keyboard) You will see a alternative to add it to "favorite programs". This section will only become available in the plugins root menu after you have added one or more items. So you won't notice this function if you don't use it.

Next I will try to speed up the directory listing. I see there's something completly screwed up with the caching